MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: cubic polynomial

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22668] Re: [mg22646] cubic polynomial
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sat, 18 Mar 2000 01:27:44 -0500 (EST)
  • References: <200003161411.JAA10248@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"E.Carletti1" wrote:
> 
> I have a problem: I want to solve this equation:
> 
> x^3+(3c-1)(x^2)-4cx-4(c^2)=0 with respect to x.
> 
> It has to have a real solution because it is continuous
> in x. c is a positive parameter.
> If i solve it numerically, plugging numbers for c, then it is fine. But
> I would like an analytical solution: in this case i get only one
> solution which should give me a real value for x (the other two are
> imaginary) but
> it has a square root with all negative members (all terms with c, which
> is positive, with a sign - in front of it, so immaginary). How is that
> possible? What procedure does mathematica use to solve cubic expression?

For a problem such as this where no factoring or other simplification is
possible, Mathematica uses a variation of the Cardano method that is
appropriate for arbitrary (possibly complex-valued) coefficients. This
method will give solutions that contain Sqrt[-1] even though some or all
values may be real. This is known as the "casus irreducibilus", in that
it is mathematically impossible to present a solution in terms of
radicals that avoids Sqrt[-1]. If we do not have an FAQ about this then
probably we should. I'm speaking on behalf of myself here, not Wolfram
Research, because I seem to answer this question periodically (I used to
keep a bookmark for it in my copy of Van der Waerden's "Algebra").

On the off-chance that some hapless reader might want to see my write-up
of an elementary derivation of the radical solution for cubics, check
the notebook at:

http://library.wolfram.com/conferences/conference98/abstracts/various_ways_to_tackle_algebraic_equations.html

While I'm on this tangent let me point out that at the URL

http://library.wolfram.com/conferences/conference98/

there is a wealth of excellent material regarding many facets of
Mathematica use.


> How can I express the expression in a nicer way to get rid of these
> negative terms? My feeling is that the programm is not able to simplify
> the expression for the solution.
> Could you please help me? if I write the expression I find in the paper
> I am writing, noone will believe it is real!

This may be the sort of thing you seek. Force Roots to avoid the Cardano
method and instead use Root[] objects. For an odd-degree equation with
real coefficients, the first one is guaranteed to be real-valued.

In[10]:= sol = First[ Roots[x^3+(3*c-1)*x^2-4*c*x-4*c^2==0, x,
Cubics->False]]

                       2              2         2     3
Out[10]= x == Root[-4 c  - 4 c #1 - #1  + 3 c #1  + #1  & , 1]

In[12]:= Table[N[sol], {c,-10,10}]

Out[12]= {x == 30.1128, x == 27.113, x == 24.1132, x == 21.1135, 
>    x == 18.1139, x == 15.1145, x == 12.1154, x == 9.11688, x == 6.12, 
>    x == 3.1304, x == 0., x == -2.90321, x == -5.89655, x == -8.89412, 
>    x == -11.8929, x == -14.8921, x == -17.8916, x == -20.8912, 
>    x == -23.8909, x == -26.8907, x == -29.8905}


> And even more funny, if I plug number into the solution I find for x, it
> comes the same number as I plug numbers directly into the function I
> want to solve, except for the last part which is an imaginary number
> which shoult tend to zero.
> What is going on?

If I understand correctly you plugged in approximate values, say c->1.7,
and observed tiny "imaginary parts" in the resulting approximation. This
is numerical arithmetic at work; quantities that cancel exactly may or
may not cancel when numerical evaluation is performed. Again, a fact of
mathematics and not peculiar to Mathematica. I think the best way around
this is to use the Root[] type of solution. If for some reason that will
not do then just use Re[] or Chop[] to get rid of the numerical
artifacts.


> Thank your for your help
> 
> Elena Carletti
> Financial Markets Group
> LSE
> Houghton Street
> London WC2A 2AE
> 
> Tel. 0044 (0)20 7955 7896
> Fax 0044 (0) 20 7242 1006


Daniel Lichtblau
Wolfram Research


  • Prev by Date: RE: cubic polynomial
  • Next by Date: Re: cubic polynomial
  • Previous by thread: Re: cubic polynomial
  • Next by thread: Re: cubic polynomial