(32S) Polynomial Root Finder from 32SII manual
|
11-20-2024, 01:56 PM
(This post was last modified: 11-21-2024 07:10 PM by naddy.)
Post: #1
|
|||
|
|||
(32S) Polynomial Root Finder from 32SII manual
The 32SII manual includes a Polynomial Root Finder program that finds the roots of a polynomial of order 2 through 5 with real coefficients. It barely fits the available memory. Can this be adapted to the 32S?
Yes, it can! Fortunately the 32S has six more bytes of user memory, allowing the necessary tweaks. There are only two small changes required, so I won't list the whole program here, which can be typed in from the 32SII manual. (Note that even without changes the checksums are not compatible between the 32S and 32SII.) (1) Replace Code: S03 250 Code: S03 16 The 32SII can store integers 0..254 in a short 1.5-byte instruction. The 32S only does this for 0..99. The number 250 would take 9.5 bytes, and the program would exceed the available user memory. The number is the initial guess for SOLVE, so the exact value doesn't matter here. 16² = 256 is close enough to 250. (2) Replace Code: Q10 R↑ Code: Q10 R↓ The 32S simply does not have R↑. Three times R↓ is equivalent. With those changes, the 32S checksums are: Code: LBL P 004.5 CHKSUM=91A0 When you try the first example \(x^5 - x^4 - 101x^3 + 101x^2 + 100x - 100 = 0\), be aware that the 32S will present the roots in a different order. This is due to SOLVE finding a different root first. I checked, and the implementations of SOLVE on the 15C, 32S, and 32SII all behave slightly differently. The best calculator is the one you actually use. |
|||
11-21-2024, 11:35 AM
Post: #2
|
|||
|
|||
RE: (32S) Polynomial Root Finder from 32SII manual
(11-20-2024 01:56 PM)naddy Wrote: (1) Replace Very nice ! Quote:When you try the first example \(x^5 - x^4 - 101x^3 + 101x^2 + 100x - 100 = 0\), be aware that the 32S will present the roots in a different order. This is due to SOLVE finding a different root first. I checked, and the implementations of SOLVE on the 15C, 32S, and 32SII all behave slightly differently. I didn't recall it but indeed the 32SII and 32S SOLVE work differently. Using the same initial guesses -250 and 250 for the example \(x^5 - x^4 - 101x^3 + 101x^2 + 100x - 100 = 0\), the 32S solver finds the root 10 (exactly) after several iterations, whereas the 32SII finds the root 1 almost immediately (probably by chance), but with a medium accuracy (0.999999998734) due to the multiplicity of this root. I will comment more on SOLVE differences in an other thread to come. J-F |
|||
11-21-2024, 05:01 PM
(This post was last modified: 11-21-2024 05:01 PM by Albert Chan.)
Post: #3
|
|||
|
|||
RE: (32S) Polynomial Root Finder from 32SII manual
(11-21-2024 11:35 AM)J-F Garnier Wrote: Using the same initial guesses -250 and 250 for the example \(x^5 - x^4 - 101x^3 + 101x^2 + 100x - 100 = 0\), the 32S solver finds the root 10 (exactly) after several iterations, whereas the 32SII finds the root 1 almost immediately (probably by chance), but with a medium accuracy (0.999999998734) due to the multiplicity of this root. The guesses were ±b, where b=256 originally, 250 with this patch. Guess is so huge, f(±b) ≈ (±b)^5 - (±b)^4 = b^4 * (±b - 1) --> Secant line is f(x) ≈ b^4 * (x - 1) f(x) ≈ 0 --> x ≈ 1, which suggested HP 32SII does secant root on 1st try. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)