2
$\begingroup$

enter image description here

Hi, can someone plz explain where the formulas for $w_{i+1}$ come from? Thanks!

$\endgroup$
  • 2
    $\begingroup$ I don't see Runge-Kutta, just midpoint and Euler... $\endgroup$ – coffeemath May 6 '16 at 23:03
  • 2
    $\begingroup$ This is the second order of Runge Kutta, which can be considered as Euler and midpoint method. But I don't know where the formula comes from. $\endgroup$ – J.doe May 6 '16 at 23:13
  • $\begingroup$ OK unfortunately I didn't know the connection. But it looks like you got the "Solution" from a text or notes, what does text say about the method? $\endgroup$ – coffeemath May 6 '16 at 23:16
  • $\begingroup$ The midpoint method given is $w_{i+1}=w_i+hf(t_i+h/2, w_i+hf(t_i,w_i)/2)$, for i= 0, 1, ..., N-1. I substituted the value with the symbols, but I get a different result than that listed above. $\endgroup$ – J.doe May 6 '16 at 23:24
2
$\begingroup$

The iteration formula for the Midpoint Rule is given by:

$\tag 1 w_{i+1} = w_i + h f\left(t_i + \dfrac{h}{2}, w_i +\dfrac{h}{2} f\left(t_i, w_i\right)\right), w_0 = \alpha = 0.5, N = 10, h = 0.2, t_i = 0.2i$

We have:

  • $f(t, y) = y-t^2 + 1$
  • $t_i + \dfrac{h}{2} = 0.2 i + 0.1$
  • $f(t_i, w_i) = w_i - t_i^2 + 1 = w_i -(0.2i)^2 + 1 = w_i -0.04 i^2 + 1$

From $(1)$, we have:

$$w_{i+1} = w_i + 0.2 f \left(0.2 i + 0.1, w_i + 0.1(w_i -0.04 i^2 + 1) \right) \\ =w_i + .2(1.1~ w_i -0.044i^2 -0.04 i + 1.09 )$$

Hence:

$$w_{i+1} = 1.22 w_i - 0.0088i^2 - 0.008 i + 0.218$$

Give the second one a go.

$\endgroup$
  • $\begingroup$ Nice! As an aside, you might find the align environment useful: meta.math.stackexchange.com/a/5024/139123 $\endgroup$ – David K May 6 '16 at 23:59
  • $\begingroup$ @DavidK: Thanks, I was trying to use align and for some reason always screw it up! :-) $\endgroup$ – Moo May 7 '16 at 0:01
  • $\begingroup$ Oh I treated $t+i$ as $t_0$ and that's why I always get the wrong answer. Thanks a lot!! $\endgroup$ – J.doe May 7 '16 at 0:21
  • $\begingroup$ Hi, what does $t$ mean in the formula? $\endgroup$ – J.doe May 8 '16 at 17:23
  • $\begingroup$ I am not sure I follow, you have a function $f(t, y)$, it is time. The $t_i$ is the step size in the numerical iteration. $\endgroup$ – Moo May 8 '16 at 19:40

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.