HP PRIME - Need help for basic program svp.



#4

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


#5

Hello,

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

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

Cyrille


#6

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 ?


#7

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.


#8

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sending little images to the Prime (...and Program name bug?) Erwin Ried 19 7,487 12-10-2013, 05:35 PM
Last Post: Erwin Ried
  Problem with debug HP prime program, somebody help me? Carlos CM (Mexico) 6 3,381 12-05-2013, 03:07 PM
Last Post: Carlos CM (Mexico)
  HP PRIME: APP program code DISAPPEARS !! Joseph Ec 0 1,224 11-25-2013, 11:35 AM
Last Post: Joseph Ec
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 2,285 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  Prime: Program size limited to 64K? Erwin Ried 4 2,059 11-17-2013, 11:42 PM
Last Post: Joseph Ec
  [HP-Prime] Picking elements from a List in a program Jean-Michel 3 2,032 11-15-2013, 04:16 AM
Last Post: dg1969
  HP Prime: Recommendation for future RPN Program Mode BruceTTT 3 2,185 11-13-2013, 10:03 PM
Last Post: BruceTTT
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 2,738 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  [prime] Insert a breakpoint in a program for debugging ? Olivier Lecluse 3 1,808 11-09-2013, 09:41 PM
Last Post: Joseph Ec
  HP PRIME: Hide return value from program and swap Edit with Run vrrr 2 1,561 11-09-2013, 04:04 PM
Last Post: vrrr

Forum Jump: