Consider the following initial value problem: dy/dt = xy+x , y(0)=1
(a) Find the exact solution to this initial value problem. Find y(1)
(b) Use Euler's method with step size t=0.2 to approximate y(1)
(c) Compare the solutions in (a) and (b) , what is the error percent.
(a) I'm not sure how to get the exact solution. I was thinking about separating x and y to get:
dy/dt= x(y+1)
but i'm not sure if i can separate the equation because it is dt and not dx. i was thinking maybe it was a typo (problem is from a handout, not a book) and is supost to be dx and not dt.
In that case i get:
dy/y+1 = xdx
integrate:
ln(y+1) = x^2/2 + c
y+1 = e^(x^2/2 + c)
y+1 = e^(x^2/2) * e^(c)
y = ce^(x^2/2)-1
then i plug in the numbers:
1 = ce^(0^2/2)-1
1 = c(1)-1
1= c-1
c=2
so the exact solution would be:
y = e^(x^2/2)
(b) i used the equation: y1= y0 + hF(x0,y0)
y1 = 1 + .2(0+0)
y1= 1
I'm not sure if that is correct.
(c) I'm not sure how to calculate the error percent.
(a) Find the exact solution to this initial value problem. Find y(1)
(b) Use Euler's method with step size t=0.2 to approximate y(1)
(c) Compare the solutions in (a) and (b) , what is the error percent.
(a) I'm not sure how to get the exact solution. I was thinking about separating x and y to get:
dy/dt= x(y+1)
but i'm not sure if i can separate the equation because it is dt and not dx. i was thinking maybe it was a typo (problem is from a handout, not a book) and is supost to be dx and not dt.
In that case i get:
dy/y+1 = xdx
integrate:
ln(y+1) = x^2/2 + c
y+1 = e^(x^2/2 + c)
y+1 = e^(x^2/2) * e^(c)
y = ce^(x^2/2)-1
then i plug in the numbers:
1 = ce^(0^2/2)-1
1 = c(1)-1
1= c-1
c=2
so the exact solution would be:
y = e^(x^2/2)
(b) i used the equation: y1= y0 + hF(x0,y0)
y1 = 1 + .2(0+0)
y1= 1
I'm not sure if that is correct.
(c) I'm not sure how to calculate the error percent.