Polynomial Evaluation
Goal: Evaluation of the polynomial p(x) at x = a. This gives an alternative to typing out the polynomial itself.
Enter the coefficients of the polynomial as a list, in descending order from highest power to constant. Use zeros as place-holders.
Example:
Let p(x) = 2x^4 + 2x^2 - 4x + 1 at x = -1.5
List Input: {2, 0, 2, -4, 1}
Enter -1.5 when the program asks for X.
Result: p(-1.5) = 21.625
Casio Prizm:
POLYEVAL
Poly Evaluation
11/23/2012
(140 bytes)
Example: p(x) = x^3 + 2x^2 + 5x + 9, p(-2) = -1
Program:
"{AnX^n,...,A0}"
"P(X)"? → List 1
"X"? → X
X = 0 ⇒ Goto 1
0 → S
For 1 → K To Dim List 1
S + List 1[K] × X^(Dim List 1 - K) → S
Next
S
Stop
Lbl 1
List 1[Dim List 1]→ S
Sum is stored in S, 0^0 is not allowed.
TI-84+:
POLYEVAL
Polynomial Evaluation
11/23/2012 - 124 bytes
Example: p(x) = 1.425x^3 - 2.89x^2 + 0.23x + 4.4546
p(1.002) = 3.217055551
For the character n: VARS, 5, 1
Disp "{AnX^n,...,A0}"
Input "P(X):", L1
Input "X:", X
If X=0
Goto 1
0→ S
For(K,1,dim(L1))
S + L1(K) * X^(dim(L1) - K) → S
End
Pause S
Stop
Lbl 1
L1(dim(L1)) → S
Pause S
HP 39gii:
There is no program. Instead, use the POLYEVAL command.
POLYEVAL(vector, value)
The vector contains the coefficients of the polynomial.
This blog is property of Edward Shore. 2012
A blog is that is all about mathematics and calculators, two of my passions in life.
Sunday, December 2, 2012
Numeric CAS - Part 5: Polynomial Evaluation
Spotlight: Akron Brass FireCalc Pocket Computer
Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...