I'm trying to determine if the roots of a function are real. How would you do that?
(In particular I'm interested in verifying that the roots of LegendreP[6, x] are real.)
|
I'm trying to determine if the roots of a function are real. How would you do that? (In particular I'm interested in verifying that the roots of |
||||
|
This question is not trivial as it would seem and a detailed discussion could help to understand the issue, especially when we deal with roots of special functions, however to do the task as simply as possible this would be the best way :
This way is good enough, because one can easily verify that
Edit There are many ways to find only real roots of a polynomial
however a method above based on
Selecting only real roots yields the same number of roots
To elaborate a bit, let's try the other methods e.g.
here we show e.g.
As one can see the output does not seem apparently real just as in case of writing the output of
One way to assure that roots are only real would be applying
we can apply
If we assume directly only real solutions to be found with
Now it'll be enlightening to plot the roots :
and to show the relevant structure of real and imaginary parts of
The option |
||||
|
|
|
I might as well. There is a method that works only for polynomials, but this works for checking if all the roots of a polynomial are real. The method is based on work by Miroslav Fiedler and Gerhard Schmeisser. Briefly, the method constructs (or tries to construct) a tridiagonal companion matrix from your polynomial (i.e. a tridiagonal matrix whose characteristic polynomial is your given polynomial) using a modification of the Euclidean algorithm. On the other hand, even if you do not want the eigenvalues of this special tridiagonal matrix, the entries afford some diagnostic capabilities for checking if your polynomial has all its roots real. Here's how to build the diagonal and one of the off-diagonals:
The result needed is this: if all the entries of the off-diagonal
If you want to see the actual roots themselves,
or alternatively, Compare:
|
|||
|
|
If you are only interested in roots of
The part of its proof you are interested in - which is the fact that all roots are real - makes use of Sturmian sequences, so perhaps you might want to try playing around with them. |
||||
x /. {ToRules[Reduce[LegendreP[6, x] == 0, x]]}. Then we mapImto each root usingMap[Im,%], which gives{0,0,0,0,0,0}. This seems to suggest that the roots are real, but I am not 100% sure. – Michael Wijaya Jun 13 '12 at 8:02