Ask Your Question

how to define var vector?

asked 2014-10-22 06:58:43 -0500

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

answered 2014-10-22 07:19:40 -0500

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

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


Asked: 2014-10-22 06:58:43 -0500

Seen: 81 times

Last updated: Oct 23 '14