(12C Platinum) Cubic Equation
01-12-2019, 01:39 PM (This post was last modified: 11-16-2019 10:28 PM by Albert Chan.)
Post: #2
 Albert Chan Senior Member Posts: 1,839 Joined: Jul 2018
RE: (12C Platinum) Cubic Equation
Hi Gamo

It might be better if iteration formula is *not* simplified:

X(i+1)= Xi - (aXi^3 + bXi^2 + cXi + d) / (3aXi^2 + 2bXi + c)

Simplified form may introduce subtraction cancellation error on the *last* iteration.

BTW, Professor Kahan had a systemetic way to get a good guess X0:
https://apps.dtic.mil/dtic/tr/fulltext/u2/a206859.pdf, page 5

f(x) = x^3 - 4x^2 + 6x - 24
f(4/3) = -2.7475³, f'(4/3) = 2/3 ≥ 0
guess = 4/3 - (-1)(2.7475) = 4.0809
x = 4.0809 → 4.0023 → 4.0000

f(x) = -2x^3 + 3x^2 + 4x - 5
f(1/2)/-2 = 1.0772³, f'(1/2)/-2 = -1.6583² < 0
guess = 1/2 - 1.324718 (1) max(1.0772, 1.6583) = -1.6968
x = -1.6968 → -1.4145 → -1.3536 → -1.3508

Update:
if we need the other roots, Kahan's algorithm suggested this:
Deflate cubic to quadratic: a X² + e X + f = 0
IF |x³| > |d/a| THEN (f=-d/x, e=(f-c)/x) ELSE (e=ax+b, f=ex+c)
 « Next Oldest | Next Newest »

 Messages In This Thread (12C Platinum) Cubic Equation - Gamo - 01-12-2019, 09:27 AM RE: (12C Platinum) Cubic Equation - Albert Chan - 01-12-2019 01:39 PM RE: (12C Platinum) Cubic Equation - Albert Chan - 02-04-2019, 04:10 PM RE: (12C Platinum) Cubic Equation - Thomas Klemm - 02-04-2019, 08:13 PM RE: (12C Platinum) Cubic Equation - Albert Chan - 02-05-2019, 10:24 PM RE: (12C Platinum) Cubic Equation - Gamo - 02-05-2019, 04:24 AM RE: (12C Platinum) Cubic Equation - Thomas Klemm - 02-05-2019, 06:09 AM RE: (12C Platinum) Cubic Equation - Thomas Klemm - 02-05-2019, 06:20 AM

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