CoCalc Public Filessupport / 2016-08-16-114135.sagews
Author: William A. Stein
Description: Jupyter notebook support/2015-06-04-141749-bokeh.ipynb
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)

sage_eval??

   File: /projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_salvus.py
Source:
def sage_eval(x, locals=None):
x = str(x).strip()
if x.isspace():
return None
from sage.all import sage_eval
return sage_eval(x, locals=locals)


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

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

Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 947, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 624, in sage_eval return sage_eval(x, locals=locals) File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/sage/misc/sage_eval.py", line 201, in sage_eval return eval(source, sage.all.__dict__, locals) File "<string>", line 1 __tmp__=var("x"); f = symbolic_expression((x**Integer(2)-Integer(1)) / (x-Integer(1))).function(x) ^ SyntaxError: invalid syntax