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 = 3x2y - 3x5 - 3x3 + 1 , 0 < x < 2 so that |f(x, y1) - f(x, y2)| = |3x2| |y1 - y2| < 12 |y1 - y2| 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 3x2 < 12, by theorem 5.3, f satisfies a Lipschitz condition.

 

(b) f = sin(x)y2 - cos(x), 1 < x < 2 so that |f(x, y1) - f(x, y2)| = |sin(x)| |y1 - y2| |y1 + y2| which does not satisfy a Lipschitz condition on D since y1 + y2 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 wi+1 = wi + h f(xi, wi) 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 Taylor method of order 2 is given by wi+1 = wi + h f(xi, wi) + h2 f´(xi, wi)/2.

 

(a) f´(x, y) = 3x2y´ + 6xy - 15x4 - 9x2 = 3x2(3x2y - 3x5 - 3x3 + 1) + 6xy - 15x4 - 9x2. 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)y2 - cos(x) + xsin(x) = 2y sin(x)(sin(x)y2 - xcos(x)) + cos(x)y2 - 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(Taylor)

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 Taylor method is an improvement on the Euler method except at the last point and both fail badly as x gets larger.

 

5. Converting the second-order initial-value problem into a system of first-order differential equations yields

y1´ = y2; y1(0) = 0

y2´ = 2xy2 – 2y1 + x2; y2(0) = –1

In this case Euler's method becomes

w1,i+1 = w1,i + hw2,i

w2,i+1 = w2,i + h(2xiw2,i - 2w1,i + xi2)

 

x

w1

w2

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:

k1 = hf(xi, wi)

k2 = hf(xi + h/2, wi + k1/2)

wi+1 = wi + k2

(a)

xi

wi

k1

xi + h/2

wi + k1/2

k2

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)

 

xi

wi

k1

xi + h/2

wi + k1/2

k2

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) + h2/6 f´´(x, y)

can be written explicitly as

Expanding the following expression

a1f(x, y) + a2f(x + c, y + d f(x,y))

in a multivariate Taylor series yields

which matches the first expansion to O(h2) if

a1 + a2 = 1; a2 c = h/2; a2 d = h/2; a2 c2/2 = h2/6; a2 cd = h2/3; a2 d2/2 = h2/6

and we ignore the terms

Solving these equations yields

a1 = 1/4 a2 = 3/4 c = d = 2h/3