HP Forums
HP PRIME - Need help for basic program svp. - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP PRIME - Need help for basic program svp. (/thread-252303.html)



HP PRIME - Need help for basic program svp. - dg1969 - 10-06-2013

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. - cyrille de Brébisson - 10-07-2013

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. - dg1969 - 10-07-2013

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. - Han - 10-07-2013

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. - dg1969 - 10-08-2013

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