Please help me understand - 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: Please help me understand (/thread-805.html) |
Please help me understand - DrD - 03-02-2014 01:07 PM Regarding: ab:=solve(x^2-3=1,x) If I enter the above expression directly in the command line on the CAS page, I get an expected list, {-2,2.} for this example. If I try this programmatically I get an unexpected list, {x}: EXPORT ab,x; EXPORT dmy() BEGIN ab:=solve(x^2-3=1,x); print(ab); return ab; END; If I try this programmatically I get an unexpected, 0 value. EXPORT ab,x; EXPORT dmy() BEGIN ab=solve(x^2-3=1,x); // <---Replaced ":=" with just "=" here print(ab); return ab; END; What program operation similar to ab:=solve(x^2-3=1,x) will return the list {-2,2.}, as if directly input on the CAS command line? I've tried several approaches, including appending CAS.solve(..), no success yet, though. Thanks, I'm still climbing the learning curve! -Dale- RE: Please help me understand - parisse - 03-02-2014 03:56 PM If you want to run CAS commands, it might be a better idea to make a CAS program than a Home program, because you won't have to EXPORT a x variable that is a non-CAS variable, may have a value and could interfer with CAS evaluation (especially for a command like solve that auto-quote parts of it's arguments). From CAS enter dmy():= BEGIN LOCAL ab; ab:=solve(x^2-3=1,x); print(ab); return ab; END; then dmy() RE: Please help me understand - DrD - 03-02-2014 04:22 PM From that,I learned that entering a program structure on the CAS command line does work. (I didn't realize that could be done). From the conn kit, how would you create a program to do that (rather than entering it all on the CAS command line)? Or to say that differently, how does one edit a program input via the CAS command line? Thank you for that working example. Very helpful! -Dale- RE: Please help me understand - jebem - 03-02-2014 04:41 PM (03-02-2014 04:22 PM)DrD Wrote: Or to say that differently, how does one edit a program input via the CAS command line? I have the same questions here... If I understand correctly, we have two different environments - Home and CAS; so, we have two different sets of variables to use, and one should not mix CAS functions like "solve" in a "Home regular" program. I have just edited my post. I realized that once we define a small CAS program from the command entry line, we can see it from the general listing of programs (Shift+1), so it should be possible to edited it in the usual way. Pls see: http://www.hpmuseum.org/forum/thread-683.html?highlight=cas+function RE: Please help me understand - DrD - 03-02-2014 05:23 PM I had the original program (dmy) left in the shift 1 catalog. I was not seeing the dmy(CAS) entry that I had put in via the CAS command line. So I deleted the original program, and now I do see the CAS entry version. Maybe there is a conflict if the same program name is resident in both environments? Maybe just a lot of learning (on my part) better explains it. In any event, I had not read about this distinction in the documentation so far. Thanks for that link, it sheds more light on the subject. I just noticed that the dmy(CAS) program does not show up in the connectivity kit, even after restarting both the ck and the virtual calc. It is present on the virtual calc, though. So editing via the ck editor is still an issue. -Dale- I have just edited my post. I realized that once we define a small CAS program from the command entry line, we can see it from the general listing of programs (Shift+1), so it should be possible to edited it in the usual way. Pls see: http://www.hpmuseum.org/forum/thread-683.html?highlight=cas+function [/quote] RE: Please help me understand - jebem - 03-02-2014 05:33 PM Hi Dale, I'm starting here with this calculator as well... apparently we need a more comprehensive user guide... However in the above link I believe there is a workaround to allow us to edit the programs in the CK: "Thomas_Sch post: found a possible work-around ;-) - copy CAS program text to notes ([Shift] 0) (files named like programs), - transfer notes / or send it in virtual calc - now in real calc you may edit and copy the Notes, - and paste it within program editor. Works!" RE: Please help me understand - DrD - 03-02-2014 05:45 PM There seems to be a lot of difference in the behavior of CAS programs with regard to the conn kit and calc handling. I've experimented a little, and learned that I have much more to learn! Some insight has been gained though, and that was all I was really after today. Thank you very much for the assistance. -Dale- |