Ask Your Question
0

accessing the components of a vector

asked 2013-09-21 12:06:35 -0500

anonymous user

Anonymous

Is there a command in Sage that allows me to access the individual components of a vector? For example, suppose I've defined a vector like a=vector([1,2,3]). I want a command like "a.1" that returns the first component of the vector, so in this case I would want a.1 to return 1. Is there a command like this in Sage? Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-09-21 12:15:28 -0500

minopret gravatar image

You can use Python sequence indexing syntax, for which the index numbers start at zero: a=vector([1,2,3]);a[0] returns 1.

edit flag offensive delete link more

Comments

Thank you!

strangelove1221 gravatar imagestrangelove1221 ( 2013-09-21 12:27:23 -0500 )edit

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-09-21 12:06:35 -0500

Seen: 707 times

Last updated: Sep 21 '13