HP Prime  vector question  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: HP Prime  vector question (/thread256253.html) 
HP Prime  vector question  bluesun08  11182013 I define the following 3dvector: Re: HP Prime  vector question  Michael de Estrada  11182013 You have created the CAS program function v(CAS):
(c)>Begin
What you are seeing is the last result which is 4*a. This is not a vector.
Re: HP Prime  vector question  Han  11182013 Quote: You are expecting v to be both a function of a and also a vector. Based only on syntax, how would anyone distinguish between the functional notation v(x), or the index notation v(i)  as in the ith element of v  or even multiplication? The only way to determine what is meant is based on context. So whatever it is you want v to be (a vector vs a function), it cannot be both. To create a function so that v(2) is [ 4 6 8 ] you can do:
v(a):=[[ 2*a, 3*a, 4*a ]] or
[[2*a, 3*a, 4*a]] > v(a) // ">" is the STO character and note the double brackets Now v is more like a function that returns a vector. However, 2*v would be a function. If you just want a vector, then either
v:=[2*a, 3*a, 4*a] or
[2*a, 3*a, 4*a] > v // ">" is the STO character To get the equivalent of v(2) you would do
a:=2; eval(v); or
va=3 And 3v would return the expected vector object [3a, 9a, 12a]. However, v(2) would return the second element of the vector v. That said, there is an issue with the way vectors are interpreted, however  or at least there is an issue with expected behavior and actual behavior. That is, I too expected that
[2a, 3a, 4a] > v(a) // ">" represents the STO character to create a function so that v(2) returns [4, 6, 8]. However, it neither returns [4,6,8] nor even the second element of the vector! Unfortunately, the way vectors and matrices are implemented is quite confusing. This has been discussed (somewhat) before but I feel as though I was on the losing side of the argument in suggesting that [[ a11, a12], [a21, a22]] be matrices whereas [ v1, v2, v3, … , vn ] be vectors.
Edited: 18 Nov 2013, 8:33 p.m. after one or more responses were posted
Re: HP Prime  vector question  Han  11182013 You might be able to find more useful info here:
http://wwwfourier.ujfgrenoble.fr/~parisse/giac/cascmd_en.pdf
