|
-
Jul 11th, 2010, 01:29 PM
#1
Thread Starter
Lively Member
[RESOLVED] Solve a cubic polynomial
Sounds easy, but I can't quite do it reliably on the computer.
I'm using what I think is the Cardini algorithm. It first converts to the depressed form, then chooses one of 3 options depending on if some expression is <0, =0 or >0.
Problem is it's hard to do floating point comparisons safely, so some of my equations are ending up with the wrong number of solutions.
Is there a robust way to do it?
Oh, also I only need real solutions. Complex solutions should become 0. This also worries me a bit. I have a feeling rounding errors might cause a solution to have a very tiny imaginary component, then when I set it to zero I lose the entire real component.
Last edited by Kallog; Jul 23rd, 2010 at 05:09 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|