# how to define var vector?

```
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

how to define var vector?

**
asked 2014-10-22 13:58:43 +0200 **

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

add a comment

0

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)
```

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

Asked: ** 2014-10-22 13:58:43 +0200 **

Seen: **908 times**

Last updated: **Oct 23 '14**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.