Docsity

Numerical Methods for Integration and Root Finding: Problem Solutions, Assignments of Computer Science

Toggle sidebar
bg1
Homework 5
(solution)
Problem 1 (Problems 4 and 5 on page 64)
(a) Here f(x) = x-1 and, x0 = ½ and x1 = 1.
f(x0) = 2
f(x1) = 1
p(x) = [(1 – x) / (½)] (2) + [(x-1/2) / (½)](1)
now, f ’’(x) = 2 x-3
max f ‘’(x) = 16
| f(x) - p(x) | <= 1/8 * (1-1/2)2 * 16
(b) Here f(x) = √x and, x0 = ¼ and x1 = 1.
f(x0) = ½
f(x1) = 1
p(x) = [(1 – x) / (¾)] (½) + [(x-1/2) / (¾)](1)
now, f ’’(x) = x -3/2 / 4
max f ‘’(x) = 2
| f(x) - p(x) | <= 1/8 * (1-1/4)2 * 2
Problem 2 (Problems 7 and 8 on page 64)
(a)
f(x) = sin (x)
f ‘’ (x) = -sin(x)
max f’’(x) = 1
To obtain an accuracy of 10-6,we can find h by solving,
h2 (1 ) / 12 <= 10-6
PDF created with pdfFactory Pro trial version www.pdffactory.com
pf3
pf4
pf5

Partial preview of the text

Download Numerical Methods for Integration and Root Finding: Problem Solutions and more Assignments Computer Science in PDF only on Docsity!

Homework 5

(solution)

Problem 1 (Problems 4 and 5 on page 64)

(a) Here f(x) = x-1^ and, x 0 = ½ and x 1 = 1.

f(x 0 ) = 2 f(x 1 ) = 1

p(x) = [(1 – x) / (½)] (2) + (x-1/2) / (½)

now, f ’’(x) = 2 x-

max f ‘’(x) = 16

| f(x) - p(x) | <= 1/8 * (1-1/2)^2 * 16

(b) Here f(x) = √x and, x 0 = ¼ and x 1 = 1.

f(x 0 ) = ½ f(x 1 ) = 1

p(x) = [(1 – x) / (¾)] (½) + (x-1/2) / (¾)

now, f ’’(x) = x -3/2^ / 4

max f ‘’(x) = 2

| f(x) - p(x) | <= 1/8 * (1-1/4)^2 * 2

Problem 2 (Problems 7 and 8 on page 64)

(a)

f(x) = sin (x)

f ‘’ (x) = -sin(x)

max f’’(x) = 1

To obtain an accuracy of 10-6,we can find h by solving,

h^2 (1 ) / 12 <= 10-

To obtain an accuracy of 10-3,we can find h by solving,

h^2 (1 ) / 12 <= 10-

(b)

f(x) = tan (x)

f ‘’ (x) = 2 sec^2 (x) tan(x)

max f’’(x) = 4

To obtain an accuracy of 10-6,we can find h by solving,

h^2 (4) / 12 <= 10- To obtain an accuracy of 10-3,we can find h by solving,

h^2 (4) / 12 <= 10-

Problem 3 (Problem 4 on page 71)

Here f(x) = x (1 – x^2 ) and h = 1/

Now, I(f) = 1/16 [f(0) + 2f(1/8) +2f(1/4) +2f(3/8) +2f(1/2) +2f(5/8) +2f(3/4)

  • 2*f(7/8) + f (1)]

Now, f’(x) = 1 – 3x^2

f’’(x) = - 6 x

max f’’(x) = 6

Now, we can find h by solving,

h^2 (6 ) / 12 <= 10-

And we can find h by solving,

h^2 (6 ) / 12 <= 10-

max f ’’(x) = 1

Now, we can find h by solving,

h^2 (1 ) / 12 <= 10-

4. I(f) = ∫ cos(πx/2) dx

f’(x). = - (π/2)sin(πx/2)

f’’(x) = - (π/2)^2 cos(πx/2)

max f ‘’(x) = (π/2)^2

Now, we can find h by solving,

h^2 (π/2)^2 / 12 <= 10-

Problem 6 (Problem 2 on page 92)

For each of the functions listed below, do a calculation by hand (i.e., with a calculator) to find the root to an accuracy of 0.1. This process will take at most five iterations for all of these, and fewer for several of them.

1. f(x) = x

3

- 3 [a, b] = [0, 2]

N a B C f(a) f(b) f(c) b-a 1 0.0 3.0 1.5 -3.00 24.00 0.375 3 2 0.0 1.5 0.75 -3.00 0.375 -2.578 1. 3 0.75 1.5 1.125 -2.578 0.375 -1.576 0. 4 1.125 1.5 1.313 -1.576 0.375 -0.739 0. 5 1.313 1.5 1.406 -0.739 0.375 -0.219 0. 6 1.406 1.5 1.453 -0.219 0.375 0.068 0. 7 1.406 1.453 1.430 -0.219 0.068 -0.078 0. 8 1.430 1.453 1.441 -0.078 0.068 -0.005 0. 9 1.441 1.453 1.447 -0.005 0.068 0.031 0. 10 1.441 1.447 1.444 -0.005 0.031 0.013 0.

2. f(x) = x

6

− x − 1, [a, b] = [0, 2].

n a b c f(a) f(b) f(c) b-a

Problem 7 (Problem 4 on page 93)

Use the bisection algorithm to solve the nonlinear equation x = cos x. Choose your own initial interval by some judicious experimentation with a calculator.

f(x) = x – cos(x), let a = 0. and b = pi = 3.

n a b c f(a) f(b) f(c) b-a 1 0.000 3.142 0.611 1.00 -4.142 0.208 3. 2 0.611 3.142 0.732 0.208 -4.142 0.012 2. 3 0.732 3.142 0.739 0.012 -4.142 0.000 2. 4 0.739 3.142 0.739 0.000 -4.142 0.000 2.

Problem 8 (Problem 9 on page 94)

A variation on the bisection method is known as regula-falsi, or, the method of false position. Given an interval [a, b], with f(a)f(b) < 0, the new point c is defined by finding where the straight line connecting (a, f(a)) and (b, f(b)) crosses the axis. Show that this yields, c = b − f(b)(b − a)/(f(b) − f(a)).

Equation of the line passing through the points (a,f(a)) and (b,f(b)) is –

y – f(b) = [ ( f(b) – f(a) ) / (b - a) ] (x – b)