
×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center

×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center
 HP Community
 >
 Other Products
 >
 Calculators
 >
 Re: CAS programs
 Mark Topic as New
 Mark Topic as Read
 Float this Topic for Current User
 Bookmark
 Subscribe
 Mute
 Printer Friendly Page
Create an account on the HP Community to personalize your profile and ask a question
Solved!
CAS programs
02102017 01:31 AM
I am a beginner.
Have you an example for CAS programation? i have tried this program:
#cas
QQQQ():=
BEGIN
LOCAL f,g;
INPUT(f);
g:=laplace(f,x);
return (g)
END
#end
When i verif its ok but when i exec it doesn't work.
Thank you very much for your help
Solved! Go to Solution.
02112017 10:17 AM
First, you should not forget semicolons after return(g) and END.
Next, you can not use the INPUT command in CAS programs.
Instead of a CAS program you could write a noncas program as follows:
EXPORT QQQQ() BEGIN LOCAL f,g; INPUT({{f,[2]}}); g:=CAS.laplace(EVAL(f),”x”); return (g); END;
I realize that this is a bit complicated.
Some remarks:
Notice the double curly brackets in the input command.
This construction is necessary because the input will be a string.
{f,[2]} means that f is a string.
You should enter your function in lowercase, e.g sin(x), because symbolic calculations in CAS are done in lowercase.
Suppose you wanted to use the laplace command in a noncas program for the function sin(x), then you could write: CAS.laplace(“sin(x)”,”x”).
Notice the quotation marks.
So it would be logical to write in our program: CAS.laplace(f,“x”), because f is a string.
But because of some reason this is not possible when f is a variable which contains a string, and in such a case we have to write: CAS.laplace(EVAL(f),”x”).
Also read:
http://www.hpmuseum.org/forum/thread216.html
http://www.hpmuseum.org/forum/thread215.html
http://www.hpmuseum.org/forum/thread3149.html
02112017 01:43 PM
Thanks a lot for your answer.
Is there a book or a link for CAS programming, because it seems it is slighty different?
All is ok now. What is the meaning of # created by HP Prime for new CAS programs?
02122017 07:25 AM
I do not know if there is a book about CAS programming.
The online user guide is quite good, but when you want to write more complicated programs it is insufficient, and you have to look for more information elsewhere.
In this forum you can ask questions.
Also here: http://www.hpmuseum.org/forum/forum5.html
The third link I gave, by Han, gives some important information concerning CAS programming. Only do not forget the trick with EVAL which I showed in my previous post.
By the way, the most powerful and general way to use CAS  commands in non  CAS programs is, when we stay with the example of laplace(f,x), to write it as CAS(“laplace(f,x)”).
Here f could be sin(x), so not a string.
Suppose we have f in the form of a string, like it is given by the INPUT command, and let’s call it f_s, so
f_s=”sin(x)”.
Then we can write the argument of CAS(“laplace(f,x)”), which is “laplace(f,x)” as the sum of 3 strings, namely “laplace(f,x)”= “laplace(“ + "f" + ”,x)”.
(So “laplace(“ is the first string, "f" the second, and ”,x)” the third)
Because “f”=f_s:
“laplace(f,x)”= “laplace(“ + f_s + ”,x)”
We can now define r as
r:= “laplace(“ + f_s + ”,x)”
And our command will be: CAS(EVAL(r))
This is also explained by Han.
Maybe you can find more information by looking for Xcas/Giac, because the Prime’s CAS is based upon this.
The construction with # ’s only serves to discern between a CAS program and a non CAS program.
It is of course most easy to not use the INPUT command at all, then we can confine ourselves to a simple CAS program:
#cas QQQQ(a,b):= BEGIN LOCAL g; g:=laplace(a,b); return (g); END; #end
Didn't find what you were looking for? Ask the community