The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP-PRIME How to do ?!!!
Message #1 Posted by dg1969 on 8 Oct 2013, 1:16 p.m.

I want to make a program which ask for a function of s and return the inv-Laplace transform in F1 (function App var) for ploting...

The calc is in function APP... I use the last emulator

I follow Cyrille De Brébisson and Han advises see here :

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi?read=252384#252384

But nothing work !

Who know how to do ?

EXPORT Laplace()
BEGIN
local s,f="1/(1+s)";
INPUT(f,"F(s) definition","F(s)=", "No help!");
F1:=CAS("invlaplace("+f+",s,'X')");
END;

Thank's for your help.

      
Re: HP-PRIME How to do ?!!!
Message #2 Posted by cyrille de Brébisson on 9 Oct 2013, 2:18 a.m.,
in response to message #1 by dg1969

Hello,

This seems to work...

EXPORT Laplace() BEGIN local f=""; INPUT(f,"F(s) definition","F(s)=", "Enter function transfer in douple quotes """""); f:= "CAS.ilaplace("""+f+""",""s"",'X')"; f:= expr(f); F1:= f; END;

It is a little bit convoluted as we need to make sure that the parameters are passed unevaluated to the CAS, but that the value of local variables are passed (ie, the local variable needs to be evaluated)...

Cyrille

            
Re: HP-PRIME How to do ?!!!
Message #3 Posted by dg1969 on 9 Oct 2013, 2:39 p.m.,
in response to message #2 by cyrille de Brébisson

Wonderful! Thank you very much Cyrille. This machine will please me! Do you think that in the future it will be possible to do things more simply. With less double quotes !! With a better INPUT function ? The ability to simply use the CAS functions in the program as we do in command line?

Thank's to HP calculator team For this good job !!

EXPORT Laplace()
BEGIN
local f="";
INPUT(f,"F(s) definition","F(s)=", "Enter function transfer in douple quotes """"");
f:= "CAS.ilaplace("""+f+""",""s"",'X')";
f:= expr(f);
F1:= f*'Heaviside('X')';
END;


[ Return to Index | Top of Index ]

Go back to the main exhibit hall