HP Forums
[CAS] operation ANS - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: [CAS] operation ANS (/thread-7394.html)



[CAS] operation ANS - compsystems - 12-09-2016 01:17 PM

Hello

Help Ans Says

Quote:case 1: In CAS view, Ans returns the last result (answer) in the CAS history.

case 2: and Ans(n) does not recall the nth item in history. Here, Ans(n) will attempt to substitute (evaluation) n for x (or the default variable) in the last item in history and return the result.

case :=x3: In CAS view, if Ans is a matrix, Ans(m,n) returns the element in row m and column n.

In case 3 the lists must also be mentioned.

A better help, please to include it in an update
case :=x3: In CAS view, if Ans is a matrix/list, Ans(m,[n]) returns the element in row m and the element of column n, if is present.

case 1:
6*{a,b,c} -> {a*6,b*6,c*6}
Ans -> {a*6,b*6,c*6} // ok (Last answer)

case 2:
f(x):=x+3 (x)->x+3
Ans(y) -> y+3 // ok (evaluation)

case3:
6*[[a,b],[b,c],[c,d]] -> [[a*6,b*6],[b*6,c*6],[c*6,d*6]]
Ans(3) -> [c*6,d*6] // Ok (Extraction of elements)

6*[[a,b],[b,c],[c,d]] -> [[a*6,b*6],[b*6,c*6],[c*6,d*6]]
Ans(3,2) -> d*6 // Ok (Extraction of elements)

case3:
6*{a,b,c} -> {a*6,b*6,c*6}
Ans(3) -> c*6 // Ok (Extraction of elements)

case3:
r:=solve(sin(t)=0,t); -> {n_1*π}
Ans(1); -> n_1*π // Ok (Extraction of elements)

r:=solve(sin(t)=0,t); -> {n_2*π}
Ans(1)(n_2 = x) -> π*x // Ok (Extraction of elements, then substitution or evaluation)

r:=solve(sin(t)=0,t); -> {n_3*π}
Ans(1)|(n_3 = x) -> n_3(1)*π(1) // ?? I think this is not doing what it needs to do.
n_3*π |(n_3 = x) -> π*x


RE: [CAS] operation ANS - Han - 12-09-2016 09:31 PM

(12-09-2016 01:17 PM)compsystems Wrote:  r:=solve(sin(t)=0,t); -> {n_3*π}
Ans(1)|(n_3 = x) -> n_3(1)*π(1) // ?? I think this is not doing what it needs to do.
n_3*π |(n_3 = x) -> π*x

There was a thread about the priority of the "where" function some time ago:
http://www.hpmuseum.org/forum/thread-2421.html?highlight=where+function

If you have already stored the result as 'r' then why not simply use: r|(n_3=x) ?