HP Forums
(71B) Synthetic Division - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (71B) Synthetic Division (/thread-6464.html)



(71B) Synthetic Division - Eddie W. Shore - 06-27-2016 03:32 AM

Divide the polynomial p(x) by (x-R). P is the array of p(x), Q is the array representing the quotient q(x), and E is the remainder. Hence: P(x)/(x-R) = Q(x) + E/(x-R)
Code:

Program SYNTH (304 bytes)
10 DESTROY P,I,Q,R,E
12 OPTION BASE 0
14 DIPS “P(X)/(X-R)” @ WAIT 1
16 INPUT “DEGREE OF P(X):”;N
18 DIM P(N),Q(N)
20 FOR I=0 TO N
22 DISP “COEF OF x^”;N-1 @ PAUSE
24 INPUT P(I) @ P(I)=Q(I)
26 NEXT I
30 INPUT “R:’;R
40 FOR I=0 TO N-1
42 Q(I+1)=R*Q(I)+P(I+1)
44 NEXT I
50 E=Q(N)
60 DIM Q(N-1)
70 DISP “COEF OF Q(X)”
72 FOR I=0 TO N-1
74 DISP Q(I); “x^”; N-I-1 @ PAUSE
76 NEXT I
80 DISP “REMAIN:”; E; “/(x-“; R; “)”