Graduate Solving an ODE Eigenvalue Problem via the Ritz method

Click For Summary
The discussion focuses on solving the eigenvalue problem defined by the differential equation u''(x) = -λu(x) with boundary conditions u(0) = u(1) = 0 using the Ritz method. The user outlines their approach, defining operators A and B, and deriving a variational formulation leading to an algebraic eigenvalue problem. They initially encounter issues with reconstructing the harmonics due to the scaling of eigenvectors. However, they later resolve the scaling problem independently. The thread highlights the effectiveness of the Ritz method in obtaining accurate eigenvalues that align with analytical solutions.
member 428835
Hi PF!

I want to solve ##u''(x) = -\lambda u(x) : u(0)=u(1)=0##. I know solutions are ##u(x) = \sin(\sqrt{\lambda} x):\lambda = (n\pi)^2##. I'm trying to solve via the Ritz method. Here's what I have:

define ##A(u)\equiv d^2_x u## and ##B(u)\equiv u##. Then in operator form we have ##A(u) = -\lambda B(u)##. Taking the inner product of this expression with ##u##, where ##(f,g) \equiv \int_0^1 fg##, yields

$$(A(u),u) = -\lambda(B(u),u).$$

A variational approach implies the solution is equivalent to solving

$$\min\left((A(u),u)\right) : (B(u),u) = 1.$$

Next make the series expansion

$$u = \sum_i\alpha_i\phi_i(x).$$

Optimizing via Lagrange multipliers with respect to ##\alpha##'s implies (details omitted but straightforward)

$$\sum_i(A_{ij} +\lambda B_{ij})\alpha_i = 0,\\
A_{ij} \equiv (A(\phi_i),\phi_j),\,B_{ij} \equiv (B(\phi_i),\phi_j).
$$

This is an algebraic eigenvalue problem and solutions are direct. To solve for each harmonic ##\sin(n\pi x)##, simply take ##\phi_n\cdot\alpha_n## where ##\alpha_n## is the ##n##th eigenvector and ##\phi_n## is a vector of the first ##n## ##\phi(x)##'s.

So, substituting ##\phi_i(x) = x^i(1-x)## into ##\sum_i(A_{ij} +\lambda B_{ij})\alpha_i = 0## and calculating eigenvectors should give me a good solution, but it's not. Any ideas what I'm doing wrong? I can supply my code if that helps (Mathematica).

Edit: this isn't HW, but perhaps it should go there? Could a Mentor please move this there (I tried but I don't know how to move this without copy-pasting, hence having a double thread)?
 
Last edited by a moderator:
Physics news on Phys.org
Update: my eigenvalues are very accurate, matching the analytic ones very well! However, when I reconstruct the harmonics (##\sin(\pi x),\sin(2\pi x),\sin(3\pi x)## etc) I require the ##n##th eigenvector, but the eigenvector is randomly scaled. Thus, the solution I obtain for the harmonics is not scaled properly. How do I determine the scaling?

Never mind, I figured it out!
 

Attachments

Last edited by a moderator:

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
5K