Sie sind auf Seite 1von 5

Mathematics 3

Curs 2014-2015/Q1 - First exam. 30/10/14


Group M1 – Lecturer: Yolanda Vidal
Name: Calculator:

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

b) Using the Lagrange polynomial


x−8 8−x
L00 = =
0−8 8
the Φ0 (x) basis function is defined as
8−x

8 x ∈ [0, 8]
Φ0 (x) =
0 otherwise

Using the Lagrange polynomials


x−0 x
L01 = =
8−0 8
x − 16 16 −x
L10 = =
8 − 16 8
the Φ1 (x) basis function is defined as
x

 8 x ∈ [0, 8]
16−x
Φ1 (x) = 8 x ∈ [8, 16]
0 otherwise

Using the Lagrange polynomial


x−8 x−8
L11 = =
16 − 8 8
the Φ2 (x) basis function is defined as
x−8

8 x ∈ [8, 16]
Φ2 (x) =
0 otherwise

Finally, the linear Spline can be written as:

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

and we want to solve the following minimization problem

min E(β)
β

Thus, the β parameter is determined imposing


n
∂E X
−2eβ xi f (xi ) − eβ xi = 0
 
=
∂β i=0

After some algebra it reads, !


n
X n
X
x2i eβ = xi f (xi )
i=0 i=0

therefore, substituting the given data,


3168
320eβ = 3168 ⇒ eβ =
320
and using the natural logarithm
3168
ln eβ = ln
320
we find out the value of β, that is
β = 2.2925347571

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

a) [1 point] Approximate I using the composite Simpson method with n = 2.


b) [1 point] Approximate I using the composite Trapezoidal method with n = 4.
c) [0.5 points] Is it possible to obtain the exact value of the proposed integral using Simpson or Trapezoidal
composite methods? It is necessary to justify the answer.
d) [1 point] When using the Trapezoidal rule, how many intervals, n, are necessary to approximate I with
an absolute error (in absolute value) smaller than 0.001?
Hint: ET C (h) = −f 00 (ξ) (b−a)
12 h
2

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

c) No, because the function to be integrated is not a polynomial.


d) We are looking for the value n such that
2
(8)3
  
(b − a) b−a 1
|ET C (h)| = |f 00 (ξ)| = |f 00 (ξ)| < 0.001 (1)
12 n 12 n2

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

when ξ ∈ [0, 8].


Using the obtained bound for the second derivative and isolating n from equation 1 we obtain:
s
(8)3
 
1
254 < n.
12 0.001

Performing the calculations,


3292 < n.
Thus, at least 3293 intervals are necessary to obtain an error smaller than 0.001.
GENERIC COMPETENCY - 5% of the final grade of the subject
[CG. 1] Un nombre en format minifloat usa 8 bits de memòria. Utilitzeu 4 bits (un d’ells pel signe) per a
l’exponent i 4 bits (un d’ells pel signe) per a la mantissa. Calculeu els nombres màxims i mı́nims (en valor
absolut) que es poden emmagatzemar en aquest format.
El nombre més gran (en valor absolut) que es pot representar és

1 1 1 0 0 1 1 1
| {z } | {z }
mantissa exponent

que representa el nombre


0 1 2
+(0.111)2 · 2+(111)2 = 2−1 + 2−2 + 2−3 · 22 +2 +2


= 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

que representa el nombre


0
+21 +22 )
+(0.100)2 · 2−(111)2 = 2−1 · 2−(2
= 0.5 · 2−7 = 0.00390625

[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 .

Das könnte Ihnen auch gefallen