S.O.S. Mathematics CyberBoard

Your Resource for mathematics help on the web!
It is currently Mon, 20 May 2013 13:38:22 UTC

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: 100% Robust Cubic Equation Solver
PostPosted: Wed, 31 Aug 2011 22:38:28 UTC 
Offline
S.O.S. Newbie

Joined: Wed, 31 Aug 2011 22:27:30 UTC
Posts: 1
Hi all,

I need to write an algorithm which finds the real roots to a cubic equation.

I am applying a cubic equation of state to a chemical engineering problem, and a specific cubic equation needs to be solved thousands of times over the course of one routine.

Therefore it needs to be COMPLETELY robust, and here's where my problem lies.

It seems analytical methods are prone to errors due to the floating point precision of computers, and I am tending towards several numerical approximation methods (Newton-Raphson, Halley's method, Brent's Method). The problems are:

Newton-Raphson / Halley's - Not sure whether these will be guaranteed to converge, they may diverge if the initial guess is not good enough (which it may well not be)

Brent's Method - although convergence is guaranteed, I am unsure of how to bracket the roots and whether it will be affected by the presence of complex roots.

ANy help or pointers much appreciated. As I say I am not simply trying to solve a cubic equation (fairly easy) but write a code which will NEVER fail no matter what values are used. Thanks.


Top
 Profile  
 
 Post subject: Re: 100% Robust Cubic Equation Solver
PostPosted: Thu, 1 Sep 2011 05:28:39 UTC 
Online
Moderator
User avatar

Joined: Mon, 29 Dec 2008 17:49:32 UTC
Posts: 6005
Location: 127.0.0.1, ::1 (avatar courtesy of UDN)
adw07 wrote:
Hi all,

I need to write an algorithm which finds the real roots to a cubic equation.

I am applying a cubic equation of state to a chemical engineering problem, and a specific cubic equation needs to be solved thousands of times over the course of one routine.

Therefore it needs to be COMPLETELY robust, and here's where my problem lies.

It seems analytical methods are prone to errors due to the floating point precision of computers, and I am tending towards several numerical approximation methods (Newton-Raphson, Halley's method, Brent's Method). The problems are:

Newton-Raphson / Halley's - Not sure whether these will be guaranteed to converge, they may diverge if the initial guess is not good enough (which it may well not be)

Brent's Method - although convergence is guaranteed, I am unsure of how to bracket the roots and whether it will be affected by the presence of complex roots.

ANy help or pointers much appreciated. As I say I am not simply trying to solve a cubic equation (fairly easy) but write a code which will NEVER fail no matter what values are used. Thanks.


If you want it to be completely robust, you need to split it into cases. For real coefficients, at the very least you will have three cases to consider, according to the sign of the discriminant, and make sure you avoid subtracting nearly equal quantities in the intermediate calculations.

_________________
\begin{aligned}
Spin(1)&=O(1)=\mathbb{Z}/2&\quad&\text{and}\\
Spin(2)&=U(1)=SO(2)&&\text{are obvious}\\
Spin(3)&=Sp(1)=SU(2)&&\text{by }q\mapsto(\mathop{\mathrm{Im}}\mathbb{H}\ni p\mapsto qp\bar{q})\\
Spin(4)&=Sp(1)\times Sp(1)&&\text{by }(q_1,q_2)\mapsto(\mathbb{H}\ni p\mapsto q_1p\bar{q_2})\\
Spin(5)&=Sp(2)&&\text{by }\mathbb{HP}^1\cong S^4_{round}\hookrightarrow\mathbb{R}^5\\
Spin(6)&=SU(4)&&\text{by the irrep }\Lambda_+\mathbb{C}^4
\end{aligned}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Contact Us | S.O.S. Mathematics Homepage
Privacy Statement | Search the "old" CyberBoard

users online during the last hour
Powered by phpBB © 2001, 2005-2011 phpBB Group.
Copyright © 1999-2013 MathMedics, LLC. All rights reserved.
Math Medics, LLC. - P.O. Box 12395 - El Paso TX 79913 - USA