# Solving eigenvalue problems

• Mathematica

## Main Question or Discussion Point

Hi PF!

I have an eigenvalue problem $K = \lambda M$. Matrices $M,K$ are constructed via integrating combinations of basis functions (similar to a finite element method). The system is the size of the number of basis functions included: if we choose $3$, the first three basis functions, $M,K$ are $3\times 3$ matrices. In general if we choose the first $n$ basis functions, the system is an $N\times N$ system. So both matrices $M,K$ are dependent on $n$.

I'm solving this eigenvalue problem via the Eigensystem command, which looks like this

Code:
Eigensystem[{K[n], M[n]}]
I know the eigenvalues should converge to the analytic eigenvalues as we increase the resolution $n$. And that's exactly what happens...at first. The $ith$ eigenvalue converges closer and closer to its analytic value until I let $n>5$. When I change $n$ to 6 suddenly the eigenvalues are spurious, growing very large and diverging from their analytic values.

When troubleshooting, two things came to mind: 1) an integration error exists. 2) an error exists when solving the matrix system. No warning signs appear on the integration, so I think $M,K$ are well constructed (I am using NIntegrate with no further specifications on accuracy, etc). So perhaps there's an issue with solving the eigensystem?

Obviously one (inefficient) way to solve the system $K = \lambda M$ is to compute $M^{-1}$ and then take $\det (M^{-1} K) = 0$. For $n\leq 5$ when I compute the eigenvalues this method, Mathematica does not output any errors and the computed eigenvalues are close to their analytic values. However, when I increase $n=6$ suddenly Mathematica outputs the error message Inverse: Result for Inverse of badly conditioned matrix may contain significant numerical errors. Alongside this, the eigenvalues begin to diverge.

Does anyone have an idea what is going wrong? I thought Eigensystem was very robust; could this be the issue?

Last edited: