I have to solve the ODE
$u''[t]+u'[t]+\sin {(5t)} u[t]=t^3-t$, with $u[0]=0,u[1]=0,$ with a finite element method and then with NDSolve
.
Finally, I have to calculate $|u_{FEM}-u_{NDSolve}|$ and if the inequality
$\sqrt {\int_{a}^{b}[u(t)]^2dt} \le \frac{b-a}{\sqrt 2} \sqrt {\int_{a}^{b}[u_t(t)]^2dt}$ holds for $b=1,a=0.$
I used:
ic1 = {u[0] == 0, u[1] == 0};
ode = u''[t] + u'[t] + Sin[5 t] u[t] == t^3 - t;
sol = NDSolve[{ode, ic1}, u, {t, 0, 20},
Method -> {"FiniteElement",
MeshOptions -> MaxCellMeasure -> 0.001}][[1]];
bctraditional = {u[0] == 0, u[1] == 0};
soltraditional = NDSolve[{ode, bctraditional}, u, {t, 0, 20}][[1]];
Plot[Evaluate[u[t] /. {sol, soltraditional}], {t, 0, 20},
AxesOrigin -> {0, 0}, PlotRange -> All,
PlotStyle -> {Automatic, {Red, Dashed}}]
On the other hand, I used:
sol = NDSolve[{u''[t] + u'[t] + Sin[5 t] u[t] == t^3 - t, u[0] == 0,
u[1] == 0}, u[t], t]
Plot[u[t] /. sol, {t, 0, 1}]
but I couldn't find an expression for $u[t]$ and not the same results and not able to apply the integrals. Any help? Thank you