Ask Your Question
1

Problems with Var in Cloud.Sagemath

asked 10 years ago

Torero gravatar image

Hi, got a problem defining variables in cloud.sagemath: http://www.directupload.net/file/d/36...

I just copied the code from http://www.sagemath.org/doc/reference... (the very first line) but I also tried it myself with different letters and '`´". None worked.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 10 years ago

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.

Preview: (hide)
link

Comments

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

Torero gravatar imageTorero ( 10 years ago )

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

var

will give the following output:

<built-in function var>

so you know it is not available.

On the other hand, a cell with

war

will give

NameError: name 'war' is not defined

so you know this variable name is available.

slelievre gravatar imageslelievre ( 8 years ago )

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

Stats

Asked: 10 years ago

Seen: 453 times

Last updated: Aug 05 '14