The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP PRIME - Need help for basic program svp.
Message #1 Posted by dg1969 on 6 Oct 2013, 1:33 p.m.

Hi,

I try some experiments with the emulator... I'd like to write a program that asks first for a function and then place is inv-Laplace transform in F1 for plotting.

Here is the "idea" (of course it can't work like this...)

EXPORT Laplace()
BEGIN
local s,f;
INPUT(f,"F(s) definition","F(s)=", "Enter function transfer");
F1:=CAS.invlaplace(f,s,'X');
END;

Can you help me ? I have in mind to make an APP for "motion control" but as you can read It's a long way for me...

      
Re: HP PRIME - Need help for basic program svp.
Message #2 Posted by cyrille de Brébisson on 7 Oct 2013, 1:37 a.m.,
in response to message #1 by dg1969

Hello,

Concider using strings for entering the function and using it in the CAS command...

F1:= CAS("ilaplace("+f+"s,'X')");

Cyrille

            
Re: HP PRIME - Need help for basic program svp.
Message #3 Posted by dg1969 on 7 Oct 2013, 4:18 p.m.,
in response to message #2 by cyrille de Brébisson

Thank you Cyrille for your fast answer... I followed your advice

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

But I have an error syntax...

I can place a local var u in place of F1, I can do F1:=sin('X') but

F1:=CAS("...") don't work.....

Any idea ?

                  
Re: HP PRIME - Need help for basic program svp.
Message #4 Posted by Han on 7 Oct 2013, 5:01 p.m.,
in response to message #3 by dg1969

Quote:
Thank you Cyrille for your fast answer... I followed your advice
EXPORT Laplace()
BEGIN
local s,f;
f:="1/(1+s)";
INPUT(f,"F(s) definition","F(s)=", "No help!");
F1:=CAS("invlaplace("+f+",s,'X')");
END;

But I have an error syntax...

I can place a local var u in place of F1, I can do F1:=sin('X') but

F1:=CAS("...") don't work.....

Any idea ?


The issue is likely that f is evaluated before it actually gets passed to CAS(). What you need to do is make sure to enter in a symbolic: '1/(1+s)' as opposed to just 1/(1+s)

You can save a tiny bit of memory by using F1 instead:

INPUT(F1,"F(s) definition","F(s)=", "No help!");

and when you enter a formula, use single quotes: [shift][()] to designate a symbolic input.

                        
Re: HP PRIME - Need help for basic program svp.
Message #5 Posted by dg1969 on 8 Oct 2013, 4:06 p.m.,
in response to message #4 by Han

Thank you Han for your help... But I can't find a solution... Did you try a program with succes ? If so can you post the code ?

As you can see I place f in double quotes "1/(1+s)"

If you try this in CAS command line :

first command -> f:="1/(1+s)"

second command -> CAS("invlaplace("+f+",s,'X')") then it works : -> exp(-X)

But in a program I have an error syntax...

I try with single quote... No success...

I wrote a new post on the top of the stack...


[ Return to Index | Top of Index ]

Go back to the main exhibit hall