Beruflich Dokumente
Kultur Dokumente
DUE:
March 2, 2014
March 10, 2014 at 1:00pm
f (t)dt
of a function which can be differentiated arbitrarily many times everywhere in the interval [7/8, 25/8]. The function f has been evaluated
in the following points,
f (1)
5
f( )
4
3
f( )
2
7
f( )
4
f (2)
9
f( )
4
5
f( )
2
11
f( )
4
f (3)
= 0.266367400
= 0.295622750
= 0.308642948
= 0.307833065
= 0.296297436
= 0.277234152
= 0.253531641
= 0.227563149
= 0.201131426
(8)
(n)
IlR
-5.327347984e-01
-5.626648357e-01
-5.624197130e-01
-5.582731359e-01
(n)
IlR I
1.872e-02
-1.121e-02
-1.097e-02
-6.820e-03
(8)
(n)
IrR
-4.022628521e-01
-4.974288625e-01
-5.298017264e-01
-5.419641426e-01
(n)
IrR I
1.492e-01
5.402e-02
2.165e-02
9.489e-03
(4)
c. Find the mid-point sum, Imp
.
A:
n
1
2
4
(n)
Imp
-5.925948730e-01
-5.621745903e-01
-5.541265588e-01
(n)
Imp I
-4.114e-02
-1.072e-02
-2.673e-03
Page 2
(8)
(4)
n
1
2
4
8
(n)
Itr
-4.674988252e-01
-5.300468491e-01
-5.461107197e-01
-5.501186392e-01
(n)
Itr I
8.395e-02
2.141e-02
5.343e-03
1.335e-03
(8)
(n)
IS
-5.508961904e-01
-5.514653432e-01
-5.514546124e-01
(n)
IS I
5.572e-04
-1.192e-05
-1.193e-06
3
1
f. The exact result of the integral is I = sinh
sinh
. Rank the
3
1
results (a-e) according to accuracy.
A:
The exact result is included in the tables above. We find the
quality of the results in descending order:
S mp tr rR lR.
f (i + 1) = 0.6085560
I
4 i=0
4
2
COPYRIGHT: NIELS GRONBECH-JENSEN, UC DAVIS, 2014
R2
0
Page 3
(n)
IrR
1.407194484e+01
7.274378264e+00
4.703556427e+00
3.621846515e+00
(n)
IrR I
1.140e+01
4.599e+00
2.029e+00
9.468e-01
(n)
(n)
IlR
0.000000000e+00
2.384058440e-01
1.185570217e+00
1.862853410e+00
(n)
IlR I
-2.675e+00
-2.437e+00
-1.489e+00
-8.121e-01
(n)
(n)
Itr
7.035972420e+00
3.756392054e+00
2.944563322e+00
2.742349962e+00
(n)
Itr I
4.361e+00
1.081e+00
2.696e-01
6.735e-02
(n)
e. Calculate Imp
(f ), for n = 1, 2, 4, 8.
A:
n
1
2
4
8
(n)
Imp
4.768116881e-01
2.132734589e+00
2.540136603e+00
2.641316255e+00
(n)
Imp I
-2.198e+00
-5.423e-01
-1.349e-01
-3.368e-02
(n)
f. Calculate IS (f ), for n = 2, 4, 8 (notice that the minimum intervals for Simpson is n=2).
A:
n
1
2
4
8
16
(n)
IS
................
2.663198599e+00
2.673953744e+00
2.674945509e+00
2.674994157e+00
(n)
IS I
.........
-1.180e-02
-1.044e-03
-5.174e-05
-3.095e-06
3
COPYRIGHT: NIELS GRONBECH-JENSEN, UC DAVIS, 2014
Page 4
t1
t0
f (t)dt .
The attached sample code solves this problem with a left Riemann
sum, along with the first Richardson extrapolation. The code does
this for a sequence of increasing number of segments n so tn =
(t1 t0 )/n, such that convergence can be observed and Richardson
n = 2ng
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
(n)
IlR
1.000000000000000
1.112372435695794
1.166413628918445
1.192872487446321
1.205959577787193
1.212467412138600
1.215712393603079
1.217332649905064
1.218142219417056
1.218546864511338
1.218749152142928
1.218850287229825
1.218900852591053
1.218926134726108
1.218938775657244
1.218945096088721
1.218948256295915
1.218949836397410
1.218950626447616
1.218951021472541
1.218951218985038
(n)
(n)
1.218951416497434
1.218951416476929
1.218951416497414
1.218951410028102
1.218951416451738
1.218951416497235
1.218950466781565
1.218951395289875
1.218951416121084
1.218951416491358
1.218865507989908
1.218945156857086
1.218951005387826
1.218951390450256
1.218951414863789
(n)
(n)
(n)
(n)
(n)
(n)
(n)
the code seems to be giving the right result, and the Richardson
extrapolation seems to be giving it faster than the core method.
b. Revise the code for the trapezoid method. Run and verify.
A:
ng
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
n = 2ng
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
(n)
Itr
1.207106781186547
1.215925826289068
1.218190324215082
1.218760835094640
1.218903751611352
1.218939499050680
1.218948437059119
1.218950671633084
1.218951230281066
1.218951369943343
1.218951404858931
1.218951413587827
1.218951415770053
1.218951416315608
1.218951416451994
1.218951416486096
1.218951416494603
1.218951416496753
1.218951416497288
1.218951416497377
1.218951416497456
(n)
(n)
IS = R(1) [Itr ]
..................
1.218865507989908
1.218945156857086
1.218951005387826
1.218951390450256
1.218951414863789
1.218951416395265
1.218951416491072
1.218951416497060
1.218951416497436
1.218951416497460
1.218951416497458
1.218951416497462
1.218951416497460
1.218951416497456
1.218951416497463
1.218951416497439
1.218951416497470
1.218951416497466
1.218951416497406
1.218951416497482
c. Complete the Romberg table in the code; i.e., for each n, continue as many Richard extrapolations as possible. You should
probably decrease NG. Show the resulting output.
A:
We here have q = 2 and r = 2. See table to the left .
n
1
2
4
8
16
32
(n)
Itr
1.207106781186547
1.215925826289068
1.218190324215082
1.218760835094640
1.218903751611352
1.218939499050680
IS
Page 5
ng
0
1
2
3
4
5
(n)
(n)
(n)
5
COPYRIGHT: NIELS GRONBECH-JENSEN, UC DAVIS, 2014
ng
0
1
2
3
4
5
Page 6
(n)
Itr
1.207106781186547
1.215925826289068
1.218190324215082
1.218760835094640
1.218903751611352
1.218939499050680
q
2
1.96
1.99
2.00
2.00
(n)
(n)
= R(1) [Itr ]
S
1.218865507989908
1.218945156857086
1.218951005387826
1.218951390450256
1.218951414863789
(n)
R(2) [Itr ]
1.218950466781565
1.218951395289875
1.218951416121084
1.218951416491358
(n)
R(3) [Itr ]
1.218951410028102
1.218951416451738
1.218951416497235
(n)
R(4) [Itr ]
1.218951416476929
1.218951416497414
10
(n)
R(5) [Itr ]
1.218951416497434
12
4
3.77
3.92
3.98
5.48
5.81
7.14
The questions in this problem are sequential, such that each one builds
on the preceding. Attach code listing for each item.
6
COPYRIGHT: NIELS GRONBECH-JENSEN, UC DAVIS, 2014