sage -c "print diff(x^4,x)"
I'm using 5.3 on Ubuntu 64 bit.
I would like to have the following print 4x^3 to standard out.
$ ./sage -c "print diff(x^4,x)"
Traceback (most recent call last):
File "/home/xuwang/sage/local/bin/sage-eval", line 15, in <module>
eval(compile(s,'<cmdline>','exec'))
File "<cmdline>", line 1, in <module>
NameError: name 'x' is not defined
$
You can explicitly declare x as a variable: `sage -c "var('x'); print diff(x^4,x)"`
The question remains of why `./sage -c` doesn't behave the same as Sage proper. Sage does have `x` predefined, like it or not.
@kcrisman: see http://trac.sagemath.org/sage_trac/ticket/13598.