Solving an ODE Eigenvalue Problem via the Ritz method

Click For Summary
SUMMARY

The discussion focuses on solving the eigenvalue problem defined by the ordinary differential equation (ODE) u''(x) = -λu(x) with boundary conditions u(0)=u(1)=0 using the Ritz method. The user successfully formulates the problem in operator form and derives an algebraic eigenvalue problem. Although the eigenvalues match the analytical solutions accurately, the user encounters issues with the scaling of the eigenvectors when reconstructing the harmonics. Ultimately, the user resolves the scaling issue independently.

PREREQUISITES
  • Understanding of ordinary differential equations (ODEs)
  • Familiarity with the Ritz method for variational problems
  • Knowledge of eigenvalue problems and linear algebra
  • Proficiency in using Mathematica for numerical computations
NEXT STEPS
  • Explore advanced topics in variational methods for ODEs
  • Learn about scaling techniques in eigenvalue problems
  • Investigate the implementation of the Ritz method in Mathematica
  • Study the properties of orthogonal functions in relation to eigenvalue problems
USEFUL FOR

Mathematicians, physicists, and engineers interested in numerical methods for solving differential equations, particularly those utilizing the Ritz method and eigenvalue analysis.

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
2K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K