Ask Your Question

sage -c "print diff(x^4,x)"

asked 2012-10-13 03:19:19 -0500

xuwang gravatar image

updated 2013-05-09 08:26:23 -0500

tmonteil gravatar image

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>
  File "<cmdline>", line 1, in <module>
NameError: name 'x' is not defined
edit retag flag offensive close merge delete


You can explicitly declare x as a variable: `sage -c "var('x'); print diff(x^4,x)"`

John Palmieri gravatar imageJohn Palmieri ( 2012-10-13 05:26:14 -0500 )edit

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 gravatar imagekcrisman ( 2012-10-13 11:36:52 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-17 13:42:42 -0500

tmonteil gravatar image

This bug was fixed in Sage 5.4.1. Thanks for reporting it . Now, you will get

$ sage -c "print diff(x^4,x)"


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-10-13 03:19:19 -0500

Seen: 89 times

Last updated: Apr 17 '13