sage_eval(('f(x) = (x^2-1)/(x-1)','f(1.000000000000001)')) does not work

62 views
Skip to first unread message

jmarcell...@ufpi.edu.br

unread,
Aug 16, 2016, 5:37:55 PM8/16/16
to sage-cloud
Hello everyone.

I want to use the command
:

sage_eval(('f (x) = (x ^ 2-1) / (x-1)', 'f (1.000000000000001)'))

but not
at work sagecloud, only in the local sage.

William Stein

unread,
Aug 16, 2016, 5:45:22 PM8/16/16
to sage-cloud
You will have to wait until we upgrade SageMathCloud to use the newest
version of Sage, or type in a terminal

mkdir -p ~/bin; cd ~/bin; ln -s /usr/local/bin/sage-develop sage

and restart your project to use the latest develop version of Sage,
which has an extended version of sage_eval that works as you expect.

William


>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/f71dbc1f-11f7-4e8b-98a0-d93b47fc85f0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William Stein

CEO, SageMath, Inc.

jmarcell...@ufpi.edu.br

unread,
Aug 16, 2016, 6:52:36 PM8/16/16
to sage-cloud
hello Willian

I
type it in a terminal
mkdir -p ~/bin; cd ~/bin; ln -s /usr/local/bin/sage-develop sage

and restarted
the project but still with the same result.

sage_eval(('f (x) = (x ^ 2-1) / (x-1)', 'f (1.000000000000001)'))

       
('f (x) = (x ^ 2-1) / (x-1)', 'f (1.000000000000001)')

version
()
     
'SageMath version 7.4.beta0, Release Date: 2016-08-10'

William Stein

unread,
Aug 16, 2016, 11:56:23 PM8/16/16
to sage-cloud
On Tue, Aug 16, 2016 at 12:52 PM, <jmarcell...@ufpi.edu.br> wrote:
> hello Willian
>
> I type it in a terminal
> mkdir -p ~/bin; cd ~/bin; ln -s /usr/local/bin/sage-develop sage
>
> and restarted the project but still with the same result.
>
> sage_eval(('f (x) = (x ^ 2-1) / (x-1)', 'f (1.000000000000001)'))
>
> ('f (x) = (x ^ 2-1) / (x-1)', 'f (1.000000000000001)')
>
>
> version()
> 'SageMath version 7.4.beta0, Release Date: 2016-08-10'

You can revert that ~/bin/ change, i.e., remove the link if you want.

Instead, put this in your worksheet and try again:

def sage_eval(x, locals=None):
if isinstance(x, str):
x = str(x).strip()
if x.isspace():
return None
from sage.all import sage_eval
return sage_eval(x, locals=locals)


See
https://github.com/sagemathinc/smc/issues/825
> https://groups.google.com/d/msgid/sage-cloud/47847e34-a241-4db7-9039-1c617d1d8ecb%40googlegroups.com.

João Marcello Pereira

unread,
Aug 19, 2016, 10:27:14 AM8/19/16
to sage-cloud
Hi Willain

It worked! Thank you ;)
Reply all
Reply to author
Forward
0 new messages