LIN-BAIRSTOW ALGORITHM for HP67/97 UPDATE!
|
08-14-2024, 01:46 PM
(This post was last modified: 08-14-2024 05:42 PM by Thomas Klemm.)
Post: #4
|
|||
|
|||
RE: LIN-BAIRSTOW ALGORITHM for HP67/97
Here's a program that uses 112 lines.
A program B to solve the quadratic equation is also included. Lin-Bairstow This program is based on the Lin-Bairstow method to find the roots of a polynomial of degree \(n\): \(P(x) = a_n x^n + a_{n-1} x^{n-1} + \cdots + a_2 x^2 + a_1 x + a_0 = 0\) Code: 001: 31 25 11 : f LBL A Registers \(\begin{matrix} R_0 & 10 + n \\ R_1 & p \\ R_2 & q \\ R_3 & c = c_j \\ R_4 & {c}′ = c_{j+1} \\ R_5 & {c}'' = c_{j+2} \\ R_6 & b = b_i \\ R_7 & {b}′ = b_{i+1} \\ R_8 & \\ R_9 & \\ R_{10} & a_n \\ R_{11} & a_{n-1} \\ R_{12} & a_{n-2} \\ R_{13} & \cdots \\ R_{14} & \cdots \\ \end{matrix}\) Quadratic Solver This program solves the quadratic equation: \(T(x)=x^2+px+q=0\) Code: 097: 31 25 12 : f LBL B Just be aware that this program can't find complex roots. Instead an Error will be displayed. However it's easy to find the complex solutions. Just use: CHS \(\sqrt{x}\) The solutions then are: \(Y \pm iX\) Example \(P(x)=2x^5-9x^4+15x^3+65x^2-267x+234=0\) Insert coefficients Code: CL REG Initialization Store \(10 + n\) in register \(0\) and initialize \(p = q = 1\). Code: 15 STO 0 Run program Code: A 14.0000 Code: B 1.5000 Conclusion \(2x^5-9x^4+15x^3+65x^2-267x+234=\) \((x^2+1.5x-4.5)(2x^3-12x^2+42x-52)\) Solutions For \(x^2+1.5x-4.5=0\): \(x_1=1.5\) \(x_2=-3\) Initialize guess Code: 1 STO 1 Run program again Code: A 12.0000 Code: B Error Code: P<>S Conclusion \(2x^3-12x^2+42x-52=\) \((x^2-4x+13)(2x-4)\) Solutions For \(x^2-4x+13=0\): \(x_3=2+3i\) \(x_4=2-3i\) For \(2x-4=0\): \(x_5=2\) Summary Factors \(2x^5-9x^4+15x^3+65x^2-267x+234=\) \((x^2+1.5x-4.5)(x^2-4x+13)(2x-4)=\) \((x-1.5)(x+3)(x^2-4x+13)2(x-2)=\) \((2x-3)(x+3)(x^2-4x+13)(x-2)\) Solutions \(x_1=1.5\) \(x_2=-3\) \(x_3=2+3i\) \(x_4=2-3i\) \(x_5=2\) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
LIN-BAIRSTOW ALGORITHM for HP67/97 UPDATE! - plore90 - 08-12-2024, 02:47 PM
RE: LIN-BAIRSTOW ALGORITHM for HP67/97 - Thomas Klemm - 08-12-2024, 09:23 PM
RE: LIN-BAIRSTOW ALGORITHM for HP67/97 - plore90 - 08-12-2024, 10:29 PM
RE: LIN-BAIRSTOW ALGORITHM for HP67/97 - Thomas Klemm - 08-14-2024 01:46 PM
RE: LIN-BAIRSTOW ALGORITHM for HP67/97 - plore90 - 08-14-2024, 03:28 PM
RE: LIN-BAIRSTOW ALGORITHM for HP67/97 - Thomas Klemm - 08-14-2024, 05:29 PM
RE: LIN-BAIRSTOW ALGORITHM for HP67/97 - plore90 - 08-14-2024, 09:35 PM
|
User(s) browsing this thread: 2 Guest(s)