Ask Your Question
0

Augmenting a vector

asked 2013-10-17 05:42:32 -0500

MvG gravatar image

There are simple ways to extend a matrix to form a larger matrix: I can augment it to add columns or stack it to add rows.

Is there something similar for simple vectors? Some method of a vector object which would return the same vector with one more element added to the end? Or do I have to write that myself?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-10-17 06:08:32 -0500

tmonteil gravatar image

updated 2013-10-17 06:21:04 -0500

According to the tab completion, appart from the .cartesian_product() method that will make a couple of vectors, there seem no direct way to do this.

You can have a look at this question and that question, though i would advise to keep track of the base ring of your initial vector (if needed) as follows:

sage: v = vector(QQ,[0,1,2]) ; v
(0, 1, 2)
sage: v.parent()
Vector space of dimension 3 over Rational Field

sage: v = vector(v.base_ring(), v.list() + [QQbar(1/2)]) ; v
(0, 1, 2, 1/2)
sage: v.parent()
Vector space of dimension 4 over Rational Field
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

Stats

Asked: 2013-10-17 05:42:32 -0500

Seen: 81 times

Last updated: Oct 17 '13