[sage-support] Re: Problem with sagetex and fancyhdr

2020-05-13 Thread David Sevilla
(By the way, I wasn't able to ask at https://ask.sagemath.org/ because my 
question was detected as spam. So was an answer or comment I tried to post 
earlier in the day.)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/a08c5280-bd23-4222-9b65-6008515eeb8d%40googlegroups.com.


[sage-support] Problem with sagetex and fancyhdr

2020-05-13 Thread David Sevilla


Hi, I have been trying to use SageTeX in a document where I also use the 
fancyhdr package, and I am not able to put Sage computations in the header 
(or the footer). A minimal example follows.

\documentclass{article}
\usepackage{sagetex}
\usepackage{fancyhdr}

\begin{document}

\begin{sagesilent}
n = 1
\end{sagesilent}

\fancyhead[R]{$\sage{n}$}
\title
{$\sage{n}$}
\maketitle
\thispagestyle{fancy}

\end{document} 


After pdflatex, and running sage on the .sagetex.sage file, I get the 
following error:

Processing Sage code for test02.tex...
Code block (line 7) begin...end
Inline formula 0 (line 14)
Sage processing complete. Run LaTeX on test02.tex again.
Inline formula 1 (line 17)

 Error in Sage code on line 17 of test02.tex! Traceback follows.
Traceback (most recent call last):
  File "test02.sagetex.sage.py", line 24, in 
_st_.inline(_sage_const_1 , latex(n))
  File "/usr/lib/python2.7/dist-packages/sagetex.py", line 121, in inline
'}{{%\n' + s.rstrip() + '}{}{}{}{}}\n')
ValueError: I/O operation on closed file

 Running Sage on test02.sage failed! Fix test02.tex and try again.
Traceback (most recent call last):
  File "test02.sagetex.sage.py", line 26, in 
_st_.goboom(_sage_const_17 )
  File "/usr/lib/python2.7/dist-packages/sagetex.py", line 264, in goboom
os.remove(self.filename + '.sagetex.sout.tmp')
OSError: [Errno 2] No such file or directory: 'test02.sagetex.sout.tmp'

As you can see, "inline formula 0" was generated properly and the 
processing ended there; that line (14) is the \maketitle. On the other 
hand, inline formula 1 was not resolved because the file was already closed 
(note the "Sage processing complete" before); the line 17 where it arose is 
the \end{document}. After the second pdflatex, the Sage result appears 
correctly in the title but "??" appears instead in the header, and I get 
the:

LaTeX Warning: Reference `@sageinline1' on page 1 undefined on input line 
17.



Any suggestions on how to combine these two packages is very welcome, or at 
least an explanation of this behaviour (why did Sage think that there was 
nothing else to do after formula 0???). I cannot think of a workaround, 
other than avoiding fancyhdr and searching for smart LaTeX to be able to 
put things into place.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/fabb1997-a5c5-4a5f-819c-1f5a4fb63ff3%40googlegroups.com.


Re: [sage-support] How to search a usage of a specific function?

2020-05-13 Thread Jean-Florent Raymond
Hello,

To show the description of a function, you can type the name of the
function followed by a question mark ("Mod?" in your case) and press
Enter. If you want to show the source of the function, you can do the
same thing with two question marks instead ("Mod??").


Le 13/05/2020 à 15:35, GZ D a écrit :
> For example, I want to search the usage of the function called *Mod*, and 
> what should I do if I want to know the usage and the related description of 
> this function?
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/8d9f41f3-271d-dae6-3809-8c769db6c052%40uca.fr.


[sage-support] How to search a usage of a specific function?

2020-05-13 Thread GZ D
For example, I want to search the usage of the function called *Mod*, and 
what should I do if I want to know the usage and the related description of 
this function?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/e249f9cf-091f-46ec-83b3-76f6eebf0c91%40googlegroups.com.


[sage-support] Re: Calculate the DLP of 9916780 = (5**y) mod 20876441?

2020-05-13 Thread Madison Adams
>From running this script do you get the value y = 17?  I used a wolfram 
calculator just to be sure.

On Wednesday, May 13, 2020 at 6:00:37 AM UTC-4, GZ D wrote:
>
> You can use a function called *discrete_log, *and I have shown you a 
> script below.
>
> m=5
> c=9916780
> n=20876441
> m=Mod(m,n)
> c=Mod(c,n)
> print(discrete_log(c,m))
>
> 在 2020年5月13日星期三 UTC+8下午12:11:57,Madison Adams写道:
>>
>> Hi,
>> So my goal is to find the variable y of this equation.
>> Does sage math provide a function for Discrete Logarithm Problems?
>>
>> The equation is this: 9916780 = (5**y) mod 20876441.
>> I also would like to know if there is an efficient way to do this in 
>> Python 3.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/0f9499de-5cc7-40b9-9260-59d315502658%40googlegroups.com.


[sage-support] Re: Calculate the DLP of 9916780 = (5**y) mod 20876441?

2020-05-13 Thread GZ D
You can use a function called *discrete_log, *and I have shown you a script 
below.

m=5
c=9916780
n=20876441
m=Mod(m,n)
c=Mod(c,n)
print(discrete_log(c,m))

在 2020年5月13日星期三 UTC+8下午12:11:57,Madison Adams写道:
>
> Hi,
> So my goal is to find the variable y of this equation.
> Does sage math provide a function for Discrete Logarithm Problems?
>
> The equation is this: 9916780 = (5**y) mod 20876441.
> I also would like to know if there is an efficient way to do this in 
> Python 3.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/6577def5-f97f-4bde-bba8-232c904a70f2%40googlegroups.com.