# 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 06:58:43 -0600
**

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

Asked: **
2014-10-22 06:58:43 -0600
**

Seen: **130 times**

Last updated: **Oct 23 '14**

Can I define an n-dimensional matrix?

Getting the length of a vector

Quaternions Missing Important Functionality?

evaluate (simplify) trigonometric expression

How to create a symbolic arbitrary dimensional zero vector?

What's the vector equivalent to Pythons list addition? `[1,2]+[3,4]=[1,2,3,4]`

Normalize vector to euclidean unit length

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.