Is Mathematica the best option to compute the eigenvalues?

Click For Summary

Discussion Overview

The discussion revolves around the best computational tool for calculating eigenvalues of a complex determinant involving trigonometric functions. Participants are exploring options between Mathematica and Matlab, particularly in the context of a specific mathematical problem related to wave equations.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested

Main Points Raised

  • One participant questions whether Mathematica is the best option for computing eigenvalues for a specific determinant involving sine and cosine functions.
  • Another participant provides an example of how to compute eigenvalues in Mathematica, noting that the output is a vector of expressions, which may be complex.
  • A different participant expresses confusion over the output received when attempting to use the provided Mathematica code, suggesting there may be an issue with their implementation.
  • One participant clarifies a misunderstanding between WolframAlpha and WolframMathematica, indicating a realization that may affect their approach.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best computational tool, as there are differing opinions on the effectiveness of Mathematica versus Matlab for this specific task. The discussion remains unresolved regarding the optimal choice for computing eigenvalues.

Contextual Notes

Some participants express uncertainty about the outputs generated by Mathematica, indicating potential issues with code implementation or understanding of the software's functionality.

JD_PM
Messages
1,125
Reaction score
156
TL;DR
I am wondering what's the best option to compute the eigenvalues for such a determinant
I am wondering what's the best option to compute the eigenvalues for such a determinant$$\begin{vmatrix}
\sin \Big( n \frac{\omega}{v_1} \theta \Big) & \cos \Big( n \frac{\omega}{v_1} \theta \Big) & 0 & 0 \\
0 & 0 & \sin \Big( n \frac{\omega}{v_2} (2 \pi - \theta) \Big) & \cos \Big( n \frac{\omega}{v_2} (2 \pi - \theta) \Big) \\
\sin \Big( n \frac{\omega}{v_1} \pi \Big) & \cos \Big( n \frac{\omega}{v_1} \pi \Big) & -\sin \Big( n \frac{\omega}{v_2} \pi \Big) & -\cos \Big( n \frac{\omega}{v_2} \pi \Big) \\
\frac{n}{v_1} \cos \Big( n \frac{\omega}{v_1} \pi \Big) & -\frac{n}{v_1} \sin \Big( n \frac{\omega}{v_1} \pi \Big) & \frac{n}{v_2} \cos \Big( n \frac{\omega}{v_2} \pi \Big) & -n\frac{B_2}{v_2} \sin \Big( n \frac{\omega}{v_2} \pi \Big) \\
\end{vmatrix} = 0$$Where ##L = R \theta## and L and R are known.

I was looking at mathematica:

https://reference.wolfram.com/language/tutorial/EigenvaluesAndEigenvectors.html

But the examples they show are much more simpler than the one I am dealing with,

Should I use Matlab instead?

Any suggestion is appreciated.

If you are interested from where is this coming from check this out: https://math.stackexchange.com/ques...osed-loop?noredirect=1#comment7161084_3482613
 
Physics news on Phys.org
Let's suppose, just as an experiment, you wanted the eigenvalues of a matrix

Code:
Eigenvalues[{{Sin[n w/v1 t],Cos[n w/v1 t],0,0},
{0,0,Sin[n w/v2(2Pi-t)],Cos[n w/v2(2Pi-t)]},
{Sin[n w/v1 Pi],Cos[n w/v1 Pi],-Sin[n w/v2 Pi],-Cos[n w/v2 Pi]},
{n/v1 Cos[n w/v1 Pi],-n/v1 Sin[n w/v1 Pi],n/v2 Cos[n w/v2 Pi],-n b2/v2 Sin[n w/v2 Pi]}}]

Then Mathematica would respond with a vector of four expressions, the first expression is

Code:
Root[-(n*v1^4*v2^3*Sin[(n*Pi*w)/v1 - (n*t*w)/v1 - (n*Pi*w)/v2 - (n*(2*Pi - t)*w)/v2]) + b2*n*v1^4*v2^3*
  Sin[(n*Pi*w)/v1 - (n*t*w)/v1 - (n*Pi*w)/v2 - (n*(2*Pi - t)*w)/v2] - n*v1^4*v2^3*Sin[(n*Pi*w)/v1 -
  (n*t*w)/v1 + (n*Pi*w)/v2 - (n*(2*Pi - t)*w)/v2] - b2*n*v1^4*v2^3*Sin[(n*Pi*w)/v1 - (n*t*w)/v1 +
  (n*Pi*w)/v2 - (n*(2*Pi - t)*w)/v2] - 2*n*v1^3*v2^4*Sin[(n*Pi*w)/v1 - (n*t*w)/v1 + (n*Pi*w)/v2 -
  (n*(2*Pi - t)*w)/v2] - n*v1^4*v2^3*Sin[(n*Pi*w)/v1 - (n*t*w)/v1 - (n*Pi*w)/v2 + (n*(2*Pi - t)*w)/v2] -
  b2*n*v1^4*v2^3*Sin[(n*Pi*w)/v1 - (n*t*w)/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4*#1^4 & , 1]/(v1*v2),

The remaining three expressions are similar to the first.

You can look up Root in the help system to see what that is. Usually Root[expr] is more compact than the expanded analytic expression, if one is even available.
 
  • Like
Likes   Reactions: JD_PM
Bill Simpson said:
Let's suppose, just as an experiment, you wanted the eigenvalues of a matrix

Thanks for your reply.

I've been trying to compute the eigenvalues but there's something going wrong. I've copied/pasted the code you provided and I got a wrong output.

Screenshot (964).png


But you indeed got a good output.

What am I missing?
 
OK I confused WolframAlpha with WolframMathematica.

Now it is clear.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
2
Views
2K