This is a PDE taken from a Maple document. Mathematica DSolve currently unable to solve it.
I wanted to verify Maple solution using NDSolve. This is string of length 1, fixed on the left, and free to move on the right. Given an initial position and let go.
Here is the specs of the PDE
Solve for $0<x<1, t>0$ the wave PDE $$ -u_{tt} + u(x,t)= u_{xx} + 2 e^{-t} \left( x - \frac{1}{2} x^2 + \frac{1}{2} t - 1 \right) $$
With boundary condition
\begin{align*} u(0,t) &= 0 \\ \frac{\partial u(1,t)}{\partial x} &= 0 \end{align*}
And initial conditions
\begin{align*} u(x,0) &= x^2-2 x \\ u(x,1)&= u\left(x,\frac{1}{2}\right) + e^{-1} \left( \frac{1}{2} x^2-x\right) - \left( \frac{3}{4} x^2- \frac{3}{2}x \right) e^{\frac{-1}{2}} \end{align*}
The tricky part in this, is that no initial velocity is given. But only initial position at $t=0$, and then a relation on the solution at 2 different times is give instead.
NDSolve
complain with that dreaded error
Boundary condition is not specified on a single edge of the boundary of the computational domain.
And I do not know how to get rid of it. Here is the code
ClearAll[u, x, t];
pde = -D[u[x, t], {t, 2}] + u[x, t] ==
D[u[x, t], {x, 2}] + 2*Exp[-t]*(x - (1/2)*x^2 + (1/2)*t - 1);
bc = {u[0, t] == 0, Derivative[1, 0][u][1, t] == 0};
ic = {u[x, 0] == x^2 - 2*x,
u[x, 1] == u[x, 1/2] + ((1/2)*x^2 - x)*Exp[-1] - ((3*x^2)/4 - (3/2)*x)* Exp[-2^(-1)]};
sol = NDSolve[{pde, ic, bc}, u, {x, 0, 1}, {t, 0, 1}]
Here is the Maple code and the analytical solution it gives
pde := -diff(u(x, t), t, t) + u(x, t) =
diff(u(x, t), x, x)+ 2*exp(-t)*(x-(1/2)*x^2+(1/2)*t-1);
ic := u(x, 0) = x^2-2*x,
u(x, 1) = u(x, 1/2)+((1/2)*x^2-x)*exp(-1)-(3/4*(x^2)-3/2*x)*exp(-1/2);
bc := u(0, t) = 0, eval(diff(u(x, t), x), {x = 1}) = 0;
pdsolve([pde, ic, bc],u(x,t))
$$ u(x,t) = -\frac{e^{-t}}{2} (x^2-2 x) (t-2) $$
Here is animation of Maple solution, which I wanted to verify
mapleSol[x_, t_] := -(Exp[-t]/2) (x^2 - 2 x) (t - 2)
Manipulate[
Plot[mapleSol[x, t], {x, 0, 1}, PlotRange -> {{0, 1}, {-1, .1}}],
{{t, 0, "time"}, 0, 10, .1}
]
Any suggestion how to get rid of the error from NDSolve?
Using V 12 on windows 10. ps. I solved this by hand also, but can't get Maple solution, and my solution looks wrong. I still need to find out why.