Uploaded by adam_s1366

COS2633-2017-1-201

advertisement
COS2633/201/1/2017
Tutorial Letter 201/1/2017
NUMERICAL METHODS 1
COS2633
Semester 1
Department of Mathematical Sciences
This tutorial letter contains solutions
for assignment 01
BAR CODE
Learn without limits.
university
of south africa
Introduction
By this time you should have received the following tutorial matter. If you have not received all these
tutorial matter, please contact the Department of Dispatch at the telephone number given in the
inventory you received upon registration.
Tutorial letters:
• COS2633/101/3/2017 General information about the module and the assignments
• COS2633/102/3/2017 Background material
• COS2633/201/1/2017 This letter: Solutions to assignment 1
1
Discussion
1.1
The marking
The marking of this assignment was automated and performed at the assignment division of UNISA.
The result published to students is therefore not, in any case, under lecturers control. All the questions
were marked.
Next we present a model solution on which the marking was based. Note that a list of errata was
provided and we are taking it into consideration as well.
Question 1
The following development will guide you through the answer to question (1). We consider the
2
functions g1 = y + x − x2 and g2 = 1 + x − xy . Although there is no specific interval for the domain of
the function, their general behaviour can still be investigated. In section 4 of the background material
(the tutorial COS2633/102/3/2017) we discuss the construction of rough graphs of functions. In
particular, we consider
• the existence, discontinuities and singularities;
• symmetries;
• boundedness;
• behaviour at very small and very large values of x and behaviour at 0;
• roots and zeros;
• turning points; and
• other points
of our functions. So let us investigate the behaviour of the above functions for y = 3.
Function g1 (x) = 3 + x − x2
• It exists for all x ∈ R and it has no discontinuities (note that the notion of discontinuity is only
relevant in the domain of definition of the function) it has no singularity and is not symmetric
with respect to the y−axis, that is y1 (−x) 6= y1 (x) for some x ∈ R.
2
COS2633/201
• The limit exists. Observe that as x tends to zero g1 (x) approaches 3.
• Since g10 (x) = 1 − 2x and g100 (x) = −2, we see that g10 (x) has continuous first derivative.
Function g2 (x) = 1 + x −
x2
y
• It exists for all x, has no discontinuities and no singularities, since y is a an integer and y 6= 0.
g2 is not symmetric about the vertical axis.
• g2 is bounded on any closed interval in the domain (−∞, ∞).
• Also since g20 (x) = 1 − 2x/y and g200 (x) = −2/y, we see that g2 (x) has continuous first derivative.
For each of the functions above, we want to determine whether
the coreesponding fixed point iteration
√
√
scheme xk+1 = gi (xk ), i = 1, 2 is (locally) convergent to 3 and y respectively. Notice that
x = g1 (x) ⇐⇒ x = 3 + x − x2 ⇐⇒ 0 = 3 − x2
and
x = g2 (x) ⇐⇒ x = 1 + x −
x2
⇐⇒ 0 = y − x2
y
We have the following convergence condition: If g(x) and g 0 (x) are continous on an interval about a
root r of the equation x = g(x), and if |g 0 (x)| < 1 for all x in the interval, then
xn+1 = g(xn ), n = 0, 1, 2, 3 . . .
will converge to the root r, provided that x0 is chosen in the interval. Note that this is a sufficient
condition. So, in order to provide an appropriate answer to questions (1.1) through (1.5), we need to
do the following:
- calculate the derivative of each of the given functions
- establish the continuity of each function and its derivative
√
√
- find an interval about 3 and y, where |g10 (x)| < 1 and |g2 (x)| < 1 for all x in the intervals
respectively.
For
r=
(1)
√
3
g10 (x) = 1 − 2x
and
(2)
g20 (x) = 1 −
2x
y
Clearly, g1 (x), g10 (x), g2 (x) and g20 (x) are continuous functions for all interger, y 6= 0. Let us now
2
consider the graphs of g1 (x) = 3 + x − x2 and g(x) = x in figure 1, and g2 (x) = 1 + x − xy , y = 1, 2 . . . 4
and g(x) = x in figure 2 respectively. The fixed point of the respective schemes are the intersection
of the line g(x) = x with the curves g1 (x) and g2 (x) respectively.
From equations (1) and (2) we have;
3
(i) |g10 (x)| < 1 for 0 < x < 1, and
(ii) |g20 (x)| < 1 for 0 < x < y.
From (i) and (ii) above, and the stated convergence condition we conclude the following:
• For x√= g1 (x) convergence is not guaranteed because the inteval of convergence does not contain
r = 3 ≈ 1.732051
• For x = g2 (x) convegence is guaranteed if x0 ∈ (0, y) – in particular y = 3.
y
g(x) = x
−3
0
3
x
g1 (x) = 3 + x − x2
4
COS2633/201
y
g(x) = x
g2 (x) = 1 + x − x2 /4
g2 (x) = 1 + x − x2 /3
−3
0
3
x
g2 (x) = 1 + x − x2 /2
g2 (x) = 1 + x − x2 /1
Lastly, the Newton’s iterative scheme for f (x) = x2 − 3 is
xn+1 = xn −
x2n − 3
.
2xn
So, the fixed point iteration function, g3 (x), given by Newton’s method for this particular problem is;
g3 (x)x −
x2 − 3
.
2x
Table 1 shows the summary of the answers for question 1.
5
Questions: 1.1
Answers:
2
1.2 1.3
2
5
1.4 1.5
3
3
Table 1: Summary of Correct Answers for Question 1.
Question 2
To answer this question we need to do the following:
- Derive an appropriate mathematical expression of a word problem (for (2.1)).
- Apply Newton’s method with different starting points [2, 0, 1] (for (2.2)).
- Apply regular falsi method with starting points x0 = 0 and x1 = 7 for different number of
iterations [2, 4, 7, 14] (for (2.3)).
- Apply the secant method with starting points x0 = 8 and x1 = 10 for the following number of
iterations [2, 4, 6] (for (2.4)).
Let the two numbers be denoted by x and y . Then the word problem gives the two equations;
x + y = 20
and
√
x)(20 − x +
√
20 − x) − 155.55 = 0
√
√
We then find the zeros of the function f (x) = (x + x)(20 − x + 20 − x) − 155.55, using Newton,
regular falsi and secant methods.
(x +
(a) Applying Newton’s method with the corresponding starting points gives the following results in
table 2. Newton’s method involves calculating the derivative of the function whose zeros are to
be determined. The first derivative of the above function is a rational expression in x. Hence
starting the Newton’s method with x0 = 0 may lead to a division by zero (singular point). So
to remedy this situation we choose our innitial starting point to be away from zero (see table
3).
(b) Applying regular falsi method with the corresponding points gives the following results in table
4.
(c) Applying secant method with the corresonding starting points gives the following results in table
5.
Below is the summary of the answers for Question 2 (table 2).
Question:
Answer
2.1 2.2
(5) (3)
2.3
(3)
2.4 2.5
(4) (1)
Table 2: Summary of Correct Answers for Question 2.
6
COS2633/201
i
1
2
3
4
5
6
7
x0 = 0.001
0.3772026147
3.4820756435
5.8221275995
6.5149553556
6.5125584044
6.5128885687
6.5128432550
x0 = 1
4.3405099986
6.1549538556
6.5345638479
6.5097527872
6.5132715132
6.5127906318
6.5128567019
x0 = 2
5.0751680270
6.3764786187
6.5273004487
6.5108139118
6.5131271227
6.5128104819
6.512853976
Table 3: Newton’s method with starting points x0 = 0, 1, &2.
i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
xi
6.7979614400
6.6780903799
6.6080796328
6.5675547638
6.5442170035
6.5308162106
6.5231341321
6.5187345580
6.5162161954
6.5147751537
6.5153950705
6.5134790714
6.5132092833
6.5130549622
fi
2.7921070741
1.6480085463
0.9598158830
0.5547170281
0.3191780741
0.1831860714
0.1049833763
0.0601156064
0.0344070251
0.0196874150
0.0112632204
0.0064431426
0.0036856218
0.0021081966
Table 4: Regular falsi method with starting points x0 = 0, x1 = 7
i
1
2
3
4
5
6
7
xi
fi
3.8914033657 -37.5523665187
8.0434558027 12.1514547187
7.0283733418 4.8703772028
6.3493756982 -1.7115480640
6.5259406173 0.1335737429
6.5131585684 0.0031672368
6.5128481255
0.000000613
Table 5: secant method with starting points x0 = 8, x1 = 10
REFERENCES
[1] Richard L. Burden and Douglas J. Faires. Numerical Analysis. ninth edition. BROOKS/COLE,
CENGAGE learning 2011.
7
Download