Mathematics 3 Curs 2014-2015/Q1 First exam. 30/10/14 ......Mathematics 3 Curs 2014-2015/Q1-First...
Transcript of Mathematics 3 Curs 2014-2015/Q1 First exam. 30/10/14 ......Mathematics 3 Curs 2014-2015/Q1-First...
-
Mathematics 3Curs 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. Thevolume of liquid it can hold can be computed as
V = πh23R− h
3
where V = volume [m3], h = depth of water in tank [m], and R = the tank radius [m]. If R = 3m , what depthmust 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 explainingthe reasons why you selected that value.
c) [1 points] Does x2 verify the stopping (convergence) criteria with tolx = 0.0005?
Solution
a) Taking
V = πh23R− h
3
and substituting V = 30 and R = 3 we obtain
30 = πh29− h
3
which can be arranged as9πh2 − πh3 − 90︸ ︷︷ ︸
f(h)
= 0
b) An initial guess should be selected in the interval [0, 6] which are the possible values of h. Here we selecth0 = 1.5
h1 = 2.0813772719
h2 = 2.0272465228
h3 = 2.0269057423
c) |r̃2| = |h3−h2h3 | = 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 16Amount ×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 ofthe 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 twoiterations 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
L0(x) =(x− 8)(x− 16)
(−8)(−16)=
(x− 8)(x− 16)128
L1(x) =(x− 0)(x− 16)(8− 0)(8− 16)
=−x(x− 16)
64
L2(x) =(x− 0)(x− 8)
(16− 0)(16− 8)=x(x− 8)
128
b) Using the Lagrange polynomial
L00 =x− 80− 8
=8− x
8
the Φ0(x) basis function is defined as
Φ0(x) =
{8−x8 x ∈ [0, 8]0 otherwise
Using the Lagrange polynomials
L01 =x− 08− 0
=x
8
L10 =x− 168− 16
=16− x
8
the Φ1(x) basis function is defined as
Φ1(x) =
x8 x ∈ [0, 8]
16−x8 x ∈ [8, 16]0 otherwise
Using the Lagrange polynomial
L11 =x− 816− 8
=x− 8
8
the Φ2(x) basis function is defined as
Φ2(x) =
{x−88 x ∈ [8, 16]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
E(β) =
n∑i=0
[f(xi)− eβxi
]2,
and we want to solve the following minimization problem
minβE(β)
Thus, the β parameter is determined imposing
∂E
∂β=
n∑i=0
−2eβxi[f(xi)− eβxi
]= 0
After some algebra it reads, (n∑i=0
x2i
)eβ =
n∑i=0
xif(xi)
therefore, substituting the given data,
320eβ = 3168 ⇒ eβ = 3168320
and using the natural logarithm
ln eβ = ln3168
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.
-
3. [3.5 points] Denote by I =
∫ 80
e−x2
dx. Answer the following questions
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 Trapezoidalcomposite 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 withan absolute error (in absolute value) smaller than 0.001?
Hint: ETC(h) = −f ′′(ξ) (b−a)12 h2
Solution
a) As a = 0, b = 8, and n = 2 then h = b−an = 4 and x0 = 0, x0,1 = 2, x1 = 4, x1,2 = 6, x2 = 8. ApplyingSimpson’s rule
I ≈ h6
(f(x0) + 2f(x1) + f(x2) + 4(f(x0,1) + f(x1,2))) =4
6(f(0) + 2f(4) + f(8) + 4(f(2) + f(6))) = 0.7155
b) As a = 0, b = 8, and n = 4 then h = b−an = 2 and x0 = 0, x1 = 2, x2 = 4, x3 = 6, x4 = 8. ApplyingTrapezoidal rule
I ≈ h2
(f(x0) + 2(f(x1) + f(x2) + f(x3)) + f(x4)) =2
2(f(0) + 2(f(2) + f(4) + f(6)) + f(8)) = 1.0366
c) No, because the function to be integrated is not a polynomial.
d) We are looking for the value n such that
|ETC(h)| = |f ′′(ξ)|(b− a)
12
(b− an
)2= |f ′′(ξ)| (8)
3
12
(1
n2
)< 0.001 (1)
Thus, the value |f ′′(ξ)| must be bounded. Let’s start computing the second derivative of the function,
f(x) = e−x2
f ′(x) = −2xe−x2
f ′′(x) = −2e−x2
+ 4x2e−x2
= (4x2 − 2)e−x2
So,
|f ′′(x)| = |(4x2 − 2)||e−x2
|
On one hand, the function (4x2 − 2) is increasing in the interval [0, 8]. Therefore, its maximum is achievedat x = 8. On the other hand, the function e−x
2
is decreasing in the interval [0, 8]. Therefore its maximumis achieved at x = 0. Thus, the second derivative can be bounded by
|f ′′(ξ)| ≤ 254
when ξ ∈ [0, 8].Using the obtained bound for the second derivative and isolating n from equation 1 we obtain:√
254(8)3
12
(1
0.001
)< n.
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 al’exponent i 4 bits (un d’ells pel signe) per a la mantissa. Calculeu els nombres màxims i mı́nims (en valorabsolut) que es poden emmagatzemar en aquest format.El nombre més gran (en valor absolut) que es pot representar és
1 1 1 0︸ ︷︷ ︸mantissa
0 1 1 1︸ ︷︷ ︸exponent
que representa el nombre
+(0.111)2 · 2+(111)2 =(2−1 + 2−2 + 2−3
)· 22
0+21+22
= 0.875 · 27 = 112
El nombre més petit (en valor absolut) que es pot representar és
1 0 0 0︸ ︷︷ ︸mantissa
1 1 1 1︸ ︷︷ ︸exponent
que representa el nombre
+(0.100)2 · 2−(111)2 = 2−1 · 2−(20+21+22)
= 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’ellspel signe) i un exponent de 4 d́ıgits (un d’ells pel signe). Utilitzeu arrodoniment per eliminació. Prenem la partentera i anem dividint per 2:
53/2 = 26 i residu 126/2 = 13 i residu 013/2 = 6 i residu 16/2 = 3 i residu 03/2 = 1 i residu 11/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 itornem a multiplicar per 2):
0.375 · 2 = 0.750.750 · 2 = 1.50.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 .