# Determinant of Characterisitic Polynomial

1. Jan 24, 2014

### azuresky101

I'm doing a calculation which finds the characteristic polynomial of a matrix, HH, with rather complex entries and then determines the discriminant of that polynomial. For smaller matrices up to around 7x7 it finishes evaluating the Discriminant command within a few hours, but at a 10x10, which is what I need, it takes days to evaluate. Running in parallel won't work for the built in Discriminant command. I was wondering if there was a more efficient way to evaluate the discriminant of high-order polynomial, as I know my code is basic.

CPHH = Collect[CharacteristicPolynomial[HH, x],x]];
DD = Discriminant[CPHH, x, Method -> SylvesterMatrix];
Simplify[DD, TimeConstraint -> Infinity]

If the rest of the code would be useful in determining a solution I'd be happy to post it

***Meant Discriminant in Title***

2. Jan 24, 2014

### gsal

Well, I have not had to do Matlab nor linear algebra since grad school (a couple of decades ago), so, I had to look up what Characteristic Polynomial is...I just saw a video in YouTube where the prof solved the Char. Poly for a 3x3 matrix in a few minutes....does it really take a few hours to solve a 7x7 in matlab?...I feel like I could solve it by hand in less than one!

What do you mean by "rather complex entries"?

Back then, matlab was not faster than a C or Fortran program; lately, I have seen postings in forums that seem to indicate that that continues to be the case...maybe you should write your own program to solve this.

3. Jan 24, 2014

### azuresky101

Finding the characteristic polynomial takes seconds in mathematica. Its evaluating the discriminant of that polynomial that takes so long.

A typical entry in the 21x21 looks like this 1/2 h (61 h k1 - 159 h k2 - 14 g Hz uB). I forgot the particle is spin 10 so the hamiltonian is 21x21, not 10x10 like I said earlier.

Unfortunately it's required of me to use mathematica, as that is what everyone in the research group uses.

4. Jan 24, 2014

### gsal

Oh, so it is mathematica and not matlab...same problem, I don't use either.

I looked up Discriminant of a Polynomial, now...I see that they can get pretty lengthy and you seem to be using non-numeric entries which I presume makes things more time consuming.

Anyway, good luck, I am afraid I can't help.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook