MATH3242.03/COSC3122.03
FW03
Solutions to Assignment 4
1. The theorem guaranteeing a unique solution to the initial value problem y´= f(x, y), a < x < b, y(a) = a requires that f be continuous and satisfy a Lipschitz condition on the domain D = {(x,y) a < x < b,–infinity < y < infinity}.
(a) f = 3x^{2}y  3x^{5 } 3x^{3} + 1^{ }, 0 < x < 2 so that f(x, y_{1})  f(x, y_{2}) = 3x^{2} y_{1}  y_{2} < 12 y_{1 } y_{2} and hence f satisfies a Lipschitz condition on D and is also continuous there so the problem has a unique solution. Alternately, since the partial derivative of f with respect to y is 3x^{2} < 12, by theorem 5.3, f satisfies a Lipschitz condition.
(b) f = sin(x)y^{2 } cos(x), 1 < x < 2 so that f(x, y_{1})  f(x, y_{2}) = sin(x) y_{1 } y_{2} y_{1} + y_{2} which does not satisfy a Lipschitz condition on D since y_{1} + y_{2} cannot be bounded there. Hence the conditions of the theorem are not satisfied.
(c) f = cot(x)y + x , 1 < x < 1 and f is not continuous at x = 0 so the conditions of the theorem are not satisfied.
2. Using Euler's method w_{i+1} = w_{i} + h f(x_{i}, w_{i}) with h= 0.5 we get the following solutions to the initial value problems of questions 1 (a) and (b). In part (c) the solution diverges when we try to evaluate f at x = 0.
(a) We include the exact results here as asked for in question 4.
x 
w 
y 
0.0000 
1.0000 
1.0000 
0.5000 
1.5000 
1.6250 
1.0000 
2.3280 
3.0000 
1.5000 
3.3200 
5.8750 
2.0000 
1.4260 
11.0000 
Note that the approximate value at x = 2.0 has a large error and has a large decrease from the previous value while the exact answer continues to increase.
(b)
x 
w 
1.0000 
2.0000 
1.5000 
0.5872 
2.0000 
0.4683 
3. The
(a) f´(x,
y) = 3x^{2}y´ + 6xy  15x^{4}  9x^{2} = 3x^{2}(3x^{2}y
 3x^{5 }^{ }3x^{3} + 1) + 6xy  15x^{4}  9x^{2}.^{
}The results with h = 0.5 including the exact results required in question
4 are
x 
w 
y 
0.0000 
1.0000 
1.0000 
0.5000 
1.5000 
1.6250 
1.0000 
2.6475 
3.0000 
1.5000 
4.2076 
5.8750 
2.0000 
7.7916 
11.0000 
Note that for x = 1.0 and 1.5 this method gives a smaller error than Euler's method as expected but for x = 2.0 the answer is actually worse.
(b) f´(x, y) = sin(x)2yy´ + cos(x)y^{2}  cos(x) + xsin(x) = 2y sin(x)(sin(x)y^{2 } xcos(x)) + cos(x)y^{2 } cos(x) + xsin(x)
x 
w 
1.0000 
2.0000 
1.5000 
1.4682 
2.0000 
0.9973 
4. We have already compared our results with the exact solution for h = 0.5. The results for question 1(a) using h = 0.25 are given below including the exact solution.
x 
w(Euler) 
w( 
y(exact) 
0.0000 
1.0000 
1.0000 
1.0000 
0.2500 
1.2500 
1.2500 
1.2656 
0.5000 
1.5461 
1.5923 
1.6250 
0.7500 
1.9689 
2.1137 
2.1719 
1.0000 
2.5551 
2.8884 
3.0000 
1.2500 
3.2214 
3.9398 
4.2031 
1.5000 
3.4928 
5.0449 
5.8750 
1.7500 
1.4104 
4.4476 
8.1094 
2.0000 
11.4296 
11.9485 
11.0000 
Note again that the
5. Converting the secondorder initialvalue problem into a system of firstorder differential equations yields
y_{1}´ = y_{2}; y_{1}(0) = 0
y_{2}´ = 2xy_{2} – 2y_{1} + x^{2}; y_{2}(0) = –1
In this case Euler's method becomes
w_{1,i+1} = w_{1,i} + hw_{2,i}
w_{2,i+1} = w_{2,i }+ h(2x_{i}w_{2,i}  2w_{1,i} + x_{i}^{2})
x 
w_{1} 
w_{2} 
0.0000 
0.0000 
1.0000 
0.2500 
0.2500 
1.0000 
0.5000 
0.5000 
0.9844 
0.7500 
0.7461 
0.9180 
1.0000 
0.9756 
0.7485 
1.2500 
1.1628 
0.3850 
1.5000 
1.2591 
0.3462 
1.7500 
1.1726 
1.7979 
2.0000 
0.7231 
4.7230 
6. We can write the Midpoint Method in the folowing form:
k_{1} = hf(x_{i}, w_{i})
k_{2} = hf(x_{i }+ h/2, w_{i} + k_{1}/2)
w_{i+}_{1} = w_{i} + k_{2}
(a)
x_{i} 
w_{i} 
k_{1} 
x_{i} + h/2 
w_{i} + k_{1}/2 
k_{2} 
0.0000 
1.0000 
0.5000 
0.2500 
1.2500 
0.5923 
0.5000 
1.5923 
0.8627 
0.7500 
2.0237 
1.2187 
1.0000 
2.8110 
1.7165 
1.2500 
3.6692 
1.5924 
1.5000 
4.4033 
1.0919 
1.7500 
3.8574 
14.4388 
2.0000 
10.0354 




(b)
x_{i} 
w_{i} 
k_{1} 
x_{i} + h/2 
w_{i} + k_{1}/2 
k_{2} 
1.0000 
2.0000 
1.4127 
1.2500 
1.2936 
0.5969 
1.5000 
1.4031 
0.9288 
1.7500 
0.9387 
0.5895 
2.0000 
0.8136 




7. The taylor polynomial
f(x, y) + h/2 f´(x, y) + h^{2}/6 f´´(x, y)
can be written explicitly as
Expanding the following expression
a_{1}f(x, y) + a_{2}f(x + c, y + d f(x,y))
in a multivariate Taylor series yields
which matches the first expansion to O(h^{2}) if
a_{1} + a_{2} = 1; a_{2 }c = h/2; a_{2 }d = h/2; a_{2 }c^{2}/2 = h^{2}/6; a_{2 }cd = h^{2}/3; a_{2 }d^{2}/2 = h^{2}/6
and we ignore the terms
Solving these equations yields
a_{1 }= 1/4 a_{2 }= 3/4 c = d = 2h/3