HP Forums
Evaluation symbol... - 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: Evaluation symbol... (/thread-4361.html)



Evaluation symbol... - salvomic - 07-14-2015 08:24 PM

hi,
please, help to get evaluation symbol (|) in a program...
I would get this:
Code:

EXPORT lagrangeValue(lista_x, lista_y, xValue)
BEGIN
  LOCAL y, temp;
  y:= lagrange(lista_x, lista_y) | X=xValue;
  RETURN y;
END;
but the | symbol isn't evaluated...
What's the correct syntax?

thank you,
Salvo


RE: Evaluation symbol... - Arno K - 07-14-2015 09:57 PM

you perhaps should use: y:=unapply(lagrange(lstA,lstB),x), and then y(xVal),
this at least works for the command line from cas, from home that is another question, the output then given by y:=unapply(lagrange(listA,listB),X) is some kind of weird: program(X,[0],X+1) and y(6) delivers Error: Invalid input, but in a cas program the solution above should work.
I know, this is not what you want to do, but with the prime one often has to use, well, let me call it, workarounds to get something done. I would say ist a bug in the where function, as in simple instructions like x+1|x=6 it works correctly in cas (lower case x) and home (upper case x).
Arno


RE: Evaluation symbol... - salvomic - 07-14-2015 10:06 PM

(07-14-2015 09:57 PM)Arno K Wrote:  you perhaps should use: y:=unapply(lagrange(lstA,lstB),x), and then y(xVal),
this at least works for the command line from cas, from home that is another question, the output then given by y:=unapply(lagrange(listA,listB),X) is some kind of weird: program(X,[0],X+1) and y(6) delivers Error: Invalid input, but in a cas program the solution above should work.
I know, this is not what you want to do, but with the prime one often has to use, well, let me call it, workarounds to get something done. I would say ist a bug in the where function, as in simple instructions like x+1|x=6 it works correctly in cas (lower case x) and home (upper case x).
Arno

hi Arno, thanks for input.
I'm trying, but very weird results, yes!
I put y:= unapply(lagrange(lista_x, lista_y), xValue); // xValue is 30 now
I get also "program(30,[0],5.12234233945E-5": I should get only about 0.5

Is that as you told me?

Salvo


RE: Evaluation symbol... - salvomic - 07-14-2015 10:32 PM

ok,
the best way could be this:
Code:

EXPORT lagrangeValue(lista_x, lista_y, xValue)
BEGIN
  LOCAL y, temp;
  // y:= unapply(lagrange(lista_x, lista_y), X);
  temp:= lagrange(lista_x, lista_y);
  y:= EVAL(EXPR(temp+"|X="+xValue));
  RETURN y;
END;

my input is:
lagrangeValue({29.43,30.97,27.69,28.11,31.58,33.05},{0.4913598528,0.5145891926, 0.4646875083, 0.4711658342, 0.5236885653, 0.5453707057}, 30)
(list of value about 30, list of sines, xValue to get=30)
I get 0.500000000018 instead of 0.5, but it's almost ok.

Salvo


RE: Evaluation symbol... - Arno K - 07-15-2015 07:12 AM

So I had given up too early when I tried to use "|" at some Point. But eval(expr(..))is a godd idea.
I finally decided only to write programs using cas until (if ever) things will be fixed.
Arno


RE: Evaluation symbol... - salvomic - 07-15-2015 07:33 AM

(07-15-2015 07:12 AM)Arno K Wrote:  So I had given up too early when I tried to use "|" at some Point. But eval(expr(..))is a godd idea.
I finally decided only to write programs using cas until (if ever) things will be fixed.
Arno

I use also CAS programs mostly for analysis and algebra facts but in many cases (like the astronomy program) I write Home program, to be usable both in CAS and in Home... If this is possible, and sometime, with | or solve or ... is a great endeavor, hi.

Salvo