HP Forums

Full Version: HP PRIME - Need help for basic program svp.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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...

Hello,

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

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

Cyrille

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 ?

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.

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...