HP Forums
CAS inside prgm ?! - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: CAS inside prgm ?! (/thread-3015.html)



CAS inside prgm ?! - dg1969 - 02-05-2015 09:15 PM

Hi,

I'd like something these way :
Code:

export inv_laplace(k)
begin
  local f;
  f:=CAS(ilaplace(subst(expr("F"+k),'X','x')));
  return subst(f,'x','X');
end;

But it doesn't work like these...

I try with a CAS program but without success...

Code:

#cas
Inverse_laplace(k):=
BEGIN
  local f;
  f:=ilaplace(EXPR("F"+k+"(x)"));
  return subst(f,'x','X');
END;
#end

Can you help me to learn good practise ? What can we realy do with CAS program for that kind of problem ?

Thank you for your help.


RE: CAS inside prgm ?! - Han - 02-05-2015 09:30 PM

Code:

export inv_laplace(k)
begin
  tmp:="F" + LEFT(STRING(k),1) + "(x)";
  CAS.ilaplace(tmp);
end;

Pretty much all CAS commands that do not natively work in Home require their arguments be passed as strings. The strings may be saved as variables. Thus, CAS.command("arg1", "arg2") can be replaced by CAS.command(arg1,arg2) where arg1 and arg2 are string variables. This style does not allow string expressions as arguments, however. So CAS.command("arg1of2" + "arg2of2") would not work (generally speaking)


RE: CAS inside prgm ?! - dg1969 - 02-07-2015 05:19 PM

Thank you so much Han,

As always your help is invaluable. I learned a lot by reading your articles.

Have a nice day !