Post Reply 
Extracting values from vectors/matrices in home
02-24-2016, 04:06 PM (This post was last modified: 02-24-2016 04:07 PM by Han.)
Post: #4
RE: Extracting values from vectors/matrices in home
Just save your vector or matrix into ad global variable. For example:

M1:=proot( [1,5,6] ); // now M1 contains the vector [-3 -2]
M1[1] returns -3 and M1[2] returns -2

For matrices, use M1[m,n] to extract the element in row m and column n.
You can optionally use the following syntax: M1(1) and M1(2), or M1(m,n) for a matrix but I do not recommend this syntax because (esp. in CAS programs) it is not clear if something like:

myvar(m,n)

should be interpreted as a 2-variable function myvar with inputs m and n, or as the m,n entry of a matrix named myvar.

I know you specified not using variables, but global variables exist whether you use them or not, so I say go ahead and use them.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Extracting values from vectors/matrices in home - Han - 02-24-2016 04:06 PM



User(s) browsing this thread: 1 Guest(s)