# TITLE: Polynomial Division # AUTHOR: Roy F.A. Maclean # EMAIL: rfamgm at gmail # WEB: http://www.spiderpixel.co.uk/caspro # DATE: 13Aug1996, 15Jan1998, 22May1999 # MAKE: CASIO # MODEL: 9850 # SIZE: 257 # # # Enter the degree of each polynomial and then their # coeffs in descending order of degree of term. # example: To find x^3+2x^2+3x+4 divided by 2x^2+3x+3 then # enter 3 and 2 for the degrees # and the coeffs 1 2 3 4 and coeffs 2 3 3 # The result is 1/2 1/4 rem 3/4 3 and 3/4 # i.e. (1/2)x+1/4 remainder (3/4)x+(3 and 3/4) # so x^3+2x^2+3x+4=(2x^2+3x+3)((1/2)x+1/4) +(3/4)x+(3 and 3/4) ## Program "POLYDIV" ## This program is repeated below without comments, ## for compatibility with Xchange Lbl 0 "DEGNUM"?->A "DEGDEN"?->B B>A=>Goto 0 ; degree of numerator must be higher Seq(0,X,1,A+1,1->List 1 ; Use A+1->Dim List 1 on models List 1->List 2 ; with autodimension capability ; instead of line starting Seq(. "COEFFSNUM" For 1->C To A+1 ?->List 1[C Next ; this loop stores first set of coefficients "COEFFSDEN" For 1->D To B+1 ?->List 2[D ; this loop stores second set of coefficients Next "QUOTIENT" For 0->F To A-B ; outer F loop displays quotient coeffs (the 'C' value) List 1[F+1]%List 2[1->C_ ; use fraction symbol for % For 1->E To B+1 List 1[F+E]-C*List 2[E->List 1[F+E Next ; inner E loop uses the 'C' from outer loop to Next ; subtract from dividend "REM" For F+1->F To A List 1[F+1_ ; this loop displays coeffs of remainder Next Goto 0 # ______________________________ @@ Program "POLYDIV" Lbl 0 "DEGNUM"?->A "DEGDEN"?->B B>A=>Goto 0 Seq(0,X,1,A+1,1->List 1 List 1->List 2 "COEFFSNUM" For 1->C To A+1 ?->List 1[C Next "COEFFSDEN" For 1->D To B+1 ?->List 2[D Next "QUOTIENT" For 0->F To A-B List 1[F+1]%List 2[1->C_ For 1->E To B+1 List 1[F+E]-C*List 2[E->List 1[F+E Next Next "REM" For F+1->F To A List 1[F+1_ Next Goto 0