Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: numerical roots of a polynomial

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1194] Re: numerical roots of a polynomial
  • From: withoff (David Withoff)
  • Date: Mon, 22 May 1995 02:42:48 -0400
  • Organization: Wolfram Research, Inc.

In article <3pjkiu$7h0 at news0.cybernetics.net> Sigurd.Schelstraete at rug.ac.be (Sigurd Schelstraete) writes:
>hello,
>
>does anyone know if there exists a package/function that allows one to find 
>(numerically) all n roots of a polynomial of degree n, whether they are 
>real or not? Since NSolve seems to be equivalent to N[Solve], it can not 
>be used for generic polynomials of fifth degree or higher. Also the 
>function FindRoot only allows one to find a single root near a given 
>starting value (which can be complex though).
>
>What I would like, is a function that returns the numerical values of all 
>n roots as a list of substitution rules, as does Solve or NSolve. 
>
>I guess it could be done by successively dividing out a single root found 
>with FindRoot, but I'd rather first hear if anyone out there already has 
>a clear-cut solution to this problem. 
>
>All answers are appreciated.
>
>Greetings,
>
>Sigurd Schelstraete
>University of Gent
>Belgium 

Will NRoots do what you want?

The NSolve function is defined in terms of Solve in the startup
package NSolve.m, so you can look in the package to find the exact
relationship between NSolve[...] and N[Solve[...]].  NRoots is
the N-code (the code called to evaluate N[Roots[...]]) for Roots,
which is in turn called by Solve.

In[1]:= On[Roots]

In[2]:= sol = Solve[x^7 - x^5 + x^3 + x^2 - 1 == 0, x]

                       7    5      3      2
Roots::trace: Roots[1 x  - x  + 1 x  + 1 x  == 1, x] --> 
           2    3    5    7
    Roots[x  + x  - x  + x  == 1, x].

                        2    3    5    7
Out[2]= {ToRules[Roots[x  + x  - x  + x  == 1, x]]}

In[3]:= N[sol]

Out[3]= {{x -> -0.975995 - 0.3389 I}, {x -> -0.975995 + 0.3389 I}, 
 
>    {x -> -0.36948 - 0.860376 I}, {x -> -0.36948 + 0.860376 I}, 
 
>    {x -> 0.78954}, {x -> 0.950705 - 0.670453 I}, 
 
>    {x -> 0.950705 + 0.670453 I}}

Dave Withoff
Research and Development
Wolfram Research



  • Prev by Date: Mathematica
  • Next by Date: Markov/Birth-Death
  • Previous by thread: numerical roots of a polynomial
  • Next by thread: Re: numerical roots of a polynomial