First time here? Check out the FAQ!

Ask Your Question
0

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

asked 12 years ago

xuwang gravatar image

updated 2 years ago

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>
    eval(compile(s,'<cmdline>','exec'))
  File "<cmdline>", line 1, in <module>
NameError: name 'x' is not defined
$
Preview: (hide)

Comments

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

John Palmieri gravatar imageJohn Palmieri ( 12 years ago )

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 ( 12 years ago )
1

1 Answer

Sort by » oldest newest most voted
3

answered 11 years ago

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)"
4*x^3

:)

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 422 times

Last updated: Apr 17 '13