Problems with NSolve

*To*: mathgroup at smc.vnet.net*Subject*: [mg88144] Problems with NSolve*From*: kgwagh at gmail.com*Date*: Sat, 26 Apr 2008 03:43:51 -0400 (EDT)

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. Thanks, Kshitij.

**Follow-Ups**:**Re: Problems with NSolve***From:*Carl Woll <carlw@wolfram.com>