Math Help - Numerical ODE question

1. Numerical ODE question

hi, I'm wondering how to find the approximate solution of
dy/dx= e^x y y(0)=1

at x = 0.1 using the Taylor Series method. The expansion should include the
first four non-zero terms. Work to six decimal places accuracy.

Here is what I did but I am unsure which one is correct :
first attempt:
y'=e^x y y'(0)=1
y''=e^x y' y''(0)=1
y'''=e^x y'' y'''(0)=1
sub them into Taylor series method:
y(x0+h)=y(0+0.1)=y(0.1)= 1+h+h^2 /2 + h^3 /6

second attempt:
used product rule to differentiate:
y''=e^x y' + e^x y y''(0)=1+1=2
y'''=e^x y'' + e^x y' + e^x y' +e^x y y'''(0)=2+1+1+1=5
sub them into Taylor:
y(0.1)=1+1*0.1+ 2*(0.1)^2 /2 + 5*(0.1)^3 /6

thank you

2. $\frac{dy}{dx}= e^xy$

=> $\frac{dy}{y}=e^xdx$

Integrating, we have

=> $ln (y)=e^x+c$ ( c is a constant)

Now from the condition $y(0)=1$, $c$ comes out to be $-1$

So $y=e^{e^x-1}$

Why are you using Taylor's method?

3. because the question is from numerical methods class. cheers

4. Originally Posted by hazeleyes
hi, I'm wondering how to find the approximate solution of
dy/dx= e^x y y(0)=1

at x = 0.1 using the Taylor Series method. The expansion should include the
first four non-zero terms. Work to six decimal places accuracy.

Here is what I did but I am unsure which one is correct :
first attempt:
y'=e^x y y'(0)=1
y''=e^x y' y''(0)=1
y'''=e^x y'' y'''(0)=1
sub them into Taylor series method:
y(x0+h)=y(0+0.1)=y(0.1)= 1+h+h^2 /2 + h^3 /6

second attempt:
used product rule to differentiate:
y''=e^x y' + e^x y y''(0)=1+1=2
y'''=e^x y'' + e^x y' + e^x y' +e^x y y'''(0)=2+1+1+1=5
sub them into Taylor:
y(0.1)=1+1*0.1+ 2*(0.1)^2 /2 + 5*(0.1)^3 /6

thank you
Because of the fact that the initial data is given at 0 your first method is the best idea. so you know that

$y(0)=1$
$y'=e^{x}y(x) \implies y'(0)=e^{0}y(0)=1$
$y''='e^{x}y(x)+e^{x}y'(x) \implies y''(0)=2$

Note in general if you nave two functions (and in your cases $n \ge 2$)

General Leibniz rule - Wikipedia, the free encyclopedia

you get that
$\displaystyle \frac{d^n}{dx^n}=y^{(n)}(x)=\sum_{k=0}^{n-1}\binom{n-1}{k}\left( \frac{d^k}{dx^k}y \right) \left( \frac{d^{n-1-k}}{dx^{n-1-k}}e^{x}\right)=\sum_{k=0}^{n-1}\binom{n-1}{k}e^{x}y^{k}$

Putting this together you get that the value of the nth derivative is
(The n-1 comes from the fact we didn't need to use the product rule to take the first derivative it was given by the ODE)
$\displaystyle y^{n}(0)=\sum_{k=0}^{n-1}\binom{n-1}{k}y^{k}(0)$

You can use this to get as many terms as you need the series look like this

After cranking out a few terms I get that the series looks like

$y=1+x+x^2+\frac{5}{6}x^3+\frac{5}{8}x^4+\frac{13}{ 30}x^5$

Now use Taylors remainder theorem to show the error bound is where you want it.