Docsity

Applied Numerical Methods - Homework 6 Solutions | MATH 151A, Assignments of Mathematics

Toggle sidebar
bg1
Homework 6 Solutions
Igor Yanovsky (Math 151A TA)
Problem 1: Consider the numerical quadrature rule to approximate R1
0f(x)dx given by
Z1
0
f(x)dx ≈w1f(0) + w2f(x1).
Find the maximum possible degree of precision you can attain by appropriate choices of
w1,w
2and x1. With such choices of w1and w2, approximate R1
0x3dx and compare with
the exact value.
Solution: We want the formula
Z1
0
f(x)dx =w1f(0) + w2f(x1)
to hold for polynomials 1,x,x
2,.... Plugging these into the formula, we obtain:
f(x)=x0Z1
0
1dx =x|1
0=1 = w1·1+w2·1,
f(x)=x1Z1
0
xdx =x2
2
1
0=1
2=w1·0+w2·x1,
f(x)=x2Z1
0
x2dx =x3
3
1
0=1
3=w1·0+w2·x2
1.
We have 3 equations in 3 unknowns:
w1+w2=1,
w2x1=1
2,
w2x2
1=1
3,
or
w2=1−w1,
x1(1 −w1)= 1
2,
x2
1(1 −w1)=1
3.
Multiplying the second equation by x1and subtracting the third equation, we obtain
x1=2
3. Then, w2=3
4and w1=1
4.
Thus, the quadrature formula is
Z1
0
f(x)dx =1
4f(0) + 3
4f2
3.X
1
pf3

Partial preview of the text

Download Applied Numerical Methods - Homework 6 Solutions | MATH 151A and more Assignments Mathematics in PDF only on Docsity!

Homework 6 Solutions

Igor Yanovsky (Math 151A TA)

Problem 1: Consider the numerical quadrature rule to approximate

0 f^ (x)^ dx^ given by ∫ (^1)

0

f (x) dx ≈ w 1 f (0) + w 2 f (x 1 ).

Find the maximum possible degree of precision you can attain by appropriate choices of w 1 , w 2 and x 1. With such choices of w 1 and w 2 , approximate

0 x (^3) dx and compare with

the exact value.

Solution: We want the formula ∫ (^1)

0

f (x) dx = w 1 f (0) + w 2 f (x 1 )

to hold for polynomials 1, x, x^2 ,.. .. Plugging these into the formula, we obtain:

f (x) = x^0

0

1 dx = x|^10 = 1 = w 1 · 1 + w 2 · 1 ,

f (x) = x^1

0

x dx =

x^2 2

∣∣^1

0

= w 1 · 0 + w 2 · x 1 ,

f (x) = x^2

0

x^2 dx = x^3 3

1 0

= w 1 · 0 + w 2 · x^21.

We have 3 equations in 3 unknowns:

w 1 + w 2 = 1 , w 2 x 1 =

w 2 x^21 =

or

w 2 = 1 − w 1 , x 1 (1 − w 1 ) =

x^21 (1 − w 1 ) =

Multiplying the second equation by x 1 and subtracting the third equation, we obtain x 1 = 23. Then, w 2 = 34 and w 1 = 14. Thus, the quadrature formula is ∫ (^1)

0

f (x) dx =

f (0) +

f

. X

The accuracy of this quadrature formula is n = 2, since this formula holds for polynomials 1 , x, x^2. We can check how well this formula approximates

0 x

(^3) dx: ∫ (^1)

0

x^3 dx =

= 0. 2222. X

The exact value of this integral is ∫ (^1)

0

x^3 dx = x^4 4

1 0

= 0. 2500. X

Problem 2: Determine constants a, b, c, d that will produce a quadrature formula ∫ (^1)

− 1

f (x) dx ≈ af (−1) + bf (1) + cf ′(−1) + df ′(1)

that has degree of precision 3.

Solution: We want the formula ∫ (^1)

− 1

f (x) dx = af (−1) + bf (1) + cf ′(−1) + df ′(1)

to hold for polynomials 1, x, x^2 ,.. .. Plugging these into the formula, we obtain:

f (x) = x^0

− 1

1 dx = x|^1 − 1 = 2 = a · 1 + b · 1 + c · 0 + d · 0 ,

f (x) = x^1

− 1

x dx = x^2 2

1 − 1

= 0 = a · (−1) + b · 1 + c · 1 + d · 1 ,

f (x) = x^2

− 1

x^2 dx = x^3 3

1 − 1

= a · 1 + b · 1 + c · (−2) + d · 2 ,

f (x) = x^3

− 1

x^3 dx =

x^4 4

∣∣^1

− 1 = 0 = a · (−1) + b · 1 + c · 3 + d · 3.

We have 4 equations in 4 unknowns:

a + b = 2 , −a + b + c + d = 0 , a + b − 2 c + 2d =

−a + b + 3c + 3d = 0.

Solving this system, we obtain:

a = 1, b = 1, c =

, d = −

Thus, the quadrature formula with accuracy n = 3 is: ∫ (^1)

− 1

f (x) dx = f (−1) + f (1) +

f ′(−1) −

f ′(1). X