MATH 251 Final Multiple Previouses, Fall 2015
American University of Beirut · Numerical Computing · 245 pages
Showing the first 10 of 245 pages. Download the PDF to see all of it.
More MATH 251 files
- Final No Solution · Spring 2012Final exam · with solutionView
- Final Without Solution · Spring 2011Final exam · with solutionView
- Final · Fall 2011Final examView
- Final · Fall 2010Final examView
- Final · Fall 2006Final examView
- Final · Fall 2003Final examView
- Syllabus · Summer 2018LabView
- Syllabus · Summer 2018LabView
Show the text of this final exam
CMPS 251: Numerical Computing
February 2nd, 2006
Final Exam
Instructors: F. Abu Salem and G. Turkiyyah
Name:
Duration: 120 minutes
Notes:
1. You are allowed to use no more than two A4 pages of notes (front and back).
2. This exam consists of seven questions. Make sure you have all of them.
Question 1
(8pts)
(a) Let f be an infinitely differentiable function in a closed interval I = [α, β]. Let h be
any value such that x + h ∈ I and consider a, b ∈ R. Use Taylor series to show that f ′ can
be approximated using the formula
f ′(x) ≈
1
(b − a)h [bf(x + h) − f(x + ah) − (b − 1)f(x)]
(1)
(5pts)
(b) Establish the error term for Equation (1) above.
(3pts)
Solution:
F-1
Solution cont’d:
F-2
Question 2
(9pts)
Consider the following system of equations:
x1 + αx2 − 3x3
=
7
12x1 + 12αx2 + x3
=
121
αx1 + 4x2 + 2x3
=
6
where α ∈ R. For which values of α does the above system possess
1. no solution?
(3pts)
2. infinitely many solutions?
(3pts)
3. a unique solution (to be determined if it exists)?
(3pts)
Solution:
F-3
Solution cont’d:
F-4
Question 3
(21pts)
A symmetric pentadiagonal system is a pentadiagonal system in which the subdiagonals are
the same as the superdiagonals.
(a) Develop a pseudo-code to solve a symmetric pentadiagonal system using scaled partial
pivoting.
(7pts)
(b) Determine the operational count (run-time in terms of the input size) of your pseudo-
code.
(7pts)
(c) Is this more efficient than the pseudo-code for solving general pentadiagonal systems?
Justify your answer in terms of operational and/or spatial costs, whenever applicable. (7pts)
Solution:
F-5
Solution cont’d:
F-6
Question 4
(18pts)
(a) What is the minimum number of sub-intervals required to insure that the error in
approximating
� 2
1 ln x3dx using the trapezoid rule is less than 5 × 10−5?
(5pts)
(b) Consider the integral
� 1
0 exdx.
• Use the trapezoid rule to find the value of the integral with 2, 4, and 8 sub-intervals.
(5pts)
• Use Romberg integration to obtain the best approximation of the integral from the
results above.
(5pts)
• What is the order of the approximation of the Romberg rule above? (i.e., what is the
value of k if the error is written as O(hk) where h is the interval size).
(3pts)
Solution:
F-7
Solution cont’d:
F-8
Question 5
(20pts)
(a) Consider the trapezoid rule for the interval [0, 1] using n + 1 equally spaced points.
Explain why the composite trapezoid rule can be expressed as
� 1
0
f(x)dx ≈ h
2
�
f(0) + 2
n−1
�
i=1
f
� i
n
�
+ f(1)
�
where h is the step size.
(5pts)
(b) Rewriting the above expression as
� 1
0
f(x)dx ≈
n
�
i=0
Aif
� i
n
�
how would the Ai’s be defined?
(5pts)
(c) Consider the composite trapezoid rule for double integration of bivariate functions over
the unit square [0, 1] × [0, 1]:
� 1
0
� 1
0
f(x, y)dxdy ≈
n
�
i=0
n
�
j=0
AiAjf
� i
n, j
n
�
Use the above expression to develop a pseudo-code approximating
� �
e−(x2+y2)dxdy
over the unit square.
(10pts)
Solution:
F-9
Solution cont’d:
F-10
Question 6
(12pts)
Consider an iterative solution of the following 2 × 2 set of linear equations:
�3
1
1
3
� �x1
x2
�
=
�1
1
�
(a) Determine the Jacobi iteration matrix.
(4pts)
(b) Will Jacobi converge? Why or why not?
(4pts)
(c) Perform one iteration of Jacobi with the starting value x0 = (0, 0).
(4pts)
Solution:
F-11
Solution cont’d:
F-12
Question 7
(12pts)
(a) Determine the values of a and b that make the function
f(x) =
� x2
x ∈ [0, 1]
1
2(x − 1)2 + a(x − 1) + b
x ∈ [1, 3]
a quadratic spline.
(4pts)
(b) In class, we considered the problem of interpolating n + 1 data points with co-
ordinates (xi, yi), i = 1, · · · , n + 1, using a quadratic spline Q(x).
The continuity and
smoothness conditions at x allowed us to express the n spline segements as:
qi(x) =
zi+1 − zi
2(xi+1 − xi)(x − xi)2 + zi(x − xi) + yi,
x ∈ [xi, xi+1]
where zi+1 = 2 yi+1−yi
xi+1−xi − zi, zi = Q′(xi). In order to determine the parameters zi uniquely
we needed one additional condition. In class, we imposed z1 = 0 and used it to compute
the remaining zi’s.
• Explain how you would compute the unknown coefficients zi if the extra condition
becomes alternatively z1 = z2.
(4pts)
• What is the geometric interpretation of this condition?
(4pts)
Solution:
F-13
Solution cont’d:
F-14
AMERICAN UNIVERSITY OF BEIRUT
Mathematics Department-FAS
MATH 251
FINAL EXAM
Fall 2013-2014
Closed Book, 2hours
STUDENT NAME
ID NUMBER
Problem
Out of
Grade
1
20
2
20
3
20
4
25
5
15
TOTAL
100
1
1. (20 points) Consider the following Initial value Problem:
(IV P)
� dy
dt = 2et − y ; t ∈ [1.00, 2.00]
y(1) = 0
To solve (IVP)
(a) (5 pts)(IVP) is first solved on [1.00 , 1.25] using 1 step of the
discrete scheme of the first order Runge Kutta method -(Euler’s
method) : (RK1).
• Write the formulae of this scheme:
(RK1)
� ................................................................
yi+1 = ..................................................
• Use 1 step ONLY of this scheme to approximate y(1.25)
with 5 significant digits and rounding to the closest.
i
ti
yi
k1
yi+1
0
1
.
.
.
(b) (7 pts) (IVP) is then solved on [1.25 , 1.75] using 2 steps of the
discrete scheme of the 2nd order Runge Kutta method - Trape-
zoid Rule (Heun’s method): (RK2.T).
• Write the formulae of this scheme:
(RK2.T)
...............................................................
................................................................
yi+1 = ....................................................
• (7 pts)Use 2 steps ONLY of this scheme to approximate
y(1.50) and y(1.75) with 5 significant digits and rounding to
2
the closest..
i
ti
yi
k1
k2
yi+1
1
1.25
.
.
.
.
2
.
.
.
.
.
(c) (5 pts) (IVP) is then solved on [1.75 ,2.00] using the 4th order
discrete Runge Kutta scheme given by:
(RK4)
k1 = f(ti, yi)
k2 = f(ti + h
2, yi + h
2k1)
k3 = f(ti + h
2, yi + h
2k2)
k4 = f(ti + h, yi + hk3).
yi+1 = yi + h
6(k1 + 2k2 + 2K3 + k4)
Use 1 step ONLY of this scheme to approximate y(2.00) with 5
significant digits and rounding to the closest.
i
ti
yi
k1
k2
k3
k4
yi+1
3
1.75
.
.
.
.
(d) (1pt) The discrete solution of (IVP) is
Y4 = {y0 = 0, ......................................................................................................}
3
2. (20 points) Consider the following set of data:
Dn = {(xi, yi)|i = 0, ..., n where yi = f(xi) , and xi+1−xi = h, 0 < h ≤ 1}
(a) (7
points)
Write
first
the
Central
difference
formula
ψh ≡ ψh(f(xi)) that approximates the first derivative f ′(xi), ∀i =
1, 2, ..., n − 1. Assuming then that f is differentiable up to any or-
der, derive the expression of the infinite error series
ϵ(h) = c1hα1 + c2hα2 + c3hα3 + ....
given that: f ′(xi) = ψh + ϵ(h), by determining the values of the
exponents {α1, α2, α3, ...}.
• ψh ≡ ψh(f(xi)) =
• Derive the Error series ϵ(h) :
ϵ(h) =
4
(b) (6 points) Based on the Central difference formula, derive Richard-
son extrapolation operators of orders 1 and 2 and the order of their
error series.
• 1st order Richardson extrapolation operator ψ1
h(f(xi)) :
ψ1
h ≡ ψ1
h(f(xi)) =
Corresponding Error = O(...........)
• 2nd order Richardson extrapolation operator ψ2
h(f(xi)):
ψ2
h ≡ ψ2
h(f(xi)) =
Corresponding Error = O(...........)
5
(c) (7 pts) For the purpose of approximating f ′(2.0), we consider the
following table Dn = {(xi, yi)|i = 0, 1, ..., n} associated with a
function f(x), i.e., yi = f(xi), i = 1, ..., n
i
xi
yi = f(xi)
0
1.6
3.803929 × 10+01
1
1.7
4.745912 × 10+01
2
1.8
5.880257 × 10+01
3
1.9
7.240824 × 10+01
4
2.0
8.866867 × 10+01
5
2.1
1.080384 × 10+02
6
2.2
1.310432 × 10+02
7
2.3
1.582903 × 10+02
8
2.4
1.904805 × 10+02
Fill in the empty slots in the following table adequately, starting
with h0 = 0.4.
Express all the results obtained with 5 significant digits and
rounding to the closest.
h
ψh(.)
ψ1
h(.)
ψ2
h(.)
h0 = 0.4
XXXXX
XXXXX
h0/2
XXXXX
h0/4
Best approximation to f ′(2.0) :
6
3. (20 points) Consider the function
erf(x) =
2
√π
� x
0
e−t2 dt
Let I = erf(1).
(1)-(5 pts) Determine the minimum number of partition points needed
to approximate I by means of the Composite Simpson’s rule, if the
absolute error in this approximation verifies:
|ϵS| < 1
210−2
7
(2)-(5 pts) Approximate I by means of the Composite Simpson’s Rule
using the number of equi-spaced partition points found in part (1) above
.
Express your answer with a precision p = 5 with rounding to the closest.
8
(3)- (5 pts)Assume h = b−a
2i , i = 0, 1, 2, .... Given that:
I = S(h) + s1h4 + s2h6 + ..... + sjh2j+2 + ....
Derive the first order Romberg extrapolation formula based on Simp-
son’s rule rule.
S1(h) =
(4)- (5 pts) Apply this formula to the previous result obtained in (a-3)
in order to improve the approximation of I .
Do not compute the final answer:
Write only the detailed formula that should be used with the adequate
numerical values of h.
9
4. (25 points) Consider the following set of data
Dn = {(xi, yi) for i = 0, ..., n|x0 < x1 < ... < xn and yi = f(xi)}
where the nodes are not necessarily equally spaced.
(a) (7 pts) Based on the set Dn, derive the general equations of the
Non Natural Quadratic spline function S(x), that approxi-
mate the function f(x).
10
(b) (6 pts) Use the results obtained in (a) to write the equations of
the Non Natural Quadratic Spline S(x) that interpolates the
set of data
D2 = {(0, 1), (0.25, 4/5), (0.5, 2/3), (0.75, 4/7), (1, 1/2)}
and fill in the following table:
N.B.Express the results in fractions.
i
xi
yi
zi
[xi, xi+1]
0
0.00
1
.
.
1
0.25
4/5
.
.
2
0.50
2/3
.
.
3
0.75
4/7
.
.
4
1.00
1/2
.
.
S(x) =
11
(c) (7 pts)Use the equations of the Quadratic Spline S(x) obtained in
(b), to approximate the integral I =
� 1
0 f(x)dx
12
(d) (5 pts)Let
Ik =
� xk+1
xk
f(x)dx ≈ Qk =
� xk+1
xk
Sk(x)dx
where Sk(x) is the equation of the Quadratic Spline on the interval
[xk, xk+1], ∀ k = 0, 1, ..., n − 1. Let also
I =
n−1
�
k=0
Ik ≈ Q(h) =
n−1
�
k=0
Qk
Given that on each interval [xk, xk+1],
Maxxk<x<xk+1|f(x) − Sk(x)| ≤ ckh3
prove that
|I − Q(h)| ≤
n−1
�
k=0
|Ik − Qk| ≤ C(b − a)h3
Hint: Prove first that |Ik − Qk| ≤ ch4
13
5. (15 points) We seek the approximation of r = a3/4, where 1 ≤ a < 2,
by seeking the positive root of a polynomial function p(x).
(a) (2 pts)For 1 ≤ a < 2, show that 1 ≤ r < 2.
(b) (3 pts)Write Newton’s iterative formula: rn+1 = g(rn). Show then
graphically that
lim
n→∞ rn = r, ∀r0 > 0.
14
(c) (5 pts)For r0 = 2, show that the resulting Newton’s sequence {rn}
is decreasing.
Hint Show that rn+1 − rn =
1
4r3n(a3 − r4
n), n ≥ 0
(d) (5 pts) Show that the convergence of rn to r is quadratic, by
finding C such that:
|rn+1 − r| ≤ C|r − rn|2
15
AMERICAN UNIVERSITY OF BEIRUT
Mathematics Department-FAS
MATH 251
FINAL EXAM
Fall 2014-2015
Closed Book, 2hours
STUDENT NAME
ID NUMBER
SECTION
Problem
Out of
Grade
1
15
2
25
3
20
4
20
5
10
TOTAL
100
1
1. (15 points) Consider the following Initial value Problem:
(IV P)
� dy
dt = 2y + et ; t ∈ [0, 1.00]
y(0) = 2
(a) (5 points)(IVP) is first solved on [0 , 0.25] using 1 step of the dis-
crete scheme of the 2nd order Runge Kutta method (RK2.M):
Midpoint rule that is also referred to as Modified Euler method.
• Write the formulae of this scheme:
(RK2.M)
................................................................
................................................................
yi+1 = ..................................................
• Use 1 step ONLY of this scheme to approximate y(0.25)
with 5 significant digits and rounding to the closest.
i
ti
yi
k1
k2
1
0
.
.
.
2
.
.
XXX
XXX
(b) (7 points) (IVP) is then solved on [0.25 , 0.75] using 2 steps of the
discrete scheme of the 2nd order Runge Kutta method (RK2.T):
Trapezoid Rule also referred to as Heun’s method.
• Write the formulae of this scheme:
(RK2.T)
...............................................................
................................................................
yi+1 = ....................................................
• (7 pts)Use 2 steps ONLY of this scheme to approximate
y(0.50) and y(0.75) with 5 significant digits and rounding to
2
the closest.
i
ti
yi
k1
k2
1
0.25
.
.
.
2
.
.
.
.
3
.
.
XXX
XXX
(c) (3 points) (IVP) is then solved on [0.75 ,1.00] using one step of
the 4th order discrete Runge Kutta scheme given by:
(RK4)
k1 = f(ti, yi)
k2 = f(ti + h
2, yi + h
2k1)
k3 = f(ti + h
2, yi + h
2k2)
k4 = f(ti + h, yi + hk3).
yi+1 = yi + h
6(k1 + 2k2 + 2K3 + k4)
Use 1 step ONLY of this scheme to approximate the value of
y(1.00) with 5 significant digits and rounding to the closest.
i
ti
yi
k1
k2
k3
k4
4
0.75
.
.
.
.
.
5
.
.
XXX
XXX
XXX
XXX
3
2. (25 points)
(a) (7 points)Consider the definite integral:
I =
� 1
0
sin(x2) dx.
Approximate I by the Composite trapezoidal Rule with 5 equally
spaced partition points. Express the result with 5 significant digits
and rounding to the closest.
Find also an upper bound to the absolute value of the error in this
approximation.
N.B Angles are evaluated in radians.
• I ≈
• Upper bound to the absolute Error:
4
(b) (8 points)Let I =
� b
a f(x) dx, with f ∈ Ck[a, b], ∀k > 0.
Consider the following set of data:
Dn = {(xi, yi)|i = 0, 1, ..., n = 2m, where a = x0, b = xn, and yi = f(xi)}
where the x-coordinates are equally spaced with h =
b−a
n
and
n = 2i, i ∈ N.
i. Write the Romberg extrapolation formulae of orders 1,2 then
k > 2, based on the Composite Trapezoidal rule (Do not de-
rive the formulae):
• R(1)(h) =
• R(2)(h) =
........
• k ≥ 2, R(k)(h) =
ii. Prove that the 1st Romberg operator applied to the composite
Trapezoid rule is equivalent to Simpson’s rule, that is prove
that:
R(1)(h) = S(h) = 2
3M(h) + 1
3T(2h).
5
(c) (10 points) In order to estimate the integral I =
� b
a f(x)dx using
Romberg integration up to order k ≥ 1, given the MATLAB function
that approximates I using the Composite Trapezoidal rule:
function I =CompositeTrapez(f,a,b,h)
% Input: function f of one variable
%
2 real numbers a, b (a<b)
%
h positive number with n=(b-a)/h integer >=1
% Output: The composite trapezoidal rule
approximation I
n=(b - a)/h;
sum=f(a)+f(b);
for i=1:n-1
sum=sum+2*f(a+i*h);
end
I=sum*(h/2);
Complete then on the next page the MATLAB function that ap-
plies k iterations of the Romberg process based on the Composite
Trapezoidal rule. The results are displayed in a lower triangular
matrix R of size (k + 1) × (k + 2). (Call for the previous function
if adequate)
6
function R = RombergCompositeTrapezoid(f,a, b, k)
% Input: a function f, the limits of integration a and b and
%
k: the number of iterations
% Output: a lower triangular matrix R of size (k+1) x (k+2).
R = zeros(k+1,k+2) ;
% The first column of R consists of all values of h, starting
% with the largest value
h=(b-a) and ending at h=(b-a)/2^k
R(1,1)=b-a ;
% The elements of the second column of R are
all values of
% T(h)-approximations of I using the Composite Trapezoidal rule
% All
elements of the remaining columns of R from the 3rd till
% the last one are the Romberg approximations of all orders
% Display the
best approximation to I
7
3. (20 points) Let f be a differentiable function up to any order, i.e.
f ∈ Ck ∀ k.
(a) (5 points) The Central difference formula that approximates
the THIRD order derivative f ′′′(x), is given by:
ψh(f(x)) = 6[x − 2h, x − h, x + h, x + 2h]
where [x−2h, x−h, x+h, x+2h] is a third order divided difference.
Show that ψh(f(x)) = f(x+2h)−f(x−2h)−2[f(x+h)−f(x−h)]
2h3
8
(b) (5 points) Derive the expression of the infinite error series
ϵ(h) = c1hα1 + c2hα2 + c3hα3 + ....
given that: f ′′′(x) = ψh(f(x)) + ϵ(h), by determining the values
of the exponents {α1, α2, α3, ...}.
(c) (5 points) Let ψ(h) ≡ ψh(f(x)). Based on the Central difference
formula, derive Richardson extrapolation operator of first order
ψ(1)(h), and the order in h of its error.
9
(d) (5 points) For the purpose of approximating the third derivative,
f ′′′(2), consider the following table
D8 = {(xi, yi)|i = 0, 1, ..., 8}
associated with a function f(x), i.e., yi = f(xi), i = 0, ..., 8.
i
xi
yi = f(xi)
0
1.6
0.47000
1
1.7
0.53063
2
1.8
0.58779
3
1.9
0.64185
4
2.0
0.69315
5
2.1
0.74194
6
2.2
0.78846
7
2.3
0.83291
8
2.4
0.87547
Fill in the empty slots in the following table adequately, starting
with h0 = 0.2.
Express all the results obtained with 5 significant digits and
rounding to the closest.
h
ψ(h)
ψ(1)(h)
h0 = 0.2
XXXXX
0.1
Best approximation to f ′′′(2) :
10
4. (20 points) Consider the following set of data
Dn = {(xi, yi) for i = 0, ..., n|x0 < x1 < ... < xn and yi = f(xi)}
where the nodes are not necessarily equally spaced, with:
xi+1 − xi = hi+1 ∀i = 0, 1, ..., n − 1
(a) (10 points) Based on the set Dn, derive the general equations of
the Natural Cubic spline function S(x), that approximate the
function f(x).
11
(b) (10 points) Use the results obtained in (a) to write the equations
of the Natural Cubic Spline S(x) that interpolates the set of
data
D3 = {(1
2, 0), (3
2, 1), (5
2, 0), (3, 1)}
N.B. Express the computations in fractions and fill in the follow-
ing table to simplify the presentation of your results..
i
xi
yi
[., .]
[., ., .]
wi
zi
0
1
2
0
.
.
...
1
3
2
1
...
.
.
...
2
5
2
0
...
.
.
...
3
3
1
.
.
S(x) =
12
5. (20 points) Let a ∈ R, a > 0. Based on Newton’s method, we seek
an approximation of
r =
1
a1/4
by seeking the positive root of a NON polynomial function f(x),
that leads to an iterative formula with no division by the iterate.
(a) (5 points) Determine such a function f(x) and plot its graph.
13
(b) (5 points) Write Newton’s iterative formula: rn+1 = g(rn) then
determine the restrictions on the choice of the initial condition if
there are any. Justify your answer.
(c) (5 points) Show that for f ∈ C2, the iterates of Newton’s sequence
verify the following relation:
rn+1 − r = 1
2
f”(cn)
f ′(rn) (r − rn)2, ∀ n ≥ 0,
where cn is between r and rn.
14
...
(d) (5 points) In what follows, let a = 2 and let also the initial condi-
tion r0 = 0.5 < r. Check graphically that:
0 < rn < rn+1 < r
then use these estimates to show that:
|r − rn+1| ≤ 5|r − rn|2
15
1
AMERICAN
UNIVERSITY
OF
BEIRUT
Faculty
of
Arts
and
Sciences
‐
Mathematics
Department.
MATH
251
Final
Exam
(2hrs)
SPRING
2007
–
2008
STUDENT
NAME
.
ID
NUMBER
.
Problem
1
/
19
.
Problem
2
/
22
.
Problem
3
/
15
.
Problem
4
/
27
.
Problem
5
/
17
.
TOTAL
/
100
2
1
.
(a)
‐
Loss
of
significant
figures
may
result
in
the
computation
of
the
functions
for
certain
values
of
x.
Explain
and
specify
these
values
then
propose
alternative
functions
that
would
remedy
the
loss
of
significant
figures.
Note
that
:
(10
points)
(b)
‐
Let
f(x)
=
g(x)
–
h(x).
Using
the
results
in
(a),
find
a
way
to
calculate
accurately
f(x)
for
values
of
x
close
to
zero.
Find
then
.
(3
points)
3
(c)
–Solving
the
quadratic
equation
,
using
a
machine
that
carries
only
8
decimal
digits
causes
a
problem.
Investigate
this
example,
observe
the
difficulty,
and
propose
a
remedy
to
approximate
the
2
solutions
.
(6
points)
2
.
The
Reciprocal
of
the
cubic
root
of
a
positive
number
(i.e.
),
can
be
computed
by
an
iterative
formula
that
does
not
use
division
by
the
iterate
i
–
Establish
this
formula
by
applying
Newton’s
method
to
some
appropriate
function
f(x).
Determine
also
any
necessary
restrictions
on
the
choice
of
the
initial
value
of
the
iterative
procedure.
(9
points)
4
ii
–
Let
a
=
2.
Plot
the
graph
of
the
function
f,
and
give
a
graphic
justification
of
the
necessity
of
this
restriction
on
.
(4
points)
iii
–
For
a
suitable
choice
of
,
approximate
by
computing
the
first
3
iterates
by
Newton’s
formula.
(5
points)
5
iv
–
Prove
that
Newton’s
method
is
quadratic.
(4
points)
3.
Based
on
a
set
of
data
,
where
,
and
nh=2,
let
i.
Give
the
formula
for
the
composite
Trapezoid
Rule
T(h)
to
approximate
the
integral
I,
and
derive
the
expression
of
I
–
T(h)
in
terms
of
the
powers
of
h.
(8
points)
6
ii.
Obtain
an
upper
bound
on
the
absolute
error
when
we
compute
by
means
of
the
composite
Trapezoid
Rule
using
51
equally
spaced
points.
(7
points)
4.
Based
on
the
following
table
of
values
for
a
function
f(x)
i
x(i)
f(x(i))
0 0.000
1.0000000
1 0.125
0.9844964
2 0.250
0.9394131
3 0.375
0.8688151
4 0.500
0.7788008
5 0.625
0.6766338
6 0.750
0.5697828
7 0.875
0.4650432
8 1.000
0.3678794
7
Consider
the
approximation
the
integral
,
using
Romberg
integration
based
on
the
composite
trapezoid
rule
T(h).
i.
Derive
Romberg
subsequent
integration
formulae,
,
and
obtain
expressions
of
the
errors
,
and
.
(12
points)
8
ii.
Prove
that
the
Simpson’s
composite
rule
S(h)
is
equivalent
to
R1
(h).
(5
points)
iii.
Using
the
table
and
the
results
above,
fill
the
empty
slots
in
the
following
table.
(10
points)
h
M(h)
T(h)
R1(h)
R2(h)
R3(h)
1
0.5
0.25
0.125
9
10
5.
(a)
–
Fill
in
the
missing
statements
in
the
following
Matlab
program
(8
points)
function
p
=
Neville(X,
Y,
x)
%
Input
arguments:
a
vector
X
representing
the
distinct
xi
data
%
:
a
vector
Y
representing
the
corresponding
yi
=
f(xi
)data
%
:
x
is
a
vector
of
numbers
at
which
we
want
to
interpolate
%
Output
arguments:
p
=
p(x)
the
value
of
the
interpolation
polynomial
at
the
X
data
%
Assume
length
(X)
=
length
(Y)
>
0
%
Place
the
base
statement
of
the
recursion
n
=
length(X);
if
n
=
1
……………………………………………………………………………………………………………………….
else
%
Place
the
statements
of
the
recursion
X1
=
X(1
:
n1)
;
Y1
=
Y(1
:
n1);
X2
=
X(2
:
n)
;
Y2
=
Y(2
:
n);
p1
=
…………………………………………………………………………………………………………………
;
p2
=
…………………………………………………………………………………………………………………
;
p
=
………………………………………………………………………………………………………………….;
end
11
(b)
–
Show
the
various
steps
of
the
execution
process
of
this
program,
when
n
=
3
,
in
the
form
of
a
diagram:
(9
points)
p1
=
……….
p2
=
……….
12
AMERICAN UNIVERSITY OF BEIRUT
Mathematics Department-FAS
MATH 251
FINAL EXAM
SPRING 2010-2011
Closed Book, 2hours
STUDENT NAME
ID NUMBER
Problem
Out of
Grade
1
15
2
20
3
20
4
15
5
15
6
15
TOTAL
100
1
1. (15 points) For which values of x is there a difficulty in computing
f(x) ? What is the problem ? What remedy do you suggest ?
• (7 points)f(x) = x +
√
x2 + 4
• (8 points)f(x) = tan(x) − 1
(N.B. Determine only the smallest positive value of x that causes
a problem.)
2
2. (20 points) Consider the function f(x) = x2 − a where 1 < a ≤ 2.
(a) (6 points)Write Newton’s formula: rn = g(rn−1) that computes
the positive root of the function f. Is there any restriction on the
initial condition r0? Justify your answer.
(b) (2 points)Find the minimum number of flops necessary in com-
puting one iteration rn = g(rn−1).
3
(c) (6 points)Prove that:
(rn − r) =
1
2rn−1
(rn−1 − r)2
then show that for n ≥ 1:
|rn − r| = 1
2(rn−1 − r)2 < 1
2n(r0 − r)2n
(d) (6 points)Let r0 = 3/2. Find an estimate on the least value of n
for which:
|rn − r| < 2−50
Hint: Using the result in (c), show first that |rn − r| < 2(−2n)
4