HP Forums
HP Prime - saving multiple SOLVE solutions to variables {SOLVED} - 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: HP Prime - saving multiple SOLVE solutions to variables {SOLVED} (/thread-5071.html)



HP Prime - saving multiple SOLVE solutions to variables {SOLVED} - CR Haeger - 11-03-2015 04:07 PM

Hello,

Often times, I wish to save results from solve commands into local variables for futher processing. It seems that the solutions generated are either in vector or list form. May I ask if there is a way or commands to then store these into individual variables without having to use cut/paste? I assume this would be useful for saving results of other commands presented in vector or list form.

How to get [0 1] or {0, 1} into say new variables a and b?

[attachment=2754]


RE: HP Prime - saving multiple SOLVE solutions to variables - Han - 11-03-2015 05:25 PM

t:=solve( blah );
a:=t(1);
b:=t(2);


RE: HP Prime - saving multiple SOLVE solutions to variables - CR Haeger - 11-03-2015 06:24 PM

(11-03-2015 05:25 PM)Han Wrote:  t:=solve( blah );
a:=t(1);
b:=t(2);

Thanks Han - that works great! Don't know why it works yet, but it does...

It seems this would be useful (and quick) for say calculus problems involving area between two curves where the intersection(s) of the curves should first be determined.

cool, thanks again.

[attachment=2755]


RE: HP Prime - saving multiple SOLVE solutions to variables - Han - 11-03-2015 07:59 PM

(11-03-2015 06:24 PM)CR Haeger Wrote:  
(11-03-2015 05:25 PM)Han Wrote:  t:=solve( blah );
a:=t(1);
b:=t(2);

Thanks Han - that works great! Don't know why it works yet, but it does...

It seems this would be useful (and quick) for say calculus problems involving area between two curves where the intersection(s) of the curves should first be determined.

cool, thanks again.

No problem. As for why it works, it just borrows from programming syntax. As you noted, the results from solve() are lists. So t is a list, and t(n) would simply return the n-th item within the list. If t were a matrix, then t(i,j) would return the entry in row i, column j.