- #1
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)?
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: