HP Forums

Full Version: ambiguity in the expression evaluation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As we know, the variable X is a global variable for HOME / CAS that can not be deleted and can only contain a real number.

an ambiguity in the expression evaluation, see following example

I propose a solution inspired by MATLAB, declare symbolic variables

Symbs A,...Z
example X, unicode FF38 by modifying the text font (bold) to differentiate it from normal X

The commands that throw symbolic expressions would use these variables and not the user variables

((X+2)*X+3)*X+4 ≠ ((X+2)*X+3)*X+4

HOME MODE (history)

X:=0; [enter]
v1:= [1,2,3,4]; [enter] "do you want to create a varible called v1" [ok] [enter]
p1:=poly2symb(v1); -> ((X+2)*X+3)*X+4 // ok
p1:=simplify(Ans(1)); -> 4 // ok

p1:=poly2symb(v1); -> ((X+2)*X+3)*X+4 // ok
p1:=simplify([up][copy]); -> 4 // ok

p1:=simplify(poly2symb(v1)); // -> X^3+2*X^2+3*X+4, In this case the command "simplify" did not evaluate X, Why?

v2:= [5,6,7,8]; [enter]
p2:=simplify(poly2symb(v2)); // 5*X^3+6*X²+7*X+8

convolution:= p1*p2; -> (X^3+2*X^2+3*X+4)*(5*X^3+6*X^2+7*X+8)
convolution:= simplify(Ans(1)); // 4

convolution:=simplify(p1*p2); // 5*X^6+16*X^5+34*X^4+60*X^3+61*X^2+52*X+32
convolution:=symb2poly(Ans(1)); // 4

convolution:=symb2poly(p1*p2); // [5,16,34,60,61,52,32]
Reference URL's