Please help me understand
03-02-2014, 01:07 PM
Post: #1
 DrD Senior Member Posts: 1,118 Joined: Feb 2014
Please help me understand
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-
03-02-2014, 03:56 PM
Post: #2
 parisse Senior Member Posts: 1,090 Joined: Dec 2013
RE: Please help me understand
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()
03-02-2014, 04:22 PM
Post: #3
 DrD Senior Member Posts: 1,118 Joined: Feb 2014
RE: Please help me understand
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-
03-02-2014, 04:41 PM (This post was last modified: 03-02-2014 05:02 PM by jebem.)
Post: #4
 jebem Senior Member Posts: 1,320 Joined: Feb 2014
RE: Please help me understand
(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?
-Dale-

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...s+function

Jose Mesquita
RadioMuseum.org member

03-02-2014, 05:23 PM (This post was last modified: 03-02-2014 05:28 PM by DrD.)
Post: #5
 DrD Senior Member Posts: 1,118 Joined: Feb 2014
RE: Please help me understand
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...s+function
[/quote]
03-02-2014, 05:33 PM
Post: #6
 jebem Senior Member Posts: 1,320 Joined: Feb 2014
RE: Please help me understand
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!"

Jose Mesquita
RadioMuseum.org member

03-02-2014, 05:45 PM
Post: #7
 DrD Senior Member Posts: 1,118 Joined: Feb 2014
RE: Please help me understand
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-
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)