HP Prime - vector question


I define the following 3d-vector:

[2*a 3*a 4*a] Sto v(a)

Naturally v(2) = [4 6 8] and 3*v=[6*a 9*a 12*a]

But the HP Prime don't show these results. Why not?


You have created the CAS program function v(CAS):


What you are seeing is the last result which is 4*a. This is not a vector.


I define the following 3d-vector:

[2*a 3*a 4*a] Sto v(a)

Naturally v(2) = [4 6 8] and 3*v=[6*a 9*a 12*a]

But the HP Prime don't show these results. Why not?

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 i-th 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 ]]


[[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]


[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);



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


You might be able to find more useful info here:


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: adding an entry to a vector Alberto Candel 12 4,049 12-02-2013, 01:18 PM
Last Post: Alberto Candel
  HP Prime Matrix TERRIBLE bug and question uklo 19 5,164 11-25-2013, 12:10 PM
Last Post: Mic
  Question about transfering programs to the HP Prime Namir 10 3,505 11-17-2013, 04:01 PM
Last Post: Namir
  Another HP Prime CAS question Michael de Estrada 3 1,840 11-09-2013, 10:56 AM
Last Post: Michael de Estrada
  XCas / Prime "solve" question Nigel J Dowrick 4 2,021 11-08-2013, 04:01 AM
Last Post: Nigel J Dowrick
  Non-Prime question alert: Hp-41 and synthetic instructions Marcel Samek 11 4,068 11-04-2013, 09:31 PM
Last Post: sjthomas
  [HP-Prime CAS] Vector Calculus Library CompSystems 7 2,756 10-31-2013, 12:48 PM
Last Post: Han
  HP-Prime/Xcas: vector/list indexing fhub 6 2,867 10-27-2013, 04:52 PM
Last Post: fhub
  HP PRIME - APP Programing question dg1969 2 1,341 10-27-2013, 10:23 AM
Last Post: dg1969
  WP-34S (Prime Number Test) question Barry Mead 3 1,740 10-20-2013, 05:28 PM
Last Post: Dieter

Forum Jump: