Beruflich Dokumente
Kultur Dokumente
1. [3 points] You are designing a spherical tank to hold water for a small village in a developing country. The
volume of liquid it can hold can be computed as
3R − h
V = πh2
3
where V = volume [m3 ], h = depth of water in tank [m], and R = the tank radius [m]. If R = 3 m , what depth
must the tank be filled to so that it holds 30m3 ? In order to solve this problem follow the steps:
a) [0.5 point] Reformulate the problem into a root finding problem.
b) [1.5 points] Do three iterations of the Newton method. Choose the initial guess by yourself explaining
the reasons why you selected that value.
c) [1 points] Does x2 verify the stopping (convergence) criteria with tolx = 0.0005?
Solution
a) Taking
3R − h
V = πh2
3
and substituting V = 30 and R = 3 we obtain
9−h
30 = πh2
3
which can be arranged as
9πh2 − πh3 − 90 = 0
| {z }
f (h)
b) An initial guess should be selected in the interval [0, 6] which are the possible values of h. Here we select
h0 = 1.5
h1 = 2.0813772719
h2 = 2.0272465228
h3 = 2.0269057423
c) |r̃2 | = | h3h−h
3
2
| = 1.681284397633101e − 04 < 0.0005. Yes, it verifies the stopping criteria.
2. [3.5 points] The data below represents the bacterial growth in a liquid culture over a number of days.
Day 0 8 16
Amount ×106 67 98 149
a) [1 point] Find the pure interpolating polynomial using all the data points. Use Lagrange polynomials.
b) [1 point] Find the linear Spline that interpolates the given data. Use the shape functions Φi .
c) We want to approximate with the least squares criterion the given data using an interpolant of the form
p(x) = eβ x.
c.1) [1 point]Write down the equation to solve in order to find the value of β. Substitute the values of
the given data and simplify the most you can the equation.
c.2) [0.5 point]Solve the equation obtained in item c.1) using Newton root finding method with two
iterations and initial guess equal to 0.3.
Solution
a) Let’s define:
x0 = 0, x1 = 8, x2 = 16
then the pure interpolating polynomial using Lagrange polynomials is
p2 (x) = f (x0 )L0 (x) + f (x1 )L1 (x) + f (x2 )L2 (x) = 67L0 (x) + 98L1 (x) + 149L2 (x)
where
(x − 8)(x − 16) (x − 8)(x − 16)
L0 (x) = =
(−8)(−16) 128
(x − 0)(x − 16) −x(x − 16)
L1 (x) = =
(8 − 0)(8 − 16) 64
(x − 0)(x − 8) x(x − 8)
L2 (x) = =
(16 − 0)(16 − 8) 128
S(x) = f (x0 )Φ0 (x) + f (x1 )Φ1 (x) + f (x2 )Φ2 (x) = 67Φ0 (x) + 98Φ1 (x) + 149Φ2 (x)
c) The error term, in this case, is
n
X 2
f (xi ) − eβ xi ,
E(β) =
i=0
min E(β)
β
Note: Item c.2 has not been taken into account as the equation in item c.1 was analytically solvable.
Z 8
2
3. [3.5 points] Denote by I = e−x dx. Answer the following questions
0
Solution
b−a
a) As a = 0, b = 8, and n = 2 then h = n = 4 and x0 = 0, x0,1 = 2, x1 = 4, x1,2 = 6, x2 = 8. Applying
Simpson’s rule
h 4
I≈ (f (x0 ) + 2f (x1 ) + f (x2 ) + 4(f (x0,1 ) + f (x1,2 ))) = (f (0) + 2f (4) + f (8) + 4(f (2) + f (6))) = 0.7155
6 6
b−a
b) As a = 0, b = 8, and n = 4 then h = n = 2 and x0 = 0, x1 = 2, x2 = 4, x3 = 6, x4 = 8. Applying
Trapezoidal rule
h 2
I≈ (f (x0 ) + 2(f (x1 ) + f (x2 ) + f (x3 )) + f (x4 )) = (f (0) + 2(f (2) + f (4) + f (6)) + f (8)) = 1.0366
2 2
Thus, the value |f 00 (ξ)| must be bounded. Let’s start computing the second derivative of the function,
2
f (x) = e−x
2
f 0 (x) = −2xe−x
2 2 2
f 00 (x) = −2e−x + 4x2 e−x = (4x2 − 2)e−x
So,
2
|f 00 (x)| = |(4x2 − 2)||e−x |
On one hand, the function (4x2 − 2) is increasing in the interval [0, 8]. Therefore, its maximum is achieved
2
at x = 8. On the other hand, the function e−x is decreasing in the interval [0, 8]. Therefore its maximum
is achieved at x = 0. Thus, the second derivative can be bounded by
|f 00 (ξ)| ≤ 254
1 1 1 0 0 1 1 1
| {z } | {z }
mantissa exponent
= 0.875 · 27 = 112
El nombre més petit (en valor absolut) que es pot representar és
1 0 0 0 1 1 1 1
| {z } | {z }
mantissa exponent
[CG. 2] Representeu el nombre 53.375 en base 2 i coma flotant utilitzant una mantissa de 6 dı́gits (un d’ells
pel signe) i un exponent de 4 dı́gits (un d’ells pel signe). Utilitzeu arrodoniment per eliminació. Prenem la part
entera i anem dividint per 2:
53/2 = 26 i residu 1
26/2 = 13 i residu 0
13/2 = 6 i residu 1
6/2 = 3 i residu 0
3/2 = 1 i residu 1
1/2 = 0 i residu 1
Per tant el nombre 53 en base 2 s’escriu com: (110101)2 .
Prenem ara la part decimal i anem multiplicant per 2 (a cada pas agafem la part decimal del resultat anterior i
tornem a multiplicar per 2):
0.375 · 2 = 0.75
0.750 · 2 = 1.5
0.5 · 2 = 1.0
Per tant el nombre 0.375 en base 2 s’escriu com: (0.011)2 . Aixı́ tenim, (53.375)10 = (110101.011)2 = 0.1101010112 ·
2(6)10 = 0.1101010112 · 2(110)2 .
Com només tenim 6 dı́gits per la mantisa i un d’ells és pel signe, el nombre que s’emmagatzema a l’ordinador és:
0.110102 · 2(110)2 .