Re: [sage-support] find_local_maximum of the absolute value of a polynomial with complex coefficients

2018-01-15 Thread João Alberto de França Ferreira
Oops! a piece of the code is missing. The complete code is below.

n=6 # polynomial order
listOmega=[]
for i in range(n+1):
listOmega.append(i/n)

listPhases=[0]
for i in range(1,n+1):
listPhases.append(listOmega[i]^2/2 + 9/2*listOmega[i])

Alpha0=listOmega[1]/tan(listPhases[1])
listAlpha=[Alpha0]
for i in range(1,n):
firstline=listOmega[i+1]^2-listOmega[i]^2
lastline=Alpha0-listOmega[i+1]/tan(listPhases[i+1])
ic=1
while ic
> Sorry for the delay, I took some time to put the code to work. However, 
> there's something strange.
>
> Below is a "concise" version of my code. The strange thing that I noticed 
> is that the *find_local_maximum* function returns a polynomial as the 
> maximum value, and changing the tolerance (*tol*) argument of the 
> function do not change the result. You can see in the graph that the 
> maximum point is slightly away from the calculated point.
>
> Thank you for the help!
>
> n=6 # polynomial order
> listOmega=[]
> for i in range(n+1):
> listOmega.append(i/n)
>
> listPhases=[0]
> for i in range(1,n+1):
> listPhases.append(listOmega[i]^2/2 + 9/2*listOmega[i])
>
> Alpha0=listOmega[1]/tan(listPhases[1])
> listAlpha=[Alpha0]
> for i in range(1,n):
> firstline=listOmega[i+1]^2-listOmega[i]^2
> lastline=Alpha0-listOmega[i+1]/tan(listPhases[i+1])
> ic=1
> while ic lastline=listAlpha[ic]-((listOmega[i+1]^2 - 
> listOmega[ic]^2)/lastline)
> ic+=1
> listAlpha.append(firstline/lastline)
>
> var('s,omega')
> H=[1,s + listAlpha[0]]
> for i in range(2,n+1):
> H.append(listAlpha[i-1]*H[i-1] + (s^2 + listOmega[i-1]^2)*H[i-2])
>
> f=sqrt(H[6](s=I*omega)*H[6](s=-I*omega));
> g=[]
> for i in range(n+1):
> g.append(f*chebyshev_T(i,omega)/sqrt(1-omega^2))
>
> up=0
> for i in range(n+1):
> up=up + c[i]*chebyshev_T(i,omega)
>
> hmod(omega)=(H[6](s=I*omega)).polynomial(CC)
> den=lambda omega: up/abs(hmod(omega))
> norm_factor=find_local_maximum(den,-1,1,tol=1e-18); norm_factor
> print("Point where local maximum occurs: " + str(norm_factor[1]))
> print("Local maximum: " + str(norm_factor[0](omega=norm_factor[1]).n()))
> plot(den(omega),-1,1)
>
> On Friday, January 12, 2018 at 4:51:32 PM UTC+1, Vegard Lima wrote:
>>
>> Hi 
>>
>> On Fri, Jan 12, 2018 at 4:10 PM, João Alberto de França Ferreira 
>> <joa...@gmail.com> wrote: 
>> > Is there a way to compute the local maximum of the absolute value of a 
>> > polynomial with complex coefficients? the below snippet should 
>> exemplify my 
>> > problem. 
>> ... 
>>
>> Maybe a trick like this works: 
>> f(x) = x^2 + 2*I*x + 2 
>> g = lambda x: abs(f(x)) 
>> find_local_maximum(g,-1,1) 
>>
>> this gives 
>> (3.6055511727769516, 0.9996297566163) 
>>
>> while 
>> find_local_maximum(abs(f(x)),-1,1) 
>> gives 
>> TypeError: unable to coerce to a real number 
>>
>> The difference is that one is a python function while 
>> the other one is a SymbolicExpression, not sure 
>> why one works and the other doesn't. 
>>
>>
>> Thanks, 
>> -- 
>> Vegard 
>>
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] find_local_maximum of the absolute value of a polynomial with complex coefficients

2018-01-15 Thread João Alberto de França Ferreira
Thank you! maybe the code on the other message will serve as an 
example/test.

On Sunday, January 14, 2018 at 8:11:10 AM UTC+1, Ralf Stephan wrote:
>
>
>
> On Friday, January 12, 2018 at 4:51:32 PM UTC+1, Vegard Lima wrote:
>>
>> TypeError: unable to coerce to a real number 
>>
>
> Thanks. I opened
> https://trac.sagemath.org/ticket/24536
> https://trac.sagemath.org/ticket/24537
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] find_local_maximum of the absolute value of a polynomial with complex coefficients

2018-01-15 Thread João Alberto de França Ferreira
Sorry for the delay, I took some time to put the code to work. However, 
there's something strange.

Below is a "concise" version of my code. The strange thing that I noticed 
is that the *find_local_maximum* function returns a polynomial as the 
maximum value, and changing the tolerance (*tol*) argument of the function 
do not change the result. You can see in the graph that the maximum point 
is slightly away from the calculated point.

Thank you for the help!

n=6 # polynomial order
listOmega=[]
for i in range(n+1):
listOmega.append(i/n)

listPhases=[0]
for i in range(1,n+1):
listPhases.append(listOmega[i]^2/2 + 9/2*listOmega[i])

Alpha0=listOmega[1]/tan(listPhases[1])
listAlpha=[Alpha0]
for i in range(1,n):
firstline=listOmega[i+1]^2-listOmega[i]^2
lastline=Alpha0-listOmega[i+1]/tan(listPhases[i+1])
ic=1
while ic
> Hi 
>
> On Fri, Jan 12, 2018 at 4:10 PM, João Alberto de França Ferreira 
> <joa...@gmail.com > wrote: 
> > Is there a way to compute the local maximum of the absolute value of a 
> > polynomial with complex coefficients? the below snippet should exemplify 
> my 
> > problem. 
> ... 
>
> Maybe a trick like this works: 
> f(x) = x^2 + 2*I*x + 2 
> g = lambda x: abs(f(x)) 
> find_local_maximum(g,-1,1) 
>
> this gives 
> (3.6055511727769516, 0.9996297566163) 
>
> while 
> find_local_maximum(abs(f(x)),-1,1) 
> gives 
> TypeError: unable to coerce to a real number 
>
> The difference is that one is a python function while 
> the other one is a SymbolicExpression, not sure 
> why one works and the other doesn't. 
>
>
> Thanks, 
> -- 
> Vegard 
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] find_local_maximum of the absolute value of a polynomial with complex coefficients

2018-01-12 Thread João Alberto de França Ferreira
Hi!

Is there a way to compute the local maximum of the absolute value of a 
polynomial with complex coefficients? the below snippet should exemplify my 
problem.

var('omega')
plot(abs(-omega^6 + 2.52349407705763*I*omega^5 + 4.57149144245722*omega^4 - 
4.95095921397014*I*omega^3 - 3.70209076479630*omega^2 + 
1.64521458323097*I*omega + 0.361999139300718),-1,1)
find_local_maximum(abs(-omega^6 + 2.52349407705763*I*omega^5 + 
4.57149144245722*omega^4 - 4.95095921397014*I*omega^3 - 
3.70209076479630*omega^2 + 1.64521458323097*I*omega + 
0.361999139300718),-1,1)

Mathematica is able to compute this without problems.

Thank you!

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-03 Thread João Alberto Ferreira
Yes, thank you! This is what I made.

On Friday, February 3, 2017 at 8:52:30 AM UTC+1, Dima Pasechnik wrote:
>
> You can always create a symbolic link in /usr/local/bin/ to some other 
> location.
>
> sudo ln -sf /blah/foo/sage /usr/local/bin/sage 
>
> after building sage in /blah/foo/
>
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-02 Thread João Alberto Ferreira
Ok, thank you!

I would be glad if you could explain how can we put sage in, for example, 
/usr/local/ or /opt/, if sage force us to compile without root privileges.

On Thursday, February 2, 2017 at 11:50:14 PM UTC+1, John H Palmieri wrote:
>
>
>
> On Thursday, February 2, 2017 at 1:53:43 PM UTC-8, João Alberto Ferreira 
> wrote:
>>
>> Well, I read somewhere about this procedure of moving the directory 
>> before starting sage, but the Installation Manual seems to tell the same 
>> thing.
>>
>> "The directory where you built Sage is *NOT* hardcoded. You should be 
>> able to safely move or rename that directory. (It’s a bug if this is not 
>> the case.)"
>>  
>>
>
>> Chapter 2 describes this same procedure of moving the directory, but for 
>> the precompiled binaries, that for me is the same thing.
>>
>
> We should fix the documentation. See 
> https://trac.sagemath.org/ticket/22294.
>
>   John
>
>  
>
>>
>> But, in fact, what I experienced was what you said. 
>>
>> On Thursday, February 2, 2017 at 9:28:17 PM UTC+1, HG wrote:
>>>
>>> I think it has been said on the list : Keep sage where you compiled it !
>>>
>>> If you want to change it you have to compile source again !
>>>
>>> what I do because I work with git :
>>>
>>> I make a dir git 
>>>
>>> I compile it there and after I link sage in /usr/bin/sage
>>>
>>> sudo ln -s /path where is sage/sage /usr/bin/sage
>>>
>>>
>>>
>>> Le 02/02/2017 à 20:43, João Alberto Ferreira a écrit :
>>>
>>> Hi!
>>>
>>> I just removed "/home/mmsim/tools/lib/64bit" from the LD_LIBRARY_PATH 
>>> environment variable and sage compiled.
>>>
>>> I compiled it in my home directory and moved it to /usr/local/ before 
>>> starting it, and created a symbolic link in /usr/local/bin/, but it shows me
>>>
>>> python: error while loading shared libraries: libpython2.7.so.1.0: 
>>> cannot open shared object file: No such file or directory
>>>
>>> It just works in the place where I compiled it. I will leave the things 
>>> like that, but I'm curious to know why it do not work. Isn't that correct? 
>>> Do I Have made something wrong?
>>>
>>> Thank you!
>>>
>>> On Thursday, February 2, 2017 at 12:14:51 PM UTC+1, Dima Pasechnik 
>>> wrote: 
>>>>
>>>>
>>>>
>>>> On Thursday, February 2, 2017 at 10:36:41 AM UTC, João Alberto Ferreira 
>>>> wrote: 
>>>>>
>>>>>
>>>>>
>>>>> On Wednesday, February 1, 2017 at 7:24:56 PM UTC+1, Dima Pasechnik 
>>>>> wrote: 
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wednesday, February 1, 2017 at 6:00:25 PM UTC, João Alberto 
>>>>>> Ferreira wrote: 
>>>>>>>
>>>>>>> Well, not yet.
>>>>>>>
>>>>>>> openblas has compiled successfully. The problem now is with R. The R 
>>>>>>> log follows.
>>>>>>>
>>>>>>> Apparently it needs libgomp-4 and if I understood correctrly, it 
>>>>>>> found an older version. But the libgomp-4 is installed
>>>>>>>
>>>>>>> [defrancaferr_joa@javel sage-7.5.1]$ rpm -q libgomp
>>>>>>> libgomp-4.4.7-17.el6.x86_64
>>>>>>>
>>>>>>
>>>>>> your log says:
>>>>>>  /home/mmsim/tools/lib/64bit/libgomp.so.1 : version `GOMP_4.0' not 
>>>>>> found
>>>>>>
>>>>>> you have some rogue stuff in your PATH or something (LD_LIBRARY_PATH 
>>>>>> ?)
>>>>>>
>>>>>
>>>>> The environment variables are at the beginning of the whole log file
>>>>>
>>>>
>>>> OK, I overlooked this...
>>>>  
>>>>
>>>>>
>>>>>
>>>>> LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib:/usr/local/lib:/home/mmsim/tools/lib/64bit
>>>>>
>>>>>
>>>>> PATH=/home/defrancaferr_joa/sage-7.5.1/build/bin:/home/defrancaferr_joa/sage-7.5.1/src/bin:/home/defrancaferr_joa/sage-7.5.1/local/bin:/opt/rh/devtoolset-3/root/usr/bin:/home/xfab/xkit/x_all/cadence/xenv:/usr/local/ADS2014_01/bin:/usr/local/texlive/2016/bin/x8

Re: [sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-02 Thread João Alberto Ferreira
Well, I read somewhere about this procedure of moving the directory before 
starting sage, but the Installation Manual seems to tell the same thing.

"The directory where you built Sage is *NOT* hardcoded. You should be able 
to safely move or rename that directory. (It’s a bug if this is not the 
case.)"

Chapter 2 describes this same procedure of moving the directory, but for 
the precompiled binaries, that for me is the same thing.

But, in fact, what I experienced was what you said. 

On Thursday, February 2, 2017 at 9:28:17 PM UTC+1, HG wrote:
>
> I think it has been said on the list : Keep sage where you compiled it !
>
> If you want to change it you have to compile source again !
>
> what I do because I work with git :
>
> I make a dir git 
>
> I compile it there and after I link sage in /usr/bin/sage
>
> sudo ln -s /path where is sage/sage /usr/bin/sage
>
>
>
> Le 02/02/2017 à 20:43, João Alberto Ferreira a écrit :
>
> Hi!
>
> I just removed "/home/mmsim/tools/lib/64bit" from the LD_LIBRARY_PATH 
> environment variable and sage compiled.
>
> I compiled it in my home directory and moved it to /usr/local/ before 
> starting it, and created a symbolic link in /usr/local/bin/, but it shows me
>
> python: error while loading shared libraries: libpython2.7.so.1.0: cannot 
> open shared object file: No such file or directory
>
> It just works in the place where I compiled it. I will leave the things 
> like that, but I'm curious to know why it do not work. Isn't that correct? 
> Do I Have made something wrong?
>
> Thank you!
>
> On Thursday, February 2, 2017 at 12:14:51 PM UTC+1, Dima Pasechnik wrote: 
>>
>>
>>
>> On Thursday, February 2, 2017 at 10:36:41 AM UTC, João Alberto Ferreira 
>> wrote: 
>>>
>>>
>>>
>>> On Wednesday, February 1, 2017 at 7:24:56 PM UTC+1, Dima Pasechnik 
>>> wrote: 
>>>>
>>>>
>>>>
>>>> On Wednesday, February 1, 2017 at 6:00:25 PM UTC, João Alberto Ferreira 
>>>> wrote: 
>>>>>
>>>>> Well, not yet.
>>>>>
>>>>> openblas has compiled successfully. The problem now is with R. The R 
>>>>> log follows.
>>>>>
>>>>> Apparently it needs libgomp-4 and if I understood correctrly, it found 
>>>>> an older version. But the libgomp-4 is installed
>>>>>
>>>>> [defrancaferr_joa@javel sage-7.5.1]$ rpm -q libgomp
>>>>> libgomp-4.4.7-17.el6.x86_64
>>>>>
>>>>
>>>> your log says:
>>>>  /home/mmsim/tools/lib/64bit/libgomp.so.1 : version `GOMP_4.0' not found
>>>>
>>>> you have some rogue stuff in your PATH or something (LD_LIBRARY_PATH ?)
>>>>
>>>
>>> The environment variables are at the beginning of the whole log file
>>>
>>
>> OK, I overlooked this...
>>  
>>
>>>
>>>
>>> LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib:/usr/local/lib:/home/mmsim/tools/lib/64bit
>>>
>>>
>>> PATH=/home/defrancaferr_joa/sage-7.5.1/build/bin:/home/defrancaferr_joa/sage-7.5.1/src/bin:/home/defrancaferr_joa/sage-7.5.1/local/bin:/opt/rh/devtoolset-3/root/usr/bin:/home/xfab/xkit/x_all/cadence/xenv:/usr/local/ADS2014_01/bin:/usr/local/texlive/2016/bin/x86_64-linux:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/defrancaferr_joa/bin:/home/eclipse:/home/matlab/bin:/home/altera/15.0/quartus/bin:/home/altera/15.0/quartus/sopc_builder/bin:/home/altera/15.0/quartus/bin:/home/ic6.1/tools/bin:/home/ic6.1/tools/dfII/bin:/home/ic6.1/tools/plot/bin:/home/ic6.1/tools/dracula/bin:/home/assura/tools/bin:/home/assura/tools/assura/bin:/home/AMS_4.10/cds/bin:/home/AMS_4.10/programs/bin:/home/mmsim/tools/bin:/home/incisiv/tools/bin:/home/incisiv/tools/dfII/bin:/home/rc/tools/bin:/home/edi/tools/bin:/home/et/tools/bin:/home/ets/tools/bin:/home/ext/tools/bin:/home/confrml/tools/bin:/home/ctos/tools/bin:/home/pve:/home/pve/tools/bin
>>>
>>>
>> yes, this is definitely the problem.
>> You can just unset these for the particular invocation of make, i.e.
>>
>> export MAKE="make -j8" # or whatever numer of cores you have on the box
>> PATH="/bin:/usr/bin:/sbin:/usr/sbin" LD_LIBRARY_PATH="" $MAKE
>>
>> Note that these wrong libraries could have been already selected by other
>> parts that are already built, and this may lead to hard to understand 
>> crashes etc.
>>
>> That is, I would rebuild from scratch, i.e. do first of all
>>
>> make distclean

[sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-02 Thread João Alberto Ferreira
Hi!

I just removed "/home/mmsim/tools/lib/64bit" from the LD_LIBRARY_PATH 
environment variable and sage compiled.

I compiled it in my home directory and moved it to /usr/local/ before 
starting it, and created a symbolic link in /usr/local/bin/, but it shows me

python: error while loading shared libraries: libpython2.7.so.1.0: cannot 
open shared object file: No such file or directory

It just works in the place where I compiled it. I will leave the things 
like that, but I'm curious to know why it do not work. Isn't that correct? 
Do I Have made something wrong?

Thank you!

On Thursday, February 2, 2017 at 12:14:51 PM UTC+1, Dima Pasechnik wrote:
>
>
>
> On Thursday, February 2, 2017 at 10:36:41 AM UTC, João Alberto Ferreira 
> wrote:
>>
>>
>>
>> On Wednesday, February 1, 2017 at 7:24:56 PM UTC+1, Dima Pasechnik wrote:
>>>
>>>
>>>
>>> On Wednesday, February 1, 2017 at 6:00:25 PM UTC, João Alberto Ferreira 
>>> wrote:
>>>>
>>>> Well, not yet.
>>>>
>>>> openblas has compiled successfully. The problem now is with R. The R 
>>>> log follows.
>>>>
>>>> Apparently it needs libgomp-4 and if I understood correctrly, it found 
>>>> an older version. But the libgomp-4 is installed
>>>>
>>>> [defrancaferr_joa@javel sage-7.5.1]$ rpm -q libgomp
>>>> libgomp-4.4.7-17.el6.x86_64
>>>>
>>>
>>> your log says:
>>>  /home/mmsim/tools/lib/64bit/libgomp.so.1 : version `GOMP_4.0' not found
>>>
>>> you have some rogue stuff in your PATH or something (LD_LIBRARY_PATH ?)
>>>
>>
>> The environment variables are at the beginning of the whole log file
>>
>
> OK, I overlooked this...
>  
>
>>
>>
>> LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib:/usr/local/lib:/home/mmsim/tools/lib/64bit
>>
>>
>> PATH=/home/defrancaferr_joa/sage-7.5.1/build/bin:/home/defrancaferr_joa/sage-7.5.1/src/bin:/home/defrancaferr_joa/sage-7.5.1/local/bin:/opt/rh/devtoolset-3/root/usr/bin:/home/xfab/xkit/x_all/cadence/xenv:/usr/local/ADS2014_01/bin:/usr/local/texlive/2016/bin/x86_64-linux:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/defrancaferr_joa/bin:/home/eclipse:/home/matlab/bin:/home/altera/15.0/quartus/bin:/home/altera/15.0/quartus/sopc_builder/bin:/home/altera/15.0/quartus/bin:/home/ic6.1/tools/bin:/home/ic6.1/tools/dfII/bin:/home/ic6.1/tools/plot/bin:/home/ic6.1/tools/dracula/bin:/home/assura/tools/bin:/home/assura/tools/assura/bin:/home/AMS_4.10/cds/bin:/home/AMS_4.10/programs/bin:/home/mmsim/tools/bin:/home/incisiv/tools/bin:/home/incisiv/tools/dfII/bin:/home/rc/tools/bin:/home/edi/tools/bin:/home/et/tools/bin:/home/ets/tools/bin:/home/ext/tools/bin:/home/confrml/tools/bin:/home/ctos/tools/bin:/home/pve:/home/pve/tools/bin
>>
>>
> yes, this is definitely the problem.
> You can just unset these for the particular invocation of make, i.e.
>
> export MAKE="make -j8" # or whatever numer of cores you have on the box
> PATH="/bin:/usr/bin:/sbin:/usr/sbin" LD_LIBRARY_PATH="" $MAKE
>
> Note that these wrong libraries could have been already selected by other
> parts that are already built, and this may lead to hard to understand 
> crashes etc.
>
> That is, I would rebuild from scratch, i.e. do first of all
>
> make distclean
>
> HTH
> Dima
>  
>
>> [defrancaferr_joa@javel sage-7.5.1]$ find 
>> /opt/rh/devtoolset-3/root/usr/lib64/ -name "libgomp*" -exec ls -ls {} \;
>> [defrancaferr_joa@javel sage-7.5.1]$ find 
>> /opt/rh/devtoolset-3/root/usr/lib/ -name "libgomp*" -exec ls -ls {} \;
>> 4 -rw-r--r--. 1 root root 82  3 oct.   2015 
>> /opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.so
>> 4 -rw-r--r--. 1 root root 169  3 oct.   2015 
>> /opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.spec
>> 176 -rw-r--r--. 1 root root 178766  3 oct.   2015 
>> /opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.a
>> 4 -rw-r--r--. 1 root root 78  3 oct.   2015 
>> /opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/32/libgomp.so
>> 140 -rw-r--r--. 1 root root 143328  3 oct.   2015 
>> /opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/32/libgomp.a
>> [defrancaferr_joa@javel sage-7.5.1]$ find /usr/local/lib -name "libgomp*" 
>> -exec ls -ls {} \;
>> [defrancaferr_joa@javel sage-7.5.1]$ find /home/mmsim/tools/lib/64bit 
>> -name "libgomp*" -exec ls -ls {} \;
>> 0 lrwxrwxrwx. 1 cadence soft

[sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-02 Thread João Alberto Ferreira


On Wednesday, February 1, 2017 at 7:24:56 PM UTC+1, Dima Pasechnik wrote:
>
>
>
> On Wednesday, February 1, 2017 at 6:00:25 PM UTC, João Alberto Ferreira 
> wrote:
>>
>> Well, not yet.
>>
>> openblas has compiled successfully. The problem now is with R. The R log 
>> follows.
>>
>> Apparently it needs libgomp-4 and if I understood correctrly, it found an 
>> older version. But the libgomp-4 is installed
>>
>> [defrancaferr_joa@javel sage-7.5.1]$ rpm -q libgomp
>> libgomp-4.4.7-17.el6.x86_64
>>
>
> your log says:
>  /home/mmsim/tools/lib/64bit/libgomp.so.1 : version `GOMP_4.0' not found
>
> you have some rogue stuff in your PATH or something (LD_LIBRARY_PATH ?)
>

The environment variables are at the beginning of the whole log file

LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib:/usr/local/lib:/home/mmsim/tools/lib/64bit

PATH=/home/defrancaferr_joa/sage-7.5.1/build/bin:/home/defrancaferr_joa/sage-7.5.1/src/bin:/home/defrancaferr_joa/sage-7.5.1/local/bin:/opt/rh/devtoolset-3/root/usr/bin:/home/xfab/xkit/x_all/cadence/xenv:/usr/local/ADS2014_01/bin:/usr/local/texlive/2016/bin/x86_64-linux:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/defrancaferr_joa/bin:/home/eclipse:/home/matlab/bin:/home/altera/15.0/quartus/bin:/home/altera/15.0/quartus/sopc_builder/bin:/home/altera/15.0/quartus/bin:/home/ic6.1/tools/bin:/home/ic6.1/tools/dfII/bin:/home/ic6.1/tools/plot/bin:/home/ic6.1/tools/dracula/bin:/home/assura/tools/bin:/home/assura/tools/assura/bin:/home/AMS_4.10/cds/bin:/home/AMS_4.10/programs/bin:/home/mmsim/tools/bin:/home/incisiv/tools/bin:/home/incisiv/tools/dfII/bin:/home/rc/tools/bin:/home/edi/tools/bin:/home/et/tools/bin:/home/ets/tools/bin:/home/ext/tools/bin:/home/confrml/tools/bin:/home/ctos/tools/bin:/home/pve:/home/pve/tools/bin

[defrancaferr_joa@javel sage-7.5.1]$ find 
/opt/rh/devtoolset-3/root/usr/lib64/ -name "libgomp*" -exec ls -ls {} \;
[defrancaferr_joa@javel sage-7.5.1]$ find 
/opt/rh/devtoolset-3/root/usr/lib/ -name "libgomp*" -exec ls -ls {} \;
4 -rw-r--r--. 1 root root 82  3 oct.   2015 
/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.so
4 -rw-r--r--. 1 root root 169  3 oct.   2015 
/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.spec
176 -rw-r--r--. 1 root root 178766  3 oct.   2015 
/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.a
4 -rw-r--r--. 1 root root 78  3 oct.   2015 
/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/32/libgomp.so
140 -rw-r--r--. 1 root root 143328  3 oct.   2015 
/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/32/libgomp.a
[defrancaferr_joa@javel sage-7.5.1]$ find /usr/local/lib -name "libgomp*" 
-exec ls -ls {} \;
[defrancaferr_joa@javel sage-7.5.1]$ find /home/mmsim/tools/lib/64bit -name 
"libgomp*" -exec ls -ls {} \;
0 lrwxrwxrwx. 1 cadence softs 16 15 janv.  2016 
/home/mmsim/tools/lib/64bit/libgomp.so.1 -> libgomp.so.1.0.0
276 -rwxr-xr-x. 1 cadence softs 281302 26 sept.  2011 
/home/mmsim/tools/lib/64bit/libgomp.so.1.0.0
0 lrwxrwxrwx. 1 cadence softs 16 15 janv.  2016 
/home/mmsim/tools/lib/64bit/libgomp.so -> libgomp.so.1.0.0
 

>
> What is this /home/mmsim and what does it have to do with your account 
> (defrancaferr_joa, I suppose)?
>

mmsim (multi-mode simulator) is an electronic circuit simulator. I'm 
intended to use this to design an integrated circuit, but this folder 
houses an older version of the simulator (version 14). The newer version 
resides in /home/mmsim15. In fact, this machine is a new one, which the 
system administrator installed by cloning the disk of another machine. Now, 
I'm configuring it to my needs through sudo, but things seems to be 
organized in an odd manner (like this simulator in the \home directory)

It seems that the configuration of the integrated circuit design tools are 
messed up and I need, at least, organize the environment variables before 
compile sage. I think I need to edit the .bash_profile (appended). What do 
you think?
 

> (It finds this stuff there first, and tries to use it...)
>
>
>
>> On Wednesday, February 1, 2017 at 5:56:44 PM UTC+1, João Alberto Ferreira 
>> wrote:
>>>
>>> Thank you!
>>>
>>> I've done: 
>>>
>>> [defrancaferr_joa@javel ~]$ sudo yum install centos-release-scl
>>> [defrancaferr_joa@javel ~]$ sudo yum install devtoolset-3-toolchain
>>> [defrancaferr_joa@javel ~]$ scl enable devtoolset-3 bash
>>> [defrancaferr_joa@javel ~]$ as --version
>>> Assembleur GNU version 2.24
>>> Copyright 2013 Free Software Foundation, Inc.
>>> Ce logiciel est libre; vous pouvez le redistribuer selon les termes de la
>>> ver

[sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-01 Thread João Alberto Ferreira
Well, not yet.

openblas has compiled successfully. The problem now is with R. The R log 
follows.

Apparently it needs libgomp-4 and if I understood correctrly, it found an 
older version. But the libgomp-4 is installed

[defrancaferr_joa@javel sage-7.5.1]$ rpm -q libgomp
libgomp-4.4.7-17.el6.x86_64

On Wednesday, February 1, 2017 at 5:56:44 PM UTC+1, João Alberto Ferreira 
wrote:
>
> Thank you!
>
> I've done: 
>
> [defrancaferr_joa@javel ~]$ sudo yum install centos-release-scl
> [defrancaferr_joa@javel ~]$ sudo yum install devtoolset-3-toolchain
> [defrancaferr_joa@javel ~]$ scl enable devtoolset-3 bash
> [defrancaferr_joa@javel ~]$ as --version
> Assembleur GNU version 2.24
> Copyright 2013 Free Software Foundation, Inc.
> Ce logiciel est libre; vous pouvez le redistribuer selon les termes de la
> version 3 de la licence GNU General Public License ou suivante.
> Ce programme n'est couvert par AUCUNE garantie.
> Cet assembleur a été configuré pour la cible « x86_64-redhat-linux ».
>
> Let's see if it will work.
>
>
>
> On Wednesday, February 1, 2017 at 5:27:36 PM UTC+1, Dima Pasechnik wrote:
>>
>>
>>
>> On Wednesday, February 1, 2017 at 3:52:05 PM UTC, João Alberto Ferreira 
>> wrote:
>>>
>>> Hi!
>>>
>>> Here it is the command output.
>>>
>>> [defrancaferr_joa@javel ~]$ as --version
>>> GNU assembler version 2.20.51.0.2-5.44.el6 20100205
>>> Copyright 2009 Free Software Foundation, Inc.
>>>
>>
>> Thanks, this explains your problem. Your assembler is 7 years old, and 
>> your CPU
>> is only 4 years old, if not newer. You are building with (sage-supplied)
>> gcc 4.9, which issues correct assembler commands for your CPU.
>> But your assembler does not understand some of them, as it is too old.
>>
>> Why Centos is so lame in this respect, we've seen many reports like 
>> this...
>> You should upgrade your toolchain so that your assembler fully supports 
>> you CPU.
>>
>> HTH,
>> Dima
>>  
>>  
>>
>>> This program is free software; you may redistribute it under the terms of
>>> the GNU General Public License version 3 or later.
>>> This program has absolutely no warranty.
>>> This assembler was configured for a target of `x86_64-redhat-linux'.
>>>
>>> On Wednesday, February 1, 2017 at 12:05:22 PM UTC+1, Dima Pasechnik 
>>> wrote:
>>>>
>>>> please post the output of 
>>>>
>>>> as --version
>>>>
>>>> on the system. I guess it is too old to understand the whole range of 
>>>> assembler commands for your CPU.
>>>>
>>>>
>>>> On Wednesday, February 1, 2017 at 10:09:27 AM UTC, João Alberto 
>>>> Ferreira wrote:
>>>>>
>>>>> Hi!
>>>>>
>>>>> I have tried to compile sagemath under a CentOS 6.8 machine, as the 
>>>>> binaries for Fedora do not work. The installation halted with an error 
>>>>> while building OpenBlas. Made the error is due to the machine CPU, as 
>>>>> discussed in https://github.com/JuliaLang/julia/issues/7653, but I 
>>>>> have little experience in this. Part of the installation log is attached. 
>>>>> I 
>>>>> updated the operating system and want to try build Sage again. Does 
>>>>> anyone 
>>>>> have any sugestion?
>>>>>
>>>>> It seems that all developing tools are installed, as can be seen below
>>>>>
>>>>> [defrancaferr_joa@javel ~]$ rpm -q perl-ExtUtils-MakeMaker
>>>>> perl-ExtUtils-MakeMaker-6.55-141.el6_7.1.x86_64
>>>>> [defrancaferr_joa@javel ~]$ which perl
>>>>> /usr/bin/perl
>>>>> [defrancaferr_joa@javel ~]$ rpm -q binutils
>>>>> binutils-2.20.51.0.2-5.44.el6.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q gcc
>>>>> gcc-4.4.7-17.el6.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q make
>>>>> make-3.81-23.el6.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q m4
>>>>> m4-1.4.13-5.el6.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q perl
>>>>> perl-5.10.1-141.el6_7.1.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q tar
>>>>> tar-1.23-15.el6_8.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q git
>>>>> git-1.7.1-4.el6_7.1.x86_64
>>>>> [defrancaferr_joa@javel ~]$ rpm -q gcc-c++
>>>>> gcc-c++-4.4.7-17.el6.x86_64
>>&

[sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-01 Thread João Alberto Ferreira
Thank you!

I've done: 

[defrancaferr_joa@javel ~]$ sudo yum install centos-release-scl
[defrancaferr_joa@javel ~]$ sudo yum install devtoolset-3-toolchain
[defrancaferr_joa@javel ~]$ scl enable devtoolset-3 bash
[defrancaferr_joa@javel ~]$ as --version
Assembleur GNU version 2.24
Copyright 2013 Free Software Foundation, Inc.
Ce logiciel est libre; vous pouvez le redistribuer selon les termes de la
version 3 de la licence GNU General Public License ou suivante.
Ce programme n'est couvert par AUCUNE garantie.
Cet assembleur a été configuré pour la cible « x86_64-redhat-linux ».

Let's see if it will work.



On Wednesday, February 1, 2017 at 5:27:36 PM UTC+1, Dima Pasechnik wrote:
>
>
>
> On Wednesday, February 1, 2017 at 3:52:05 PM UTC, João Alberto Ferreira 
> wrote:
>>
>> Hi!
>>
>> Here it is the command output.
>>
>> [defrancaferr_joa@javel ~]$ as --version
>> GNU assembler version 2.20.51.0.2-5.44.el6 20100205
>> Copyright 2009 Free Software Foundation, Inc.
>>
>
> Thanks, this explains your problem. Your assembler is 7 years old, and 
> your CPU
> is only 4 years old, if not newer. You are building with (sage-supplied)
> gcc 4.9, which issues correct assembler commands for your CPU.
> But your assembler does not understand some of them, as it is too old.
>
> Why Centos is so lame in this respect, we've seen many reports like this...
> You should upgrade your toolchain so that your assembler fully supports 
> you CPU.
>
> HTH,
> Dima
>  
>  
>
>> This program is free software; you may redistribute it under the terms of
>> the GNU General Public License version 3 or later.
>> This program has absolutely no warranty.
>> This assembler was configured for a target of `x86_64-redhat-linux'.
>>
>> On Wednesday, February 1, 2017 at 12:05:22 PM UTC+1, Dima Pasechnik wrote:
>>>
>>> please post the output of 
>>>
>>> as --version
>>>
>>> on the system. I guess it is too old to understand the whole range of 
>>> assembler commands for your CPU.
>>>
>>>
>>> On Wednesday, February 1, 2017 at 10:09:27 AM UTC, João Alberto Ferreira 
>>> wrote:
>>>>
>>>> Hi!
>>>>
>>>> I have tried to compile sagemath under a CentOS 6.8 machine, as the 
>>>> binaries for Fedora do not work. The installation halted with an error 
>>>> while building OpenBlas. Made the error is due to the machine CPU, as 
>>>> discussed in https://github.com/JuliaLang/julia/issues/7653, but I 
>>>> have little experience in this. Part of the installation log is attached. 
>>>> I 
>>>> updated the operating system and want to try build Sage again. Does anyone 
>>>> have any sugestion?
>>>>
>>>> It seems that all developing tools are installed, as can be seen below
>>>>
>>>> [defrancaferr_joa@javel ~]$ rpm -q perl-ExtUtils-MakeMaker
>>>> perl-ExtUtils-MakeMaker-6.55-141.el6_7.1.x86_64
>>>> [defrancaferr_joa@javel ~]$ which perl
>>>> /usr/bin/perl
>>>> [defrancaferr_joa@javel ~]$ rpm -q binutils
>>>> binutils-2.20.51.0.2-5.44.el6.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q gcc
>>>> gcc-4.4.7-17.el6.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q make
>>>> make-3.81-23.el6.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q m4
>>>> m4-1.4.13-5.el6.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q perl
>>>> perl-5.10.1-141.el6_7.1.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q tar
>>>> tar-1.23-15.el6_8.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q git
>>>> git-1.7.1-4.el6_7.1.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q gcc-c++
>>>> gcc-c++-4.4.7-17.el6.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q gcc-gfortran
>>>> gcc-gfortran-4.4.7-17.el6.x86_64
>>>> [defrancaferr_joa@javel ~]$ rpm -q python
>>>> python-2.6.6-66.el6_8.x86_64
>>>> [defrancaferr_joa@javel ~]$ lscpu
>>>> Architecture:  x86_64
>>>> CPU op-mode(s):32-bit, 64-bit
>>>> Byte Order:Little Endian
>>>> CPU(s):32
>>>> On-line CPU(s) list:   0-31
>>>> Thread(s) par coeur :  2
>>>> Coeur(s) par support CPU :8
>>>> Socket(s): 2
>>>> Noeud(s) NUMA :2
>>>> ID du vendeur :GenuineIntel
>>>> Famille CPU :  6
>>>> Modèle :  79
>>>> Model name:Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
>>>> Version :  1
>>>> CPU MHz :  1200.000
>>>> BogoMIPS:  4190.00
>>>> Virtualisation :   VT-x
>>>> L1d cache :32K
>>>> L1i cache :32K
>>>> L2 cache : 256K
>>>> L3 cache : 20480K
>>>> NUMA node0 CPU(s): 0-7,16-23
>>>> NUMA node1 CPU(s): 8-15,24-31
>>>>
>>>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-01 Thread João Alberto Ferreira
Hi!

Here it is the command output.

[defrancaferr_joa@javel ~]$ as --version
GNU assembler version 2.20.51.0.2-5.44.el6 20100205
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-redhat-linux'.

On Wednesday, February 1, 2017 at 12:05:22 PM UTC+1, Dima Pasechnik wrote:
>
> please post the output of 
>
> as --version
>
> on the system. I guess it is too old to understand the whole range of 
> assembler commands for your CPU.
>
>
> On Wednesday, February 1, 2017 at 10:09:27 AM UTC, João Alberto Ferreira 
> wrote:
>>
>> Hi!
>>
>> I have tried to compile sagemath under a CentOS 6.8 machine, as the 
>> binaries for Fedora do not work. The installation halted with an error 
>> while building OpenBlas. Made the error is due to the machine CPU, as 
>> discussed in https://github.com/JuliaLang/julia/issues/7653, but I have 
>> little experience in this. Part of the installation log is attached. I 
>> updated the operating system and want to try build Sage again. Does anyone 
>> have any sugestion?
>>
>> It seems that all developing tools are installed, as can be seen below
>>
>> [defrancaferr_joa@javel ~]$ rpm -q perl-ExtUtils-MakeMaker
>> perl-ExtUtils-MakeMaker-6.55-141.el6_7.1.x86_64
>> [defrancaferr_joa@javel ~]$ which perl
>> /usr/bin/perl
>> [defrancaferr_joa@javel ~]$ rpm -q binutils
>> binutils-2.20.51.0.2-5.44.el6.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q gcc
>> gcc-4.4.7-17.el6.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q make
>> make-3.81-23.el6.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q m4
>> m4-1.4.13-5.el6.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q perl
>> perl-5.10.1-141.el6_7.1.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q tar
>> tar-1.23-15.el6_8.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q git
>> git-1.7.1-4.el6_7.1.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q gcc-c++
>> gcc-c++-4.4.7-17.el6.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q gcc-gfortran
>> gcc-gfortran-4.4.7-17.el6.x86_64
>> [defrancaferr_joa@javel ~]$ rpm -q python
>> python-2.6.6-66.el6_8.x86_64
>> [defrancaferr_joa@javel ~]$ lscpu
>> Architecture:  x86_64
>> CPU op-mode(s):32-bit, 64-bit
>> Byte Order:Little Endian
>> CPU(s):32
>> On-line CPU(s) list:   0-31
>> Thread(s) par coeur :  2
>> Coeur(s) par support CPU :8
>> Socket(s): 2
>> Noeud(s) NUMA :2
>> ID du vendeur :GenuineIntel
>> Famille CPU :  6
>> Modèle :  79
>> Model name:Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
>> Version :  1
>> CPU MHz :  1200.000
>> BogoMIPS:  4190.00
>> Virtualisation :   VT-x
>> L1d cache :32K
>> L1i cache :32K
>> L2 cache : 256K
>> L3 cache : 20480K
>> NUMA node0 CPU(s): 0-7,16-23
>> NUMA node1 CPU(s): 8-15,24-31
>>
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] [symbolic] return the argument of a sinusoidal function

2017-01-25 Thread João Alberto Ferreira
Hi!

Does any one knows a function or a way to return the argument of a 
sinusoidal function? I have the following code and wanted to operate on the 
argument of the cosinus function.

# upchirp carrier
var('t, phi_0, omega_0, omega_1, T')
k = (omega_1 - omega_0)/T; k
# linear chirp signal (waveform)
s1 = cos(phi_0 + k*t^2/2 + omega_0*t); s1
arg(s1)
omega = derivative(arg(s1), t); omega

Sagemath returns:

(t, phi_0, omega_0, omega_1, T)-(omega_0 - omega_1)/Tcos(omega_0*t - 
1/2*(omega_0 - omega_1)*t^2/T + phi_0)
arg(cos(omega_0*t - 1/2*(omega_0 - omega_1)*t^2/T + phi_0))
-(omega_0 - (omega_0 - omega_1)*t/T)*sin(omega_0*t - 1/2*(omega_0 - 
omega_1)*t^2/T + phi_0)*D[0](arg)(cos(omega_0*t - 1/2*(omega_0 - omega_1)*t^2/T 
+ phi_0))

Cordially,

Joao


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Sagetex plots

2016-04-18 Thread João Alberto Ferreira
I am trying sagetex in cloud.sagemath.com. Sagetex manual says at the top 
of page 7, that if nothing is specified for the , 
"width=.75\textwidth" will be used. It's a good thing, so the plots do not 
extrapolate page margins. However, it's not working, and we should pass 
explicit the above command. Can anyone update the manual or correct the 
sagetex package?

Thank you!

João.

An example from the internet follows below.

\documentclass{article}
% -The preamble 
-
\usepackage{xcolor}
\usepackage{sagetex}  % use Sage for it's math ability
\usepackage{graphicx} % for including pictures
\pagestyle{empty}% remove the page numbers
% --End of preamble 
-
\begin{document}
\begin{sagesilent}
var('x')
f = x*sin(x)
pltf = plot(f,(x,-10,10))
\end{sagesilent}
\begin{center}
\sageplot{pltf} % plot extrapolate margins. To keep plot within margins 
\sageplot[width=.75\textwidth]{pltf} should be used
\end{center}
\end{document}

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Piecewise function

2016-02-12 Thread João Alberto Ferreira


On Thursday, February 11, 2016 at 9:04:16 PM UTC-2, Nils Bruin wrote:
>
> On Thursday, February 11, 2016 at 11:32:45 AM UTC-8, João Alberto Ferreira 
> wrote:
>>
>> 1) Isn't there a way to pass to the Piecewise function if the intervals 
>> are open or closed at its borders, so as, in the example above, g(x) could 
>> be evaluated to 25 instead of 35/2?
>>
>
> It doesn't seem to be possible at the moment. The averaging behaviour is 
> hard-coded.
>  
>
It's a pity.
 

> 2) Cant't I plot a Piecewise function with intervals extending to 
>> infinity, as the example above, by just indicating (maybe in the plot 
>> method) the definite interval that I wish to be used to evaluate and plot 
>> the function? For the graph of a Piecewise function, I would expect 
>> something like the examples in 
>> http://www.sagemath.org/calctut/continuity.html, with the hollow and 
>> filled circles indicating if the intervals are open or closed at its 
>> borders.
>>
>
> You can use
> plot(lambda x: g(x), 0, 10)
> or
> plot(g.__call__, 0, 10)
>
> Thank you for the sugestions but, unfortunatelly, the options above plot 
the function as it was a continuous function. The only way I could find to 
plot the function correctly is as in 
http://www.sagemath.org/calctut/continuity.html. But it ignores the created 
piecewise function.

g1(x) = x**2
g2(x) = 2*x
g = Piecewise([[(-Infinity,5),g2],[(5,Infinity),g1]])
P1 = plot(g2, 0, 5)
pt1 = point((5, g2(5)), rgbcolor='white', faceted=True, pointsize=30)
pt2 = point((5, g1(5)), rgbcolor='black', pointsize=30)
P2 = plot(g1, 5, 10)
P1 + pt1 + pt2 + P2 

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Piecewise function

2016-02-11 Thread João Alberto Ferreira
I have a function g(x) equal to x^2 if x >= 5, and equal to 2*x if x < 5. I 
constructed the piecewise function as follows:

g1(x) = x**2
g2(x) = 2*x
g = Piecewise([[(-Infinity,5),g2],[(5,Infinity),g1]])

When I evaluate f(5), it returns 35/2 because it evaluates g1(5), g2(5) and 
returns the average of the two values, as I'm not indicating that at x=5, 
g1(x) should be used to evaluate the piecewise function.

Questions:
1) Isn't there a way to pass to the Piecewise function if the intervals are 
open or closed at its borders, so as, in the example above, g(x) could be 
evaluated to 25 instead of 35/2?
2) Cant't I plot a Piecewise function with intervals extending to infinity, 
as the example above, by just indicating (maybe in the plot method) the 
definite interval that I wish to be used to evaluate and plot the function? 
For the graph of a Piecewise function, I would expect something like the 
examples in http://www.sagemath.org/calctut/continuity.html, with the 
hollow and filled circles indicating if the intervals are open or closed at 
its borders.

I hope I was clear enough. But, as english is not my mother tongue and 
neither I am a mathematician, maybe something is confusing. So, fell free 
to ask for clarifications.

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] sage 6.2 to 6.4 upgrade

2014-11-25 Thread João Alberto Ferreira
After upgrading Sage on an old laptop, the upgrade process ended with the 
following error message. What am I supposed to do? I execute make doc-clean 
and then what?

Apparently, Sage is working normally.

Thanks!

João.


...
[graphs   ] reading sources... [ 91%] sage/graphs/schnyder
[graphs   ] reading sources... [ 93%] sage/graphs/spanning_tree
[graphs   ] reading sources... [ 95%] sage/graphs/trees
[graphs   ] reading sources... [ 97%] sage/graphs/tutte_polynomial
[graphs   ] reading sources... [100%] sage/graphs/weakly_chordal
[graphs   ] 
/home/sergio/sage-6.2-i686-Linux/src/doc/en/reference/graphs/sage/graphs/hypergraph.rst:11:
 
WARNING: autodoc can't import/find module 'sage.graphs.hypergraph', it 
reported error: No module named hypergraph, please check your spelling 
and sys.path
[graphs   ] 
/home/sergio/sage-6.2-i686-Linux/src/doc/en/reference/graphs/sage/graphs/hypergraph.rst::
 
WARNING: document isn't included in any toctree
Error building the documentation.

Note: incremental documentation builds sometimes cause spurious
error messages. To be certain that these are real errors, run
make doc-clean first and try again.
Traceback (most recent call last):
  File /home/sergio/sage-6.2-i686-Linux/src/doc/common/builder.py, line 
1618, in module
getattr(get_builder(name), type)()
  File /home/sergio/sage-6.2-i686-Linux/src/doc/common/builder.py, line 
292, in _wrapper
getattr(get_builder(document), 'inventory')(*args, **kwds)
  File /home/sergio/sage-6.2-i686-Linux/src/doc/common/builder.py, line 
503, in _wrapper
x.get(9)
  File 
/home/sergio/sage-6.2-i686-Linux/local/lib/python/multiprocessing/pool.py, 
line 558, in get
raise self._value
OSError: [graphs   ] 
/home/sergio/sage-6.2-i686-Linux/src/doc/en/reference/graphs/sage/graphs/hypergraph.rst:11:
 
WARNING: autodoc can't import/find module 'sage.graphs.hypergraph', it 
reported error: No module named hypergraph, please check your spelling 
and sys.path

make: ** [doc-html] Erro 1

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] sage 6.2 to 6.4 upgrade

2014-11-25 Thread João Alberto Ferreira
Ok, thank you!

On Tuesday, November 25, 2014 8:23:20 PM UTC-2, Vincent Knight wrote:

 This sometimes happens and it's an error in the building of the docs.

 If you want to build the documentation you can run:

 $ make doc-clean

 and run 

 $ sage --docbuild reference html

 for the html version (more info here: 
 http://www.sagemath.org/doc/developer/sage_manuals.html).

 If you don't care about the documentation you can just leave it as it is.

 Vince

 On Tue Nov 25 2014 at 10:19:00 PM João Alberto Ferreira joa...@gmail.com 
 javascript: wrote:

 After upgrading Sage on an old laptop, the upgrade process ended with the 
 following error message. What am I supposed to do? I execute make doc-clean 
 and then what?

 Apparently, Sage is working normally.

 Thanks!

 João.


 ...
 [graphs   ] reading sources... [ 91%] sage/graphs/schnyder
 [graphs   ] reading sources... [ 93%] sage/graphs/spanning_tree
 [graphs   ] reading sources... [ 95%] sage/graphs/trees
 [graphs   ] reading sources... [ 97%] sage/graphs/tutte_polynomial
 [graphs   ] reading sources... [100%] sage/graphs/weakly_chordal
 [graphs   ] 
 /home/sergio/sage-6.2-i686-Linux/src/doc/en/reference/graphs/sage/graphs/hypergraph.rst:11:
  
 WARNING: autodoc can't import/find module 'sage.graphs.hypergraph', it 
 reported error: No module named hypergraph, please check your spelling 
 and sys.path
 [graphs   ] 
 /home/sergio/sage-6.2-i686-Linux/src/doc/en/reference/graphs/sage/graphs/hypergraph.rst::
  
 WARNING: document isn't included in any toctree
 Error building the documentation.

 Note: incremental documentation builds sometimes cause spurious
 error messages. To be certain that these are real errors, run
 make doc-clean first and try again.
 Traceback (most recent call last):
   File /home/sergio/sage-6.2-i686-Linux/src/doc/common/builder.py, line 
 1618, in module
 getattr(get_builder(name), type)()
   File /home/sergio/sage-6.2-i686-Linux/src/doc/common/builder.py, line 
 292, in _wrapper
 getattr(get_builder(document), 'inventory')(*args, **kwds)
   File /home/sergio/sage-6.2-i686-Linux/src/doc/common/builder.py, line 
 503, in _wrapper
 x.get(9)
   File 
 /home/sergio/sage-6.2-i686-Linux/local/lib/python/multiprocessing/pool.py, 
 line 558, in get
 raise self._value
 OSError: [graphs   ] 
 /home/sergio/sage-6.2-i686-Linux/src/doc/en/reference/graphs/sage/graphs/hypergraph.rst:11:
  
 WARNING: autodoc can't import/find module 'sage.graphs.hypergraph', it 
 reported error: No module named hypergraph, please check your spelling 
 and sys.path

 make: ** [doc-html] Erro 1

  -- 
 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...@googlegroups.com javascript:.
 To post to this group, send email to sage-s...@googlegroups.com 
 javascript:.
 Visit this group at http://groups.google.com/group/sage-support.
 For more options, visit https://groups.google.com/d/optout.



-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to install wxPython in Sage?

2014-10-31 Thread João Alberto Ferreira
Hi, Nils! thank you for the suggestion!

I tried to install the experimental package: (sage-sh) joao@Hades:~$ sage 
-i wxPython

but it stopped at:
...
checking for GTK+ - version = 2.0.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for 
the
*** exact error that occured. This usually means GTK+ is incorrectly 
installed.
configure: error:
The development files for GTK+ were not found. For GTK+ 2, please
ensure that pkg-config is in the path and that gtk+-2.0.pc is
installed. For GTK+ 1.2 please check that gtk-config is in the path,
and that the version is 1.2.3 or above. Also check that the
libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
--libs' are in the LD_LIBRARY_PATH or equivalent.

Error configure wx widgets.

real0m17.868s
user0m5.780s
sys0m2.412s

Error installing package wxPython-2.8.7.1

Please email sage-devel (http://groups.google.com/group/sage-devel)
explaining the problem and including the relevant part of the log file
  /opt/sage-6.3-i686-Linux/logs/pkgs/wxPython-2.8.7.1.log
Describe your computer, operating system, etc.
If you want to try to fix the problem yourself, *don't* just cd to
/opt/sage-6.3-i686-Linux/local/var/tmp/sage/build/wxPython-2.8.7.1 and type 
'make' or whatever is appropriate.
Instead, the following commands setup all environment variables
correctly and load a subshell for you to debug the error:
  (cd '/opt/sage-6.3-i686-Linux/local/var/tmp/sage/build/wxPython-2.8.7.1' 
 '/opt/sage-6.3-i686-Linux/sage' --sh)
When you are done debugging, you can type exit to leave the subshell.


I also tried to install from source: (sage-sh) joao@Hades:wxPython$ sage 
--python build-wxpython.py --install --build_dir=../bld

but it stopped at the same point:
...
checking for GTK+ - version = 2.6.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for 
the
*** exact error that occurred. This usually means GTK+ is incorrectly 
installed.
checking for pkg-config... (cached) 
/opt/sage-6.3-i686-Linux/local/bin/pkg-config
checking for GTK+ - version = 3.0.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for 
the
*** exact error that occured. This usually means GTK+ is incorrectly 
installed.
checking for gtk-config... no
checking for GTK - version = 1.2.7... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
checking for gtk-config... (cached) no
checking for GTK - version = 1.2.3... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
configure: error: 
The development files for GTK+ were not found. For GTK+ 2, please
ensure that pkg-config is in the path and that gtk+-2.0.pc is
installed. For GTK+ 1.2 please check that gtk-config is in the path,
and that the version is 1.2.3 or above. Also check that the
libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
--libs' are in the LD_LIBRARY_PATH or equivalent.

Error running configure
ERROR: failed building wxWidgets
Traceback (most recent call last):
  File build-wxpython.py, line 378, in module
wxbuild.main(wxscript, build_options)
  File 
/home/joao/Downloads/wxPython-src-3.0.1.1/build/tools/build-wxwidgets.py, 
line 364, in main
Error running configure)
  File 
/home/joao/Downloads/wxPython-src-3.0.1.1/build/tools/build-wxwidgets.py, 
line 80, in exitIfError
raise builder.BuildError(msg)
BuildError

I also tried without the sage -sh (outside subshell), but I obtained the 
same results. It seems that something is missing and needs to be installed, 
although I've already installed a lot of packages (in Ubuntu 14.04), like 
libgtk2.0-0, libgtk2.0-dev, libgtk-3-0, libgtk-3-dev. I will try to ask the 
wxPython people.

Thanks for the help!

On Thursday, October 30, 2014 12:05:21 AM UTC-2, Nils Bruin wrote:

 On Wednesday, October 29, 2014 5:09:55 PM UTC-7, João Alberto Ferreira 
 wrote:

 How can I install wxPython (wx module) in Sage?

 Have you tried executing sage -sh and then following the build 
 instructions at  http://wxpython.org/builddoc.php ? The fact that 
 wxPython posts such build instructions suggests to me that easyinstall from 
 source is not supported for this package. wxPython has many system 
 dependencies, but hopefully you

[sage-support] re (regular expressions) Python module

2014-10-31 Thread João Alberto
I was trying to use Python's re (regular expressions) module to parse
a log file, but when I ran the following example from the Python
documentation, I realized he was not working as expected. Is there
something here that I do not know?

joao@Hades:~$ sage --python
Python 2.7.8 (default, Aug 10 2014, 17:23:10)
[GCC 4.8.1] on linux2
Type help, copyright, credits or license for more information.
 import re
 m = re.match(r(\w+) (\w+), Isaac Newton, physicist)
 m.group(0)
'Isaac Newton'

joao@Hades:~$ sage
┌┐
│ Sage Version 6.3, Release Date: 2014-08-10 │
│ Type notebook() for the browser-based notebook interface.│
│ Type help() for help.│
└┘
sage: import re
sage: m = re.match(r(\w+) (\w+), Isaac Newton, physicist)
sage: m.group(0)
---
IndexErrorTraceback (most recent call last)
ipython-input-3-5e8fcb82d2b1 in module()
 1 m.group(Integer(0))

IndexError: no such group

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: re (regular expressions) Python module

2014-10-31 Thread João Alberto Ferreira
Ok, thank you!

On Saturday, November 1, 2014 12:03:33 AM UTC-2, Nils Bruin wrote:

 On Friday, October 31, 2014 6:17:44 PM UTC-7, João Alberto Ferreira wrote:

 joao@Hades:~$ sage 
 ┌┐ 
 │ Sage Version 6.3, Release Date: 2014-08-10 │ 
 │ Type notebook() for the browser-based notebook interface.│ 
 │ Type help() for help.│ 
 └┘ 
 sage: import re 
 sage: m = re.match(r(\w+) (\w+), Isaac Newton, physicist) 
 sage: m.group(0) 
 IndexError: no such group 


 That's a case of the preparser getting in the way.

 sage: m.group(int(0))

 does work.

 the problem on the side of group is that its input signature is 
 overloaded: it can also accept group names. So it doesn't try very hard to 
 make an integer out of input that isn't.


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] How to install wxPython in Sage?

2014-10-29 Thread João Alberto Ferreira
How can I install wxPython (wx module) in Sage?
I tried:
joao@Hades:~$ sage --python -m easy_install wxPython
Searching for wxPython
Reading https://pypi.python.org/simple/wxPython/
Reading http://wxPython.org/
Reading http://wxPython.org/download.php
Best match: wxPython src-3.0.1.1
Downloading 
http://downloads.sourceforge.net/wxpython/wxPython-src-3.0.1.1.tar.bz2
Processing wxPython-src-3.0.1.1.tar.bz2
error: Couldn't find a setup script in 
/tmp/easy_install-fatFNS/wxPython-src-3.0.1.1.tar.bz2

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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Strange error

2014-10-24 Thread João Alberto Ferreira
Understood. Thank you!

On Friday, October 24, 2014 2:45:46 PM UTC-2, Nils Bruin wrote:

 On Thursday, October 23, 2014 11:46:02 AM UTC-7, João Alberto Ferreira 
 wrote:

 I am running the following Python example from the book Learning 
 Python, from Mark Lutz and David Ascher, but Sage is returning a 
 TypeError after presenting the correct response. Can anyone explain me 
 why? I've found this very strange. 

 sage: class Commuter: 
 : def __init__(self, val): 
 : self.val = val 
 : def __add__(self, other): 
 : print add, self.val, other 
 : def __radd__(self, other): 
 : print radd, self.val, other 
 : 
 sage: x = Commuter(88) 
 sage: y = Commuter(99)  
 sage: x + 1 
 add 88 1 
 sage: 1 + y 
 radd 99 1 


 The problem is caused by the fact that your __radd__ implementation 
 returns None. If you insert a return command for a non-None value, the 
 example works as expected.

 Indeed Sage binary operations internally do not dispatch via __add__ and 
 __radd__, but __radd__ is tried as a fall-back at some point. If you call 
 1+y then you're running Integer(1).__add__(y). This does not figure out a 
 way to do the addition. Apparently, sage chooses to not return 
 NotImplemented (allowing python to call __radd__), but calls __radd__ 
 itself and still raises an error when the return value is None.

 There may be a good reason why Sage chooses to call __radd__ manually 
 rather than let python do the work by returning NotImplemented, but if 
 there's not perhaps it would be better to stay closer to python's standard?


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Strange error

2014-10-23 Thread João Alberto
I am running the following Python example from the book Learning
Python, from Mark Lutz and David Ascher, but Sage is returning a
TypeError after presenting the correct response. Can anyone explain me
why? I've found this very strange.

sage: class Commuter:
: def __init__(self, val):
: self.val = val
: def __add__(self, other):
: print add, self.val, other
: def __radd__(self, other):
: print radd, self.val, other
:
sage: x = Commuter(88)
sage: y = Commuter(99)
sage: x + 1
add 88 1
sage: 1 + y
radd 99 1
---
TypeError Traceback (most recent call last)
ipython-input-76-e047f7a3a32a in module()
 1 Integer(1) + y

/usr/local/Sagemath/sage-6.3/local/lib/python2.7/site-packages/sage/structure/element.so
in sage.structure.element.RingElement.__add__
(build/cythonized/sage/structure/element.c:14696)()

/usr/local/Sagemath/sage-6.3/local/lib/python2.7/site-packages/sage/structure/coerce.so
in sage.structure.coerce.CoercionModel_cache_maps.bin_op
(build/cythonized/sage/structure/coerce.c:8323)()

TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and
'type 'instance''

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Strange error

2014-10-23 Thread João Alberto Ferreira
Ok, thank you all!

I was curious just because, due to the error, I did not expect a result.

On Thursday, October 23, 2014 5:28:46 PM UTC-2, kcrisman wrote:

 Or, in the notebook/cell server/cloud, choose python from the drop-down 
 menu for system and just do this example in Python!  Lots of options.
  

 Or type 

 Integer = int 

 to make Sage integers the usual Python integers in that session. 

 On Thu, Oct 23, 2014 at 11:54 AM, Volker Braun vbrau...@gmail.com 
 javascript: wrote: 
  The short answer is that mathematical objects in Sage don't define 
 addition 
  by implementing __add__ and __radd__ by hand. If you want to learn 
 about 
  them make sure to not add Sage objects (like Sage integers). E.g. 
 int(1) + y 
  would work. 
  
  
  
  On Thursday, October 23, 2014 7:46:02 PM UTC+1, João Alberto Ferreira 
 wrote: 
  
  I am running the following Python example from the book Learning 
  Python, from Mark Lutz and David Ascher, but Sage is returning a 
  TypeError after presenting the correct response. Can anyone explain me 
  why? I've found this very strange. 
  
  sage: class Commuter: 
  : def __init__(self, val): 
  : self.val = val 
  : def __add__(self, other): 
  : print add, self.val, other 
  : def __radd__(self, other): 
  : print radd, self.val, other 
  : 
  sage: x = Commuter(88) 
  sage: y = Commuter(99) 
  sage: x + 1 
  add 88 1 
  sage: 1 + y 
  radd 99 1 
  
  
 --- 
  TypeError Traceback (most recent call 
  last) 
  ipython-input-76-e047f7a3a32a in module() 
   1 Integer(1) + y 
  
  
  
 /usr/local/Sagemath/sage-6.3/local/lib/python2.7/site-packages/sage/structure/element.so
  

  in sage.structure.element.RingElement.__add__ 
  (build/cythonized/sage/structure/element.c:14696)() 
  
  
  
 /usr/local/Sagemath/sage-6.3/local/lib/python2.7/site-packages/sage/structure/coerce.so
  

  in sage.structure.coerce.CoercionModel_cache_maps.bin_op 
  (build/cythonized/sage/structure/coerce.c:8323)() 
  
  TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and 
  'type 'instance'' 
  
  -- 
  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...@googlegroups.com javascript:. 
  To post to this group, send email to sage-s...@googlegroups.com 
 javascript:. 
  Visit this group at http://groups.google.com/group/sage-support. 
  For more options, visit https://groups.google.com/d/optout. 



 -- 
 William Stein 
 Professor of Mathematics 
 University of Washington 
 http://wstein.org 



-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Inconsistency between Sage and Python

2014-10-06 Thread João Alberto
I am plotting some graphs, but the plot becomes cluttered because of
the long labels. The labels are result of a conversion from a Real
number to a string. The problem here is that Sage is not consistent
with Python, as shown in the example below.

Python:
 multiplier = [1.0e0, 1.0e1, 1.0e2]
 multiplier
[1.0, 10.0, 100.0]
 str(multiplier[-1])
'100.0'


Sage:
sage: multiplier = [1.0e0, 1.0e1, 1.0e2]
sage: multiplier
[1.00, 10.0, 100.]
sage: str(multiplier[-1])
'100.'

Is this a correct behavior of Sage? at least for me, the excess of
trailing zeros is causing some trouble.

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Inconsistency between Sage and Python

2014-10-06 Thread João Alberto Ferreira
Thank you, Samuel. The conversion to RDF worked because it coerces the 
other types to RDF (I think). If I convert the multiplier values to RR, RLF 
or float, the conversion does not help anymore.

On Monday, October 6, 2014 1:30:03 PM UTC-3, slelievre wrote:


 João Alberto Ferreira wrote:

 I am plotting some graphs, but the plot becomes cluttered because of 
 the long labels. The labels are result of a conversion from a Real 
 number to a string. The problem here is that Sage is not consistent 
 with Python, as shown in the example below. 

 Python: 
  multiplier = [1.0e0, 1.0e1, 1.0e2] 
  multiplier 
 [1.0, 10.0, 100.0] 
  str(multiplier[-1]) 
 '100.0' 


 Sage: 
 sage: multiplier = [1.0e0, 1.0e1, 1.0e2] 
 sage: multiplier 
 [1.00, 10.0, 100.] 
 sage: str(multiplier[-1]) 
 '100.' 

 Is this a correct behavior of Sage? at least for me, the excess of 
 trailing zeros is causing some trouble. 


 One option is to work with RDF:

 sage: multiplier = [1.0e0, 1.0e1, 1.0e2]
 sage: multiplier = [RDF(x) for x in multiplier]
 sage: multiplier
 [1.0, 10.0, 100.0]
 sage: str(multiplier[-1])
 '100.0'
  


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Inconsistency between Sage and Python

2014-10-06 Thread João Alberto Ferreira
Yes, I know Vincent, thank you, but this would complicate my code 
unnecessarily.

I used Samuel idea. But I still think that the extra trailing zeros have no 
reason to exist.

On Monday, October 6, 2014 1:08:23 PM UTC-3, vdelecroix wrote:

 Hi João, 

 If you want precise control on the output, you might use the python 
 formatting (see 
 https://docs.python.org/2/library/string.html#formatstrings) 

 sage: x = RR(pi) 
 sage: print x 
 3.14159265358979 
 sage: print {:.3}.format(x) 
 3.1 
 sage: print {:.5}.format(x) 
 3.141 

 But perhaps it is not an answer to your question, is it? 

 Vincent 

 2014-10-06 18:03 UTC+02:00, João Alberto joa...@gmail.com javascript:: 

  I am plotting some graphs, but the plot becomes cluttered because of 
  the long labels. The labels are result of a conversion from a Real 
  number to a string. The problem here is that Sage is not consistent 
  with Python, as shown in the example below. 
  
  Python: 
  multiplier = [1.0e0, 1.0e1, 1.0e2] 
  multiplier 
  [1.0, 10.0, 100.0] 
  str(multiplier[-1]) 
  '100.0' 
  
  
  Sage: 
  sage: multiplier = [1.0e0, 1.0e1, 1.0e2] 
  sage: multiplier 
  [1.00, 10.0, 100.] 
  sage: str(multiplier[-1]) 
  '100.' 
  
  Is this a correct behavior of Sage? at least for me, the excess of 
  trailing zeros is causing some trouble. 
  
  -- 
  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...@googlegroups.com javascript:. 
  To post to this group, send email to sage-s...@googlegroups.com 
 javascript:. 
  Visit this group at http://groups.google.com/group/sage-support. 
  For more options, visit https://groups.google.com/d/optout. 
  


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Inconsistency between Sage and Python

2014-10-06 Thread João Alberto Ferreira
Ok, I had to make a huge effort to accept this, but it's more clear now.

One last question: Why RDF does not incorporate this feature? because it 
comes from the GSL library, that is an independent project? or because its 
precision is known a priori, like the float type in Python?


On Monday, October 6, 2014 3:39:32 PM UTC-3, Jeroen Demeyer wrote:

 On 2014-10-06 18:03, João Alberto wrote: 
  Is this a correct behavior of Sage? 
 It's a feature, not a bug. The reason is that the number of digits gives 
 an idea about the precision of the number. Compare 

 sage: RealField(20)(1) 
 1. 
 sage: RealField(100)(1) 
 1. 

 If both these would be printed as 1.0, you would lose this information 
 about the precision. 

 Python has a fixed precision of 53 bits and prints a minimal number of 
 digits. 


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Real floor division

2014-10-04 Thread João Alberto Ferreira
OK! thank you!

On Saturday, October 4, 2014 3:50:07 AM UTC-3, Jeroen Demeyer wrote:

 On 2014-10-04 00:16, Volker Braun wrote: 
  The operands will coerce to RR 
 No, that's http://trac.sagemath.org/ticket/2034 

  I'd say its an oversight. 
 Yes, but it's fixed in http://trac.sagemath.org/ticket/15260 


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Real floor division

2014-10-03 Thread João Alberto
Hi! I was experimenting with floor division in Sage using the int and float
types of Python and Integeger and RealNumber types of Sage to understand
the differences. I've found that the floor division operator (//) in Sage
does not support real numbers. Is there a reason for this? (I ask just for
curiosity)


int(5)//float(2.0), int(5)//float(-2.0)

(2.0, -3.0)


ZZ(5)//RR(2.0), ZZ(5)//RR(-2.0)

Error in lines 1-1
Traceback (most recent call last):
  File 
/projects/cb65bb5e-3452-4325-988a-501d0b395e0b/.sagemathcloud/sage_server.py,
line 828, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
  File , line 1, in module
  File integer.pyx, line 1868, in
sage.rings.integer.Integer.__floordiv__
(build/cythonized/sage/rings/integer.c:14174)
  File element.pyx, line 3013, in sage.structure.element.bin_op
(build/cythonized/sage/structure/element.c:23330)
  File element.pyx, line 3015, in sage.structure.element.bin_op
(build/cythonized/sage/structure/element.c:23225)
  File coerce.pyx, line 799, in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(build/cythonized/sage/structure/coerce.c:7575)
  File coerce.pyx, line 795, in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(build/cythonized/sage/structure/coerce.c:7520)
TypeError: unsupported operand type(s) for //:
'sage.rings.real_mpfr.RealNumber' and
'sage.rings.real_mpfr.RealLiteral'

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] sage ppa

2014-04-29 Thread João Alberto
I have tried to install Sage in an old laptop with Lubuntu with the
following three commands:

--
$ sudo -E apt-add-repository -y ppa:aims/sagemath
$ sudo -E apt-get update
$ sudo -E apt-get install sagemath-upstream-binary
--

but the last command returned

--
Package sagemath-upstream-binary is not available, but is referred to by
another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'sagemath-upstream-binary' has no installation candidate
--

the first two commands ran without problems, so that the ppa repository was
hit by the apt-get update command.

--
...
Ign http://ppa.launchpad.net saucy InRelease
Hit http://ppa.launchpad.net saucy Release.gpg
Hit http://ppa.launchpad.net saucy Release
Hit http://ppa.launchpad.net saucy/main i386 Packages
...
--

The problem is the same as the one described here:
http://askubuntu.com/questions/409372/how-one-can-install-sagemath-on-ubuntu

After downloading Sage and decompressing it, I was able to run it but, I
searched a lot and, until now, could not figure out what is wrong. How can
I fix this? any suggestions?

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Strange behavior when trying to get help from command line

2013-04-28 Thread João Alberto Ferreira
Complementing, in the notebook interface, help(sqrt) and help(diff) shows 
the help for the functions in a new tab, but help(exp), help(cos) and 
help(sin) opens a new tab, but shows only the name of the function, not the 
help.

On Sunday, April 28, 2013 5:57:54 PM UTC-3, João Alberto Ferreira wrote:

 I perceived a strange behaviour when trying to get help from the command 
 line. When I hit

 sage: exp?

 for example, the help screen is shown as in the Fist_attempt.png appended 
 file. But, when I roll down and up again (using the arrow keys, or the 
 space or b keys), the help screen changes to the shown in the 
 Second_attempt.png appended file. For all commands tested, the first lines 
 of the help screen changed when I rolled down and up again.

 Still, the text of the help is duplicated. Is this correct? Some functions 
 do not show this duplicated text, like sqrt, diff, but others do, like 
 cos, sin.

 Cordially,
  
 João Alberto Ferreira.
  
 -
 ~$ uname -a
 Linux Hades 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:26 UTC 2013 
 i686 athlon i386 GNU/Linux
  
 sage: version()
 'Sage Version 5.8, Release Date: 2013-03-15'


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Re: who command - Sage Beginner's Guide example

2013-04-25 Thread João Alberto Ferreira
Thank you for the reply! I took note and I will use the show_identifiers() 
function whenever necessary, as the it seems more useful than the who 
command.

João Alberto Ferreira.

On Wednesday, April 24, 2013 10:36:45 PM UTC-3, William wrote:

 Hi,

 I've never heard of this who function, but evidently it is in Ipython so 
 the sage command line automatically has it.  Having never heard of who, I 
 had implemented something similar for Sage back in 2004 (!) called 
 show_identifiers(), which is like the same function in Magma (which is 
 called ShowIdentifiers() there).  It is evidently different than who in 
 Ipython, since:

 sage: 
 show_identifiers()
 

 ['Out', 'get_ipython', 'sage_prompt', 'In', 'exit', 'quit']   
   
 sage: 
 R = 250e3 
 
 sage: 
 show_identifiers()
 
 ['Out', 'get_ipython', 'sage_prompt', 'In', 'exit', 'R', 'quit'] 

   

 With show_identifiers I made it record the actual objects at startup, and 
 check to see if they change. 

 The code is here if you want to look at it:

   https://github.com/sagemath/sage/blob/master/src/sage/misc/session.pyx

 As show_identifiers() is a normal function call it should also work in the 
 notebook, scripts etc., rather than only on the interactive command line.
  
 William


 On Wed, Apr 24, 2013 at 2:27 PM, João Alberto Ferreira 
 joa...@gmail.comjavascript:
  wrote:

 Ok! thank you!


 On Wednesday, April 24, 2013 6:15:06 AM UTC-3, Volker Braun wrote:

 who prints the newly-defined variables, but R is already defined as 
 the r-system.org interface. You can redefine it as you want, but as far 
 as Python is concerned that just changes a variable but doesn't add a new 
 one.



 On Tuesday, April 23, 2013 10:34:15 PM UTC+1, João Alberto Ferreira 
 wrote:

 Hi! 

 I was executing the examples of the Sage Beginner's Guide book when I 
 found a curious behavior in Sage. 

 Whenever I launch Sage and define the variable 

 sage: R = 250e3 

 and issue the command 

 sage: who 

 the output is 

 Interactive namespace is empty. 

 If I define other variables and issue again the command who, the 
 other variables name are returned, but not the R variable name. 

 Whenever I launch Sage and define a different variable name, like 

 sage: j = 250e3 

 and issue the command who, the output is presented correctly as j. 

 Is this a bug or I missed something? 

 Cordially, 

 João Alberto Ferreira. 

 - 
 ~$ uname -a 
 Linux Hades 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:26 UTC 
 2013 i686 athlon i386 GNU/Linux 

 sage: version() 
 'Sage Version 5.8, Release Date: 2013-03-15'

  -- 
 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...@googlegroups.com javascript:.
 To post to this group, send email to sage-s...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/sage-support?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




 -- 
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org
  

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] who command - Sage Beginner's Guide example

2013-04-24 Thread João Alberto Ferreira
Hi!

I was executing the examples of the Sage Beginner's Guide book when I found a 
curious behavior in Sage.

Whenever I launch Sage and define the variable

sage: R = 250e3

and issue the command

sage: who

the output is

Interactive namespace is empty.

If I define other variables and issue again the command who, the other 
variables name are returned, but not the R variable name.

Whenever I launch Sage and define a different variable name, like

sage: j = 250e3

and issue the command who, the output is presented correctly as j.

Is this a bug or I missed something?

Cordially,

João Alberto Ferreira.

-
~$ uname -a
Linux Hades 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:26 UTC 2013 i686 
athlon i386 GNU/Linux

sage: version()
'Sage Version 5.8, Release Date: 2013-03-15'

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Re: who command - Sage Beginner's Guide example

2013-04-24 Thread João Alberto Ferreira
Ok! thank you!

On Wednesday, April 24, 2013 6:15:06 AM UTC-3, Volker Braun wrote:

 who prints the newly-defined variables, but R is already defined as the 
 r-system.org interface. You can redefine it as you want, but as far as 
 Python is concerned that just changes a variable but doesn't add a new one.



 On Tuesday, April 23, 2013 10:34:15 PM UTC+1, João Alberto Ferreira wrote:

 Hi! 

 I was executing the examples of the Sage Beginner's Guide book when I 
 found a curious behavior in Sage. 

 Whenever I launch Sage and define the variable 

 sage: R = 250e3 

 and issue the command 

 sage: who 

 the output is 

 Interactive namespace is empty. 

 If I define other variables and issue again the command who, the other 
 variables name are returned, but not the R variable name. 

 Whenever I launch Sage and define a different variable name, like 

 sage: j = 250e3 

 and issue the command who, the output is presented correctly as j. 

 Is this a bug or I missed something? 

 Cordially, 

 João Alberto Ferreira. 

 - 
 ~$ uname -a 
 Linux Hades 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:26 UTC 2013 
 i686 athlon i386 GNU/Linux 

 sage: version() 
 'Sage Version 5.8, Release Date: 2013-03-15'



-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.