MATH3242/COSC3122

FW03

SOLUTIONS TO TERM TEST 1

1. (a) We have

f´(x) = Fh(x) + K1h + K2h2 + ...

Replacing h by h/2 we get

f'(x) = Fh/2(x) + K1h/2 + K2h2/4 + ...

Eliminating the term proportional to h from these two equations by multiplying the second equation by 2 and subtracting the first we get

f'(x) = 2Fh/2(x) - Fh(x) + K2'h2 + ...

(b) Using the backwards-difference formula we find the approximate value of the first derivative of ln(x2+2x) at x = 1.2 using h = 0.02 as

[ln(3.84) - ln(3.831204)]/0.02 = 1.1538

Repeating this calculation with h = 0.01 we get 1.1498

(c) Using the Richardson extrapolation technique given in question 1(a) we find

Fh(2) = 2Fh/2(x) - Fh(x) = 2´1.1498 - 1.1538 = 1.1458

2(a) Using Taylors' formula we have

f(x-h) = f(x) - h f´(x) + h2 f´´(x)/2 + h3 f´´´(x1)/6

f(x-2h) = f(x) - 2h f´(x) + 4h2 f´´(x)/2 + 8h3 f´´´(x2)/6

Subtracting 4 times the first equation from the second yields

f(x-2h) - 4f(x-h) = f(x) - 2h f´(x) + 2h2 f´´(x) - 4f(x) + 4hf´(x) - 2h2 f´´(x) + O(h3)

Solving this equation for f´(x) we get

f´(x) = [f(x-2h) - 4f(x-h) + 3f(x)]/2h + O(h2)

(b) Since all the points at which the function is evaluated are less than or equal to x, this formula would be useful when x is at the upper limit of tabular data, domain of definition, etc.

3. (a) To derive the Composite Simpson's Rule we first break up the integral as

noting that n is even. We then apply the Elementary Simpson's Rule from the formula sheet to each of these integrals to get

h[f(x0) + 4f(x1) + f(x2)]/3 + h[f(x2) + 4f(x3) + f(x4)]/3 + ... + h[f(xn-2) + 4f(xn-1) + f(xn)]/3

or

h[f(x0) + 4f(x1) + 2f(x2) + 4f(x3) + ... + 2f(xn-1) + 4f(xn-1) + f(xn)]/2

which is the Composite Trapezoidal Rule.

(b) With n = 4, h = 0.4 and the CTR yields

0.4[sin(0.5) + 4sin(0.7) + 2sin(0.9) + 4sin(1.1) + sin(1.3)]/3 = 1.2202

(c) Since f(x) = sin(x/2), f(4)(x) = sin(x/2)/16 for some x in (1.0, 2.6). We can take the maximum value of this function to be 1/16 (the maximum actually occurs at x = 2.6 but it doesn't change the value significantly). Thus the absolute value of the error is 1.6·(0.4)4/180/16 = 1.4´10-5.

Since sin(x/2) is positive for all x in (1.0, 2.6) it is positive there. Hence all the terms in the error are positive. With the overall minus sign this means we can determine that the erro is negative in this case, i.e. our result is greater than the actual value of the integral.

4. (a) The step when k = 1 is b - a = 0.4. The step size is reduced by half at each step so that for k = 2 the step size is (b - a)/4 = 0.1.

(b) In order to ascertain a value for the integral of maximun accuracy, we have to consider agreement between the various entries in the table. If we compare R2,2 and R3,3 they agree to 5 decimal places and indiacate a value of 0.16515. Alternately, one could compare R3,2 and R3,3 which agree to 6 decimal places and yield a value of 0.165149 (which is consistent with the previous estimate).

(c) The most obvious check is to calculate another row for the table corresponding to

k = 4 and do comparisons similar to those in part (b).

5. (a) (i) Truncation error refers to the error made when we truncate the Taylor series. With reference to the ESR of question 1, the truncation error is -h5f(4)(x)/90 where x Î (a, b).

(ii) Round-off error is the error made by a computer or calculator due to the finite-length arithmetic that is used. Thus the error in evaluating f(x) can be written as d|f(x)| where the value of d depends on the precision of the arithmetic used on a given machine.

(b) The ESR is derived by fitting a second-degree Lagrange interpolating polynomial to three points f(x0), f(x1) and f(x2). Integrating this polynomial from x0 to x2 gives us the ESR.

(c) Open Newton-Cotes formulae do not include the end points of the interval of integration whereas closed Newton-Cotes formulae do include the end points of the interval of integration.

2