Solving for the roots of a cubic polynomial
|
07-02-2024, 07:57 PM
Post: #6
|
|||
|
|||
RE: Solving for the roots of a cubic polynomial
Hi, Namir
It is not zeros that caused the problem. You could even try x^3 = 0, and it still work. The problem is cube root of negative numbers. (note: all coefficients are real) Code seems to assume first cube root is always positive. 2nd cube root use flag 01 to get sign(x) * ³√|x| This is why y^3 - y/3 + 2/27 = 0 roots are 0 y1 = ³√(-1/27+0) + ³√(-1/27−0), mistakenly calculated as 1/3 - 1/3 = 0 We could reuse flag 01 for both cube roots, or do without. ³√(x) = sign(x) * ³√|x| Note: I only touched cube roots. (LINE 65 .. 71, copy/paste to LINE 76 .. 82) Code: 00 { 281-Byte Prgm } |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Solving for the roots of a cubic polynomial - Namir - 06-30-2024, 08:46 PM
RE: Solving for the roots of a cubic polynomial - Albert Chan - 06-30-2024, 11:49 PM
RE: Solving for the roots of a cubic polynomial - Namir - 07-01-2024, 04:13 AM
RE: Solving for the roots of a cubic polynomial - Albert Chan - 07-01-2024, 06:14 PM
RE: Solving for the roots of a cubic polynomial - Namir - 07-02-2024, 05:36 AM
RE: Solving for the roots of a cubic polynomial - Albert Chan - 07-02-2024 07:57 PM
RE: Solving for the roots of a cubic polynomial - Namir - 07-04-2024, 04:18 AM
RE: Solving for the roots of a cubic polynomial - floppy - 07-04-2024, 05:21 PM
|
User(s) browsing this thread: 1 Guest(s)