Ask Your Question
0

how to define var vector?

asked 2014-10-22 13:58:43 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

sage: a,b,c=var("a,b,c")
sage: v = vector(QQ, ["a", "b", "c"]);v
...
TypeError: unable to convert a to a rational

cannot run

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-10-22 14:19:40 +0100

ndomes gravatar image

There are two errors in your code.

First: you define variables a,b,c , that's ok, but you use strings in the list of vector entries.

Second: a,b,c are elements of the symbolic ring and cannot be converted to elements of QQ

sage:  a,b,c=var("a,b,c");v = vector([a,b,c]);v

(a,b,c)
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

1 follower

Stats

Asked: 2014-10-22 13:58:43 +0100

Seen: 975 times

Last updated: Oct 23 '14