Okay the question is:
"Compute numerical approximations to the above IVP on the interval $[t_0,te]=[0,1]$. Use step sizes of $h = 0.1, 0.01, 0.001$ and display in a table the results $y_j$
and the errors $e_j = y(x_j ) − y_j$ for all three methods* at the 11 locations $x_k =0, 0.1, 0.2, . . . , 0.9, 1.0.$ You can also plot the functions. (this is voluntarily)"
The IVP is:
$y'(x)=-2xy(x)^2, y(0)=y_0=1$
For $h=0.1$ the computation was easy to do. But when I let $h=0.01$ is it true that I should make a table of 100 steps? And how about $h=0.001$? Should I also do a table with 1000 steps? I hope I misunderstand the question here.
If I'm wrong here. How should I do it then? I mean how should I make a table where $h=0.01$ and $h=0.001$.
*Btw the three methods my teacher mentioned is "Euler", "Heun" and "Midpoint".
Best Answer
If you read carefully the task that you copied, it says
so that for $h=0.01$ you display the values for $j=10k$ and for $h=0.001$ for $j=100k$.
For inspiration on how to structure the code for such a task see https://math.stackexchange.com/a/1239002/115115