# An example of a BVP for a second order ODE: $y''+p(x)y'+q(x)y=f(x)$ (where $\,0\leq x\leq L\,$ and $\,y(0)=\alpha\,$ $\,y(L)=\beta$)

I'm looking for an explicit example of a BVP for a second order ODE:

$y''+p(x)y'+q(x)y=f(x)$ (where $\,0\leq x\leq L\,$ and $\,y(0)=\alpha\,$ $\,y(L)=\beta$).

If you also have the exact solution, the better. The reason is for test purposes, I've just finished a Mathematica program to solve it (via cubic B-Splines in multiple nodes) and I want to try it! Thank you in advance!

## 2 Answers

At the very least, your code should reproduce the case with $p(x)=0$, $q(x)=0$ and $f(x)=0$. In that case, the solution is simply $$y(x)=\frac{\beta-\alpha}{L}x+\alpha$$

Next consider second order ODE with constant coefficients such as the one below $$y''(x)-4y'+3y=0$$ whose solution is $y(x)=c_{1}e^{-x}+c_{2}e^{-3x}$.

As a third test, relax the assumption of constant coefficient and try the Euler Cauchy ODE. An example is below: $$x^2y''-9xy'+25y=0$$ with solution $y(x)=c_1x^5+c_2\ln|x|x^5$.

As a final test, you can consider the following ODE which can be solved via the variation of parameters: $$x^2y''-3xy'+4y=x^2\ln(x)$$ with solution $$y(x)=c_1x^2+c_2x^2\ln(x)+\frac{1}{6}x^2\ln(x)^3$$

In all these, choose a suitable value of $\alpha$ and $\beta$ to find $c_{1}$ and $c_{2}$.

The function $y(x,t) := \exp\big(tx(x-L)\big)$ solves $y'' - \frac{x(x-L)}{2} y' -\frac{x^2(x-L)^2}{2} y = 0$, $y(0,t) = 1 = y(L,t)$.