[Math] Initial-Value Problem Taylor’s Method of order 2

numerical methodsordinary differential equations

Given the initial-value problem $$y' = te^{3t} – 2y,\qquad 0 \leq t \leq 1, \qquad y(0) = 0$$ with $h = 0.5$. Use the Taylor's method of order two to approximate the solutions to the given IVP. (Solution: $w_1 = 0.12500000$, $w_2 = 2.02323897$.)

I've tried this problem quite a few times but keep getting incorrect answers. My guess is that I'm calculating the derivative incorrectly which is giving me an incorrect result for $w_2$. My approach so far is as follows:

Observe that $f(t, y) = te^{3t} – 2y$. I calculate that $f'(t, y) = e^{3t} + 3t^2e^{3t} – 2y'$ which is the same as $f'(t, y) = e^{3t} + 3t^2e^{3t} – 2(te^{3t} – 2y) = e^{3t}(3t^2 -2t + 1) + 4y$.

Also, $t_0 = 0$, $t_1 = 0.5$, and $t_2 = 1$.

$w_0 = 0$, $w_1 = w_0 + h(f(t_0, w_0) + \frac{h}{2} f'(t_0, w_0))$ and $w_2 = w_1 + h(f(t_1, w_1) + \frac{h}{2} f'(t_1, w_1))$.

Now, plugging in numbers yields: $w_0 = 0$, $w_1 = 0.125$ and $w_2 = 1.603081$.

Can someone try and catch what I've done wrong?

PS The reason I think my derivative is wrong is that I wrote a program in MATLAB to calculate the approximations using this method and tested it with an example in the book I'm using and the results we're consistent with the book's, but then when I ran my code, it didn't match the results I should be getting, according to the professor.

Best Answer

When you calculate $f'(t,y)$, the derivative of $e^{3t}$ is $3e^{3t}$, not $3te^{3t}$