Evaluation symbol...
07-14-2015, 08:24 PM
Post: #1
 salvomic Senior Member Posts: 1,366 Joined: Jan 2015
Evaluation symbol...
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

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
07-14-2015, 09:57 PM
Post: #2
 Arno K Senior Member Posts: 432 Joined: Mar 2015
RE: Evaluation symbol...
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
07-14-2015, 10:06 PM
Post: #3
 salvomic Senior Member Posts: 1,366 Joined: Jan 2015
RE: Evaluation symbol...
(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

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
07-14-2015, 10:32 PM
Post: #4
 salvomic Senior Member Posts: 1,366 Joined: Jan 2015
RE: Evaluation symbol...
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

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
07-15-2015, 07:12 AM
Post: #5
 Arno K Senior Member Posts: 432 Joined: Mar 2015
RE: Evaluation symbol...
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
07-15-2015, 07:33 AM
Post: #6
 salvomic Senior Member Posts: 1,366 Joined: Jan 2015
RE: Evaluation symbol...
(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

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)