Ask Your Question

Problems with Var in Cloud.Sagemath

asked 2014-07-30 18:23:23 +0200

Torero gravatar image

Hi, got a problem defining variables in cloud.sagemath:

I just copied the code from (the very first line) but I also tried it myself with different letters and '`´". None worked.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-07-30 20:15:29 +0200

slelievre gravatar image

Is it possible that you previously evaluated a command defining var as a string? For example,

var = 'x1'

If you did that (and even if you erased that line), then the line

x1 = var('x1'); x1

would produce the exact error that you are seeing.

Try restarting the worksheet (using the orange "Restart" button at the top), this will reset all names, and now the code should execute as expected.

edit flag offensive delete link more


Yup that worked. So I have to be careful not to override given functions?

Torero gravatar imageTorero ( 2014-08-05 11:48:25 +0200 )edit

Exactly. To check if "var" is available, for instance: a cell with


will give the following output:

<built-in function var>

so you know it is not available.

On the other hand, a cell with


will give

NameError: name 'war' is not defined

so you know this variable name is available.

slelievre gravatar imageslelievre ( 2016-12-05 10:25:59 +0200 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2014-07-30 18:23:23 +0200

Seen: 283 times

Last updated: Aug 05 '14