Saturday, January 15, 2022

Casio fx-3650P and fx-CG50: Partial Fraction Decomposition

Casio fx-3650P and fx-CG50:   Partial Fraction Decomposition


Casio fx-3650P (II) Program: Partial Fraction Decomposition


The following program calculates the coefficients decomposition, X and Y, as follows:


(A ∙ t + B) ÷ ((t + C) ∙ (t + D)) = X ÷ (t + C) + Y ÷ (t + D)

Note:  C ≠ D



where:

X = (B - A ∙ C) ÷ (D - C)

Y = A - X


Program:  (35 Steps)


? → A : ? → B : ? → C : ? → D : 

( B - A C ) ÷ ( D - C → X ◢ A - X → Y


Example:  


(2t - 3) ÷ ((t - 1)(t + 4))  = -0.2÷(t-1) + 2.2÷(t + 4)


A = 2, B = -3, C = -1, D = 4

Result:  -0.2, 2.2


The above algorithm should be good for the fx-7000G, fx-50FII, fx-4000P, fx-5800P, and other programming and graphing calculators (modifications may be necessary).


Casio fx-CG50 Program:  PARTFRAC


The code listed will also be good for the fx-9750G/fx-9860G series.


The program PARTFRAC, 720 bytes, will execute partial fraction decomposition of any of the three types:



(1)    (A ∙ x + B)÷((x + C) ∙ (x + D)) = R÷(x + C) + S÷(x + D)


Inputs:  A, B, C, D

Outputs:  R, S


[[ R ] [ S ]] = [ [ D, C ] [ 1, 1 ] ]^(-1) ∙ [ [ B ] [ A ] ]


(2)  (A ∙ x^2 + B ∙ x + C)÷((x + D)^2 ∙ (x + E)) = R÷(x + D)^2 + S÷(X + D) + T÷(x + E)


Inputs:  A, B, C, D, E

Outputs:  R, S, T


[[ R ][ S ][ T ]] = [[ E, D ∙ E, D^2 ][ 1, D + E, 2 ∙ D ][ 0, 1, 1 ]]^-1) ∙ [[ C ][ B ][ A ]] 


(3)  (A ∙ x^2 + B ∙ x + C)÷((x+D)∙(x+E)∙(x+F)) = R÷(x+D) + S÷(x+E) + T÷(x+F)


Inputs:  A, B, C, D, E, F

Outputs:  R, S, T


[[ R ][ S ][ T ]] = 

[[ E ∙F, D ∙ F, D ∙ E ][ E+F, D+F, D+E ][ 1, 1, 1 ]]^-1) ∙ [[ C ][ B ][ A ]] 


Program Listing:


'ProgramMode:RUN

"2021-11-05 EWS"

"PARTIAL FRACTION"

"N(X)/D(X)"◢

Lbl 0

Menu "DENOMINATOR?","(X+C)(X+D)",1,"(X+D)_^<2>_(X+E)",2,"(X+D)(X+E)(X+F)",3,"EXIT",E

Lbl 1

"(AX+B)/((X+C)(X+D))"◢

"A"?->A

"B"?->B

"C"?->C

"D"?->D

[[D,C][1,1]]^<-1>*[[B][A]]->Mat A

Mat A[1,1]->R

Mat A[2,1]->S

"=R/(X+C)+S/(X+D)"◢

"R="

R◢

"S="

S◢

Goto 0

Lbl 2

"(AX_^<2>_+BX+C)/((X+D)_^<2>_(X+E))"◢

"A"?->A

"B"?->B

"C"?->C

"D"?->D

"E"?->E

[[E,D*E,D^<2>][1,D+E,2*D][0,1,1]]^<-1>*[[C][B][A]]->Mat A

Mat A[1,1]->R

Mat A[2,1]->S

Mat A[3,1]->T

"=R/(X+D)_^<2>_+S/(X+D)+T/(X+E)"◢

"R="

R◢

"S="

S◢

"T="

T◢

Goto 0

Lbl 3

"(AX_^<2>_+BX+C)/((X+D)(X+E)(X+F))"◢

"A"?->A

"B"?->B

"C"?->C

"D"?->D

"E"?->E

"F"?->F

[[E*F,D*F,D*E][E+F,D+F,D+E][1,1,1]]^<-1>*[[C][B][A]]->Mat A

Mat A[1,1]->R

Mat A[2,1]->S

Mat A[3,1]->T

"=R/(X+D)+S/(X+E)+T/(X+F)"◢

"R="

R◢

"S="

S◢

"T="

T◢

Goto 0

Lbl E

"DONE."


Download (fx-CG 50):

https://drive.google.com/file/d/1hAIFrlX6xLMYPRiLz_dt7hpiP64CxmKC/view?usp=sharing


Examples To Try:


Type 1: 

(8 ∙ x + 3) ÷((x + 4) ∙ (x - 6))  = (29/10) ÷ (x + 4) + (51/10) ÷ (x - 6)


Type 2:

(x^2 + 4 ∙x + 5) ÷ ((x - 3)^2 ∙ (x + 1)) = 

(13/2) ÷ (x - 3)^2 + (7/8) ÷ (x - 3) + (1/8) ÷ (x + 1)


Type 3:

(2 ∙ x^2 + 3 ∙ x - 1) ÷ ((x - 1) ∙ (x + 2) ∙ (x + 4)) = 

(4/15) ÷ (x - 1) + (-1/6) ÷ (x + 2) + (19/10) ÷ (x + 4)


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Fun with the HP 30b

Fun with the HP 30 b Introduction The following programs are for the HP 30b Business Professional. Did you know that the 30b...