initial value problem

calchere

Junior Member
Joined
Sep 13, 2006
Messages
50
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.
 
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

Assuming it was a typo,

How did that c become a coefficient of e? Evaluate the expression y+1 = e^(x^2/2) * e^(c) for (0,1).

y+1 = e^(x^2/2) * e^(c)
1+1 = e^(0^2/2) * e^(c)
2 = e^(c)
c = ln2

y+1 = e^(x^2/2) * e^(c)
y = e^((x^2)/2) * e^(ln2) – 1

Therefore,

y(1) = e^((1^2)/2) * e^(ln2) – 1
 
i thought since e^(c1) = c2
because there is no variable, so e^(c1) is a constant.
 
I understand what you did ... some folks are taught differently in dealing with the "C".

ln(y + 1) = x<sup>2</sup>/2 + C<sub>1</sub>

y + 1 = e<sup>x<sup>2</sup>/2 + C<sub>1</sub></sup>

y + 1 = e<sup>C<sub>1</sub></sup>*e<sup>x<sup>2</sup>/2</sup>

y + 1 = C<sub>2</sub>e<sup>x<sup>2</sup>/2</sup>

y = C<sub>2</sub>e<sup>x<sup>2</sup>/2</sup> - 1

since y(0) = 1 ...

1 = C<sub>2</sub>e<sup>0</sup> - 1 ... C<sub>2</sub> = 2

so ...

y = 2e<sup>x<sup>2</sup>/2</sup> - 1
 
So, is c=2 or c=ln2 ?

Hello, Calchere. Sorry for the confusion -- and thank you, Skeeter. Please note that the same result is achieved by either approach. I simply did not simplify the expression:

y = e^((x^2)/2) * e^(ln2) – 1 = 2e^((x^2)/2) - 1

The same result as Skeeter's...

As Skeeter pointed out, c can be handled different ways. Skeeter used C1 and C2 to clarify this. Hope that helps.
 
Ah, i didn't realize there was another way to do it.
Does part (b) look correct, and how do i calculate the error percent?

y1= y0 + hF(x0,y0)
y1 = 1 + .2(0+0)
y1= 1
 
y1= y0 + hF(x0,y0)
y1 = 1 + .2(0+0)
y1= 1

Euler’s Method is an iterative approximation method. You start at a point you know and move away from that point one step at a time (a distance h with each step).

You know the function value at y(0), and you want to approximate the function value at y(1). Your step size is h = .2. You’ll need 5 iterations (steps) to get there.

Note: We’ve already solved for y(x), so we can plug in x=1 and find that y(1) = 2.297 approximately. Your Euler approximation should be near this.

For notes and examples on Euler’s method, try
http://www.math.ubc.ca/~feldman/math/odesolvers.pdf
and
http://www.ugrad.math.ubc.ca/coursedoc/ ... euler.html

You should set up a table as shown in the pdf.
 
Ok, i think i understand it now.
dy/dx = xy + x , y(0) = 1 , stepsize = .2

y1=1 + .2(0 + 0) = 1
y2=1 + .2(.2(1) + .2) = 1.08
y3=1.08 + .2(.4(1.08) + .4) = 1.2464
y4=1.2464 + .2(.6(1.2464) + .6) = 1.516
y5=1.516 + .2(.8(1.516) + .8) = 1.92

so y(1) = 1.92 aprox. via the Euler method.
 
Top