0
$\begingroup$

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".

$\endgroup$
0
$\begingroup$

If you read carefully the task that you copied, it says

"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.$"

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

$\endgroup$
  • $\begingroup$ So let me understand this correct. I should compute all 100 steps, but only show j=10k, i.e. j=3, that is 10*3=30 so the 30th step, and so on. Got it? In other words. Step 0, Step 10, Step 20, Step 30, ... Step 100. Must be shown? $\endgroup$ – Joey Adams Sep 30 '18 at 11:28
  • $\begingroup$ Yes, exactly that. I did something similar in math.stackexchange.com/a/1239002/115115 $\endgroup$ – Lutz Lehmann Sep 30 '18 at 14:27
  • $\begingroup$ You are my man! $\endgroup$ – Joey Adams Sep 30 '18 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.