Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to force Det to do itself in a certain way?

I've been running the same notebook on 2 differents computer, one MacOSX Lion and one W7 (both 32bit) with Mathematica on the two of them, and we don't get the same Det expression and Solve[Det[F[x]]==0,x] doesn't give the same solutions either.

How to know which one says the truth? How could we calculate the Det in order the have the same solutions on both computers?
Note: as its the same nb the matrices (26*26) are exactly the same.

share|improve this question
Please post the matrices. Are these symbolic matrices? Numerical ones? Do they have exact or inexact numbers? If inexact, machine precision or arbitrary precision? There are so many different variables that it'll be impossible to say anything unless you either post the matrix, or even better: post a small program to generate the matrix (the definition of F, I assume). – Szabolcs Jun 4 '12 at 13:58
I think you posted a now deleted Q with numerically unstable functions – Dr. belisarius Jun 4 '12 at 14:12
Now its "better" -> more stable. They are completely inexact, calculated before with some long lines so all I can give is the complete nb (there is no way to generate the matrices in a few lines). Here is the nb: Note the last Outputs: the answer it gives me – Öskå Jun 4 '12 at 14:49
up vote 2 down vote accepted

Are the relevant lines

PulsProp[\[Omega]_, N0_] = Simplify[Det[matK - (\[Omega]^2)*matM]]


test = Solve[PulsProp[\[Omega], 5000] == 0 && \[Omega] > 0, \[Omega]]?

If yes, you might get a much more stable behavior by noting that $\omega^2$ are in fact the generalized eigenvalues

\[Omega]2 = Eigenvalues[{matK, matM}]

where you can select the positive ones

test = (\[Omega] -> #) /@ Sqrt@Select[\[Omega]2, PositiveQ].

share|improve this answer
Simplify[Det[matK - (\[Omega]^2)*matM]] is the matter. The two lines you are talking about are relevant in order to calculate the roots of the det, which is supposed to give frequencies (omega/2Pi). Thus the matM is not "perfectly" diagonal, I don't remember my math courses very well then I can't judge if the eigenvalues gives the wanted solutions. What makes me doubt is that the Plot[Det[]==0,..] gives me Omega = 3,xxxx, which is not given by your solutions. Which one is good? – Öskå Jun 4 '12 at 17:31
I think you got it right, I've tried with nmax=1 on the nb & it find the same result with Det==0 & with Eigenvalues[]. But I still don't get what does Eigenvalues[{matK,matM}] do (!), and then why can we tell that the Eigenvalues, calculated god knows how, give me the right solutions? Because matM is bi-diagonal? – Öskå Jun 5 '12 at 8:33
@Öskå: Eigenvalues[{A,B}] solves the problem $\det(A - \lambda B)=0$ for $\lambda$; however in a numerically stable version unlike writing down the polynomial equation for $\lambda$ and then solving it... – Fabian Jun 5 '12 at 11:53
Thanks a lot, it solves everything! :) – Öskå Jun 5 '12 at 13:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.