I am having trouble understanding how to approximate the solution to this problem using the Ritz method and the weak form:

$$\frac{d^2u}{dx^2} - u=0; \ \ x \in [0,1]$$ $$u(x=0)=0; \ \ \frac{du}{dx} \bigg|_{x=1} = 20$$

We multiply the strong form of the equation by a weight function $w$ and integrate over the domain by parts to get

$$ \int_0^1w\left[\frac{d^2u}{dx^2} - u \right] dx = \int_0^1 w \frac{d^2 u}{dx^2} dx - \int_0^1wu \ dx$$

$$\int_0^1 \frac{du}{dx} \frac{dw}{dx} dx - \int_0^1 wu \ dx - 20 w(1) = 0$$

which is the weak form. Now, I am confused because when I try to change this into a matrix equation, I practically try to solve

$$\int_0^1 \frac{du}{dx} \frac{dw}{dx} dx = \int_0^1 wu \ dx + 20 w(1) $$

If I try to use, say $$u\approx\hat{u}=a_1 \phi_1 + a_2 \phi_2$$

I should be able to form a linear problem $$\mathbf{K} \vec{a} = \vec{b}$$

where $\mathbf{K}$ is a $2 \times 2$ matrix obtained from the left hand side of the equation where $w \to \phi_i$ and $u \to \phi_j$ to get the entries $K_{ij}$, but this substitution would not work to obtain the components of $\vec{b}$ since I this substitution gives me terms of $\phi_i$ and $\phi_j$ and this makes no sense since $\vec{b}$ is indexed only by one subindex. I know I am not understanding something, but this was my professor's explanation and I am confused.

Thank you so much for your help!


1 Answer 1


Everything in your OP looks correct.

I think you have just got into a muddle with the notation, and what is known and what is unknown.

$\phi_1$ and $\phi_2$ are known functions, i.e. you choose two sensible functions for the problem you want to solve, to give a "good" approximation to the solution you expect.

You can differentiate them with respect to $x$. Let $\dfrac{d\phi_i}{dx} = \phi'_i$.

If you let $w = \phi_1$, your integral equation becomes $$\int_0^1 (a_1 \phi'_1 + a_2 \phi'_2)\phi'_1\,dx - \int_0^1(a_1\phi_1 + a_2\phi_2)\phi_1\,dx = 20 \phi_1(1).$$ You can evaluate the integrals $\int\phi_1^2$, $\int \phi_2\phi_1$, $\int {\phi'_1}^2$, and $\int \phi'_2\phi'_1$ (either analytically or numerically) since the functions $\phi_i$ and $\phi'_i$ are known.

You then get an equation of the form $$K_{11} a_1 + K_{12} a_2 = b_1$$ where you know the $K$ and $b$ terms.

Similarly letting $w = \phi_2$ gives you the equation $$K_{21} a_1 + K_{22} a_2 = b_2.$$

These are the two rows of the matrix equation $\mathbf{K}\vec a = \vec b$.

  • $\begingroup$ Oh I see how it works now! I was very confused with my professor's notes. Thank you so much! $\endgroup$
    – The Bosco
    Commented Feb 12, 2020 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.