Uploaded by 卢弘毅

HW6

advertisement
SC Computing
by Hongyi Lu 11712009
Exercise 1.
(1)
Z
(2)
Z
(3)
0
sin(x) dx = 0.569902
1 + x4
1
0
Z
Exercise 2.
1
e−x(1 + x)−5dx = 0.191514
1
−1
e−x cos(x)dx = 0.690194
2
By change of variable we have
Z
1
f (x)ln(x)dx = r 2
0
Z
1
0
t r −1f (t r)ln(t)dt
The singular behavior of the original integrand is at x = 0, where the integrand will goes to −1. But after the
change of variable, the integrand become
t r −1ln(t)f (t r )
As we do not know f , here we just investigage t r −1ln(t), by L'Hôpital's rule (r > 1) we have
r −1 1
rt
ln(tr )
tr
= lim
t!0 t1−r
t!0 t1−r
r t2r −1
= lim
tr
t!0
= lim r t r −1
lim
t!0
= 0
As we can see the singularity disappear if r > 1, otherwise it not work.
In order to investigate the empirical behavior, we use a simple f = sin(x), the new integrand is t r −1ln(t)sin(t r).
1
Take stepsize h = 26 ; r 2 f0.1; 0.2; : : : 1.9; 2g. Do the emperical experiment, we have the error v.s r plot.
As we can see that the error is huge when r < 1 as expected since the singularity is not removed.
But when r > 1, the error become expected.
Exercise 3.
1
Firstly easy to verify, T0(x) = cos(0) = 1; T1(x) = cos(arccos(x)) = x.
Now when k > 1
Tk+1(x) + Tk −1(x) = cos((k − 1)arccos(x)) + cos((k + 1) arccos(x))
= 2cos(arccos(x))cos(k arccos(x))
= 2x cos(arccos(x))
= 2x Tk(x)
Exercise 4.
Since
Ln(x) = ex
d
(xne−x)
dxn
is at most order n.
It suffices to show that (Ln(x); xm)! = 0; 8m < n
Z
m
dn n −x
(x e )dx
dxn
0
Z 1 n−m
d
n −x)dx
= (−1)mm!
n−m (x e
0 dx
= 0
(Ln(x); xm)! =
xm
Hence we have (Ln(x); Lm(x)) = 0; 8m < n.
Exercise 5.
Write 'n in the following form
'n = Anxn + Bnxn−1 + Then by Theorem 1, we have
'n+1(x) = (anx + bn)'n(x) − cn'n−1(x)
an =
An+1
B
B
A
A
('n; 'n)!
; bn = an n+1 − n ; cn = n+1 2 n−1
An
An+1 An
('n+1; 'n+1)!
An
Let xk to be a zero of 'n and x1 < < xn we have
'n+1(xk) = −cn'n−1(xk)
As An > 0; An−1 > 0, it's easy to see that cn > 0, thus we have
'n+1(xk)'n−1(xk) < 0
As 'n+1 has at least n + 1 zeros hence the above inequality impiles the zeros of 'n+1 must fall between the
zeros of 'n
Exercise 6.
The orthogonal basis with weight
1
p
1 − x2
is the Chebyshev polynomials.
Tk = cos(k arccos(x))
In order to minimize
Z
We calculate the projection of f to P2.
1
[f (x) − p(x)]2
p
dx
1 − x2
−1
1
2
2
(f ; T1)!T1 + (f ; T2)!e2 + (f ; T3)!T3
= (f ; T1)! + (f ; T2)!x + (f ; T3)!(2x2 − 1)
P2(f ) =
= 1.5707 − 1.2732x + 0(2x2 − 1)
= 1.5707 − 1.2732x
2
Exercise 7.
(1)
(Si; Sj )! =
1
(i + 1)(j + 1)
Z
1
p
−1
Z 1
0
1 − x2 Ti+1
(x)Tj0+1(x)dx
1
(i + 1)(j + 1)sin((i + 1)arccos(x))sin((j + 1)arccos(x))d(arccos(x))
(i + 1)(j + 1) −1
Z 1
=
sin((i + 1)arccos(x))sin((j + 1)arccos(x))d(arccos(x))
−1
Z =
sin((i + 1))sin((j + 1))d
(0
0 i=
/j
=
i
=
j
2
=
(2)
1
(sin(n arccos(x)) + sin((n + 2)arccos(x)))
1 − x2
1
= 2p
(sin((n + 1)arccos(x))cos(arccos(x)))
1 − x2
1
= 2x p
sin((n + 1)arccos(x))
1 − x2
Sn−1 + Sn+1 = p
= 2x Sn
(3)
p
It's equivalent to compute the projection of f to P2 with weight 1 − x2 . Thus using Chebyshev Polynomial
of Second Kind.
2
Pn(f ) = ((f ; S1)!S1 + (f ; S2)!S2 + + (f ; Sn)!Sn)
Exercise 8.
Error
0.9341
0.8633
0.8248
0.7945
0.7886
N
2
4
8
16
32
Table 1. Error Table
The order is about 0.1, the slow is probability because we does not choose the right wave. The hat function
in mode space is highly concentrated on a single wave, and our choice does not include that wave.
Exercise 9.
Suppose the derivative can be written in the form
h2f 00(x) =
3
X
Aif (x + i h)
i=−3
Using Taylor expansion and solve the equations, we have
A−3 =
Then we have
1
3
3
49
3
3
1
; A−2 = − ; A−1 = ; A0 = − ; A1 = ; A2 = − ; A3 =
90
20
2
18
2
20
90
f 00(x) =
Numerical experiment
3
1 X
Aif (x + i h) + O(h6)
2
h
i=−3
1. h = 0.1: E(f 00) = 2.57 10−5
2. h = 0.05: E(f 00) = 4.06 10−7
3. h = 0.025: E(f 00) = 6.37 10−9
The order is about
Hence it is sixth order.
log 2(63.73) = −6
3
Download