Post Reply 
(35S ALG) Ruffini Polynomial Division
06-12-2014, 05:52 PM (This post was last modified: 06-15-2017 01:15 PM by Gene.)
Post: #1
(35S ALG) Ruffini Polynomial Division
Hi HPmuseum, I'm a new user and I'm going to share with you an HP 35s program that is able to calculate the coefficents of a polynomial divison using Ruffini Rule.
This program, developed in ALG mode, can divide a n-grade polynomial g(x) by hx-c.
It will ask you:
  • The grade of the polynomial to divide (G)
  • The coefficent h of the divisor (H)
  • The value of c (C)

Then, if one of these values is zero it will prompt an error and exit, else it will start a cycle on INPUT I where you have to put the coefficents the dividend polynomial in decrescent order(the current value of I will help you showing the grade of the coefficent you have to write). After each INPUT it will show you the coefficent of x^n-1 of the result polynomial(so if you have just entered the third grade coefficent it will show you the second grade coefficent of the result), then you have to press R/S to input a new coefficent. The last value shown is the rest of the division (R).
Here the code:

R001 LBL R
R002 CLVARS
R003 CLSTK
R004 SF 10
R005 DIVIDE BY Hx-C
R006 PSE
R007 CF 10
R008 0->D
R009 INPUT G
R010 x=0?
R011 GTO R036
R012 INPUT H
R013 x=0?
R014 GTO R036
R015 INPUT C
R016 x=0?
R017 GTO R036
R018 C/H->C
R019 G+2->G
R020 DSE G
R021 GTO R023
R022 RTN
R023 G-1->I
R024 INPUT I
R025 I/H+D->I
R026 I*C->D
R027 I*H->R
R028 G
R029 1
R030 x=y?
R031 GTO R034
R032 VIEW I
R033 GTO R020
R034 VIEW R
R035 RTN
R036 SF 10
R037 INVALID DATA
R038 PSE
R039 CF 10
R040 RTN


Let's do some example:
(2x^4 -5x^2 -2x -1) / (x-2)

so:
h=1 ; c=2

To solve this division you have to press:
XEQ R... ENTER (It will ask you the grade)
4 R/S (It will ask you h)
1 R/S (It will ask you c)
2 R/S (It will ask you the coefficent in decrescent order starting by 4)
2 R/S (The result coefficent of grade 3 is 2)
R/S 0 R/S (It will ask you the third grade coefficent and show you the second grade coefficent of the result: 4)
R/S -5 R/S (...first grade coefficent: 3)
R/S -2 R/S (...known term: 4)
R/S -1 R/S (rest: 7)

so our result is 2x^3+4x^2+3x+4 R=7

Any question will be answered...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(35S ALG) Ruffini Polynomial Division - d.nicotra - 06-12-2014 05:52 PM



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