MathGroup Archive 2008

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

Search the Archive

Re: Problems with NSolve

  • To: mathgroup at
  • Subject: [mg88167] Re: [mg88144] Problems with NSolve
  • From: Carl Woll <carlw at>
  • Date: Sun, 27 Apr 2008 04:57:11 -0400 (EDT)
  • References: <>

kgwagh at wrote:

>Hi all
>I am trying to find the number of eigenvalue crossings for a matrix as
>a function of the parameter 'u', on which the elements of the
>(symmetric) matrix depend on linearly. The matrix elements also
>involve randomly chosen constants. The plan is to find the
>distribution of the crossings of these type of matrices as I scan over
>the random numbers.
>So far I have been using the following :
>NSolve[{chpoly[u, dim, \[Alpha], \[Gamma], \[Epsilon], x] == 0,
>  D[chpoly[u, dim, \[Alpha], \[Gamma], \[Epsilon], x], x] == 0}, {x,
>  u}, WorkingPrecision -> prec]
>where chpoly is the characteristic polynomial of the matrix (with the
>eigenvalue variable being x) and \alpha, \gamma and \epsilon are
>constant parameter arrays of random numbers. For a double (or higher)
>degeneracy of the eigenvalues both the characteristic equation and its
>derivative should be zero. This approach has worked successfully only
>upto 12*12 matrices (where one such computation takes 40 secs on my
>laptop). For 13*13 my laptop takes 4000 sec. This seems to be somewhat
>surprising, because these polynomials are of the order 'n'  (where n
>is dimension of the matrix) in both u and x - and  n=13 does not sound
>very computationally unreasonable.  So I was wondering if there was a
>faster approach I could take.
>Also, the problem essentially entails me to know the number (not the
>values) of the real solutions to this system of polynomials.
>CountRoots seemed ideal but it does not work for more than one
>equation. So is there any alternative along this route?
>Any other alternatives are also welcome.
I would find it helpful if you specified what chpoly, \[Alpha] etc were 
to help diagnose you're problem. However, it seems you are coming across 
an issue described in the following thread:

I believe there are other threads that discuss this issue as well, but I 
couldn't find them in a quick search.

Carl Woll
Wolfram Research

  • Prev by Date: Re: Problems with NSolve
  • Next by Date: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)
  • Previous by thread: Problems with NSolve
  • Next by thread: Re: Problems with NSolve