0% found this document useful (0 votes)
10 views

Numerical Methods

Solution

Uploaded by

xinyueya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Numerical Methods

Solution

Uploaded by

xinyueya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

NUMERICAL METHODS

HOMEWORK 10

• Due date: Wednesday, November 20, 2024 at 11:59PM on Can-


vas/Gradescope
• The assignment will be graded out of 20 points. Point values of each problem
are labeled.
• Remember: You are allowed to discuss the assignment with your fellow stu-
dents or consult other references as long as the solution write up is your own
and you provide citation of who you discussed with or what reference you
used.
Exercise 1 (4 points). We want to compute
Z 1
I(f ) = f (x)e x dx.
0

Determine weights w0 , w1 and points x0 , x1 for which the quadrature rule Q(f ) =
w0 f (x0 ) + w1 f (x1 ) is exact for polynomials of degree three or less, i.e.
Solve this problem by writing equations corresponding to Q(xi ) = I(xi ) for i =
0, 1, 2, 3 and then solving R 1 the equations.
Hint: Use the formula 0 x e x dx and try to solve the system by changing variables
n

to
x0 = x̄ , x0 = x̄ + , w0 = w̄ ⌘, w1 = w̄ + ⌘.
R1 n x
Also, the formula 0 x e dx = n! might be useful.
Exercise 2 (3 points). We now consider the inner product
Z 1
(f, g) = f (x)g(x)e x dx.
0

The exercise finds a quadratic polynomial q that is orthogonal to polynomials of


degree 1.
a) (1 points) Write q(x) = x2 + a1 x + a0 and solve two linear equations for a0 , a1
given by (q, 1) = 0 and (q, x) = 0.
b) (2 points) Beginning with the basis {1, x, x2 } for polynomials of degree 2 and
q0 (x) = 1, use the Gram Schmidt orthogonalization process to compute q1 of
degree 1 orthogonal to q0 and then q2 of degree 2 orthogonal to q0 , q1 .
Exercise 3 (2 points). Verify that the roots of the polynomial from the previous
exercise are the points found in Exercise 1, and that the weights are
Z 1
wi = `i (x)e x dx
0

where `i is the Lagrange polynomial corresponding to the points {x0 , x1 }.


1
2 NUMERICAL METHODS HOMEWORK 10

Exercise 4 (4 points). We again consider integrals of the form


Z 1
I(f ) = f (x)x 1/2 dx
0
1/2
We consider Gauss quadrature rule with this weight function w(x) = x and inner
product Z 1
1/2
(p, q) = p(x)q(x)x dx.
0
a) (2 points) Let q(x) = x2 + a1 x + a0 and determine a0 , a1 such that (q, 1) = 0 and
(q, x) = 0.
b) (2 points) What are the nodes x0 , x1 and weights w0 , w1 such that the quadrature
rule
Q(f ) = w0 f (x0 ) + w1 f (x1 )
is exact for polynomials of degree less than or equal to 3, i.e. I(p) = Q(p) for
deg(p)  3?
Exercise 5 (4 points). Consider the integral that we want to compute
Z 1
I(f ) = f (x)(1 x2 ) 1/2 dx
1
Consider the quadrature rule
n
X
Q(f ) = wi f (xi )
i=0

where xi are the roots of the Chebyshev polynomial Tn+1 (x) = cos((n + 1) arccos(x))
and the weights are the typically Gauss quadrature weights wi = I(`i ). This rule is
exact for polynomials of degree 2n + 1.
Derive an estimate for the quantity
E(f ) = |Q(f ) I(f )|
using polynomial interpolation theory.
Hint: You may want to use the inequality for a function g : [ 1, 1] ! R
Z 1
|g(x)|(1 x2 ) 1/2 dx  ⇡ max |g(x)|.
1 1x1

Another true statement (but you should show this) is for a continuous function
g : [ 1, 1] ! R, we have
n
X
|Q(g)| = wi g(xi )  ⇡ max |g(x)|.
1x1
i=0
NUMERICAL METHODS HOMEWORK 10

Exercise 6 (3 points). We again consider integrals of the form


Z 1
I(f ) = f (x)dx
1
We consider Gauss quadrature rule with this weight function w(x) = 1 and inner
product Z 1
(p, q) = p(x)q(x)dx.
1
a) (1 point) Let q(x) = 5x3 3x. Show that (q, x) = (q, x2 ) = 0. Notice that
(q, 1) = 0 because q is an odd function. R1
b) (2 points) Let xi be the roots of q and let the weights be wi = 1 `i (x)dx. We
consider the quadrature rule
5 ⇣ p ⌘ 8 5 ⇣p ⌘
Q(f ) = w0 f (x0 ) + w1 f (x1 ) + w2 f (x2 ) = f 3/5 + f (0) + f 3/5 .
9 9 9
Let f (x) = x5 7x4 . Compute Q(f ) and then state the error Q(f ) I(f ) using
theorems from class.
1 Q Xi Iexi 5 xie xd x no Xo wix

For i o w.tw Se dx 1

For 1 1 wox.tw x for e dx 1

For i 2 WoXo w xp for X'exdx 2

For i 3 Woxo w xp ff Xe dx 6
Thing in Xo x̅ 8 x x̅ 8 Wo w̅ n w int n

w̅ 1
x̅ 8 w̅ n x̅ sicity 1
x̅ sit w̅ no ix stains 2
x̅ 8 w̅ n x̅ 8pct 7 6 4
Xo 2 52 X 2 52 W
24 W
2 a q 1 1 1 4 a ao e dx
2 a 1 do o 2 a do 0

q X f a ao xe dx
3 9 2 ao 1 6 29 an o

91 90 2 91 4
291 a 6 no 2

q X X2 4 2

b Go X 1

q 1 7 X co 1 where co 1
X 1

q x X C 9 x c 8 X where C
1 1 4
X2 41 1 2
2
co
X 4 2

3 nots X 4 2 0 X 1 42 2 a
Xo 2 T X 2 52 same as EX 1

weights l

wo
flex e
1ft F
w f b ex e same as Ex 1
4 a
q 1 St x ax ao x dx
32
Ex 290 72
Ja
a 2 no 0
1 2
q X Sf x aix ao x x dx

Ix Ea a

I F a no 0

5 alt 2 do
Fania
1
q x X

x
b Xo X are roots of q

IF x I x 3 its
e wo
flex x ax 1

lie we flax x ax 1
5 Ecf D f Icf 1
1 O f p 0 p Icf p I p

0 f p Icf p since Q p 1 p

Since Ʃ Wi I 1 T 101971 ƩWig Xi


Ʃ Wig xi max gx Wi Imax g x

let g f p then Q f p 1 a max f p x

Given Stigenice xitraxsi.fif i i


Icf p f fix px 1 x2 dx
S if x p x 1 25 dx
p1 11
T.im Y1fx
1 oct p Icf p 2 fix p x
Ecf 19
3 3
6 a
q x 51115 dx
3
X5 11 1 1 1 1 1 0

q 5115 3 3 7X dx
Ex Ix É É ÉÉ 0

4
b Q f 0 7

É C F 7 1 E1 to E 7 1751
4
2 5 7 FF

Q f 1 f o since off is exact for degree up to 5

You might also like