- #1
Linder88
- 25
- 0
Homework Statement
Consider the boundary value problem
\begin{equation}
u''(t)=-4u+3sin(t),u(0)=1,u(2)=2sin(4)+sin(2)+cos(4)
\end{equation}
Homework Equations
Derive the linear system that arise when discretizating this problem using
\begin{equation}
u''(t)=\frac{u(t-h)-2u(t)+u(t+h)}{h^2}
\end{equation}
where h=0.5 is the step length.
The Attempt at a Solution
Evaluate the second derivative at the first boundary
\begin{equation}
u''(0)=-4u(0)=-4
\end{equation}
Now if iterating with step length h=0.5 we should have
for t=1:100
\begin{equation}
\begin{cases}
u''(t)=-4u(t)+3sin(t)\\
u(t+1)=u(t)+h^2u''(t)
\end{cases}
\end{equation}
end
When I do this iteration in I don't end up at u(2)=2sin(4)+sin(2)+cos(4) which make me conclude that I am doing something wrong. Can somebody please explain how I should use Equation (2) to calculate the next value?
Last edited: