[CAS] operation ANS
12-09-2016, 01:17 PM (This post was last modified: 12-09-2016 04:38 PM by compsystems.)
Post: #1 compsystems Senior Member Posts: 1,225 Joined: Dec 2013
[CAS] operation ANS
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
12-09-2016, 09:31 PM
Post: #2 Han Senior Member Posts: 1,817 Joined: Dec 2013
RE: [CAS] operation ANS
(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: