Lilliana Livingston

2022-07-20

I have already posted question where I was asking about sketching Euler method.
The explicit Euler method for numerically solving the begining values of differential equation $x\prime =f\left(t,x\right),x\left({t}_{0}\right)={x}_{0}$ on the interval $I=\left[{t}_{0},T\right]$ is given by
${x}_{k+1}={x}_{k}+hf\left({t}_{k},{x}_{k}\right),k=0,\dots ,N-1$ with $h=\left(T-{t}_{0}\right)/N,N\in N.$
${X}_{k}$ is an approximation of the exact solution $x\left(t\right)$ of the begining values at time ${t}_{k}:={t}_{0}+kh,k=0,...,N.$ By linear interpolation between the points $\left({t}_{k},{x}_{k}\right)$ and $\left({t}_{k+1},{x}_{k+1}\right),k=0,...,N-1,$ we obtain a approximation solution ${x}_{h}\left(t\right)$.
I need to calculate an approximation of the solution of the begining values at the point $t=1$
${x}^{\prime }=-t/x,x\left(0\right)=1$
I need to use h = 0.5. Specify ${x}_{h}$(1) and calculate the error, that is difference ${x}_{h}$(1)−$x$(1), where $x$(1) is the value of the exact solution.
I really don't know how to start. How can I calulate $x$ or ${x}_{h}$ at all?

Deacon Nelson

Expert

You find $x$ by solving the differential equation. It has separeted variables, and the solutiion is easily found to be $x\left(t\right)=\sqrt{1-{t}^{2}}$. Then $x\left(1\right)=0$.

To apply Euler's method we have ${t}_{0}=0$, $T=1$, ${x}_{0}=1$, $h=0.5$ and hence $N=2$. Then
${x}_{k+1}={x}_{k}-h\phantom{\rule{thinmathspace}{0ex}}\frac{k\phantom{\rule{thinmathspace}{0ex}}h}{{x}_{k}}.$
Find ${x}_{1}$ and then ${x}_{2}$.

Do you have a similar question?

Recalculate according to your conditions!