Polynomial Coefficients from a given list of roots -- for the HP-71B
12-26-2018, 12:11 AM (This post was last modified: 12-26-2018 03:51 AM by Namir.)
Post: #1 Namir Senior Member Posts: 660 Joined: Dec 2013
Polynomial Coefficients from a given list of roots -- for the HP-71B
Here is an HP-71B program that converts the list of roots into the coefficients of the polynomial that has these roots. The DATA statement(s) contain the number of roots, followed by the list of roots. This data can appear on one or more DATA statements. Run the program to view the coefficients along with their associated power of X:

Code:
10 REM POLY COEFFS FROM ROOTS 20 DIM A(101),C(101) 25 REM DATA NUMBER_OF_ROOTS 30 DATA 3 35 REM DATA STMT HAS LIST OF ROOTS 40 DATA 1,2,3 50 READ M, B 60 A(1) = 1@ C(1) = 1 70 A(2) = -B@ C(2) = -B 80 N = 1 90 FOR K=2 TO M 100 READ B @ B=-B 110 FOR I = 2 TO N + 1 120 C(I) = A(I) + B * A(I - 1) 130 NEXT I 140 C(N + 2) = A(N + 1) * B 150 N = N + 1 160 FOR I = 1 TO N + 1 170 A(I) = C(I) 180 NEXT I 190 NEXT K 195 M = N 200 FOR I=1 TO N 210 DISP A(I);"* X^";M @ WAIT 3 215 M = M - 1 220 NEXT I 230 DISP A(N+1) 240 END
 « Next Oldest | Next Newest »

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