Article View: sci.math.num-analysis
Article #362Re: Solutions to quartic and cubic eqns.
From: Jonathan Thornburg
Date: Thu, 27 Aug 1992 17:55
Date: Thu, 27 Aug 1992 17:55
44 lines
2851 bytes
2851 bytes
In article <1992Aug25.161234.13275@magnus.acs.ohio-state.edu>
kiyer@magnus.acs.ohio-state.edu (Karthik A Iyer) writes:
> I am looking for a routine(s) or a place where I can find
>them (FTP sites, etc) to solve quartic and cubic eqations. I realize that
>analytic solutions exist, but my problem is that the coefficients of the
>powers vary by as much as 10-15 orders of magnitude. So, a small error is
>solving the for the cubic's root leads to large errors when that root is
>used to solve for the four roots of the quartic. Any help or leads would be
>appreciated. I would prefer to get my hands on a FORTRAN double precision
>routine. Thanks in advance,
Unfortunately, the "classical" closed-form analytical solutions
tend to be quite ill-conditioned, *especially* when the coefficients
are widely varying in magnitude.
I suspect you would get much more accurate results if you simply
used a good numerical zero-finding code to numerically locate the
(a) zero of your quartic/cubic. (Of course, you still have to be
able to *evaluate* the quartic/cubic, which is itself rather tricky
when the coefficients are so disparate in magnitude. But that's
still a much easier problem than trying to find the roots directly.)
An excellent zero-finding code is ZEROIN, available from netlib
via
echo 'send zeroin from fmm' | Mail netlib@ornl.gov
This will get you a Fortran subroutine with all the documentation
you need to use it. For more details, see either the (excellent,
superb, ++good, highly recommended) book
G. E. Forsythe, M. A. Malcolm, and C. B. Moler
"Computer Methods for Mathematical Computations"
Prentice-Hall, Englewood Cliffs, 1977
or section 9.3 of Numerical Recipes. Be warned, though, that the
code for ZEROIN given in Numerical Recipes (where it's called ZBRENT)
has been "improved", and is of somewhat lower quality than the
original one you'll get from netlib.
- Jonathan Thornburg
<jonathan@einstein.ph.utexas.edu> or <jonathan@hermes.chpc.utexas.edu>
University of Texas at Austin / Physics Dept / Center for Relativity
and (for a few more months) U of British Columbia / {Astronomy,Physics}
Technical Details
Message-ID:
<1992Aug27.175551.23486@chpc.utexas.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!jonathanReferences:
<1992Aug25.161234.13275@magnus.acs.ohio-state.edu>Show Full Headers
Complete Article Headers
Newsgroups: sci.math.num-analysis Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!jonathan From: jonathan@chpc.utexas.edu (Jonathan Thornburg) Subject: Re: Solutions to quartic and cubic eqns. Message-ID: <1992Aug27.175551.23486@chpc.utexas.edu> Summary: numerical zero-finding is probably more accurate, try ZEROIN Keywords: quartic cubic quadratic equation zero root ill-condition ZEROIN Sender: jonathan@einstein.ph.utexas.edu Organization: U of Texas at Austin / Physics Dept / Center for Relativity References: <1992Aug25.161234.13275@magnus.acs.ohio-state.edu> Date: Thu, 27 Aug 92 17:55:51 GMT Lines: 44