You are on page 1of 5

Problem 2.

1
Part a)
An algorithm is said to be consistent if:
lim (x, ) = f (x)

Begin by manipulating the centred difference approximation of a derivative:


(x, ) =

f (x + ) f (x )
2

Take the Taylor expansion of f (x + ) and f (x )


f (x + ) = f (x) + f 0 (x) + f 00 (x)

3
2
+ f 000 (x)
+ H.O.Ta
2
6

f (x ) = f (x) f 0 (x) + f 00 (x)

2
3
f 000 (x)
+ H.O.Tb
2
6

and

Sub these back in to the centred difference approximation:


2

f (x) + f 0 (x) + f 00 (x) 2 + f 000 (x) 6 + H.O.Ta f (x) + f 0 (x) f 00 (x) 2 + f 000 (x) 6 H.O.Tb
(x, ) =
2
3

2f 0 (x) + 2f 000 (x) 6 + H.O.Ta H.O.Tb


(x, ) =
2
Taking the limit as in the definition of consistent above:
3

2f 0 (x) + 2f 000 (x) 6 + H.O.Ta H.O.Tb


lim (x, ) = lim
0
0
2
At this point, we use that ||  0 as well as the fact that the higher order
teams (both a and b) have increasing powers of in them. Thus, when we take
the limit of approaching 0, the higher order terms go to 0. The remaining
s cancel and we get the desired result:
lim (x, ) = f 0 (x)

Thus, the centred difference approximation is consistent.

Part b)
To find the order of accuracy, we define ye = (x, ) f (x) as the error due to
the algorithm.
From this, we see that:
ye = f 0 (x) + f 000 (x)

2
+
6

This shows that (as ye O(2 )) the centred difference approximation has p = 2.

Part c)
We numerical algorithm is classified

<1
d
>1
=
dx
=1

by the following:
stable
unstable
marginally stable

From above:
= f 0 (x) + f 000 (x)
??????????????????

3
+
6

Problem 2.2
Part a)
As the function has a continuous first derivative and it is inexpensive to evaluate, Newtons Method would be a good selection to find the roots of f. The
convergence is thus quadratic for a single root.

Part b)
We are give that f is Lipschitz with the Lipschitz constant [0, 1]. This implies
that fixed point iteration would be appropriate to use in the case (i.e. will be
linearly convergent and then potentially quadratically depending on f(x)).

Part c)
We want to avoid evaluating f(x) but we know that the function is continuous.
So, we can use secant method to approximate f(x) (a less expensive option
than finding f(x) directly). This will give convergence better than linear. This
is good given that f(x) is expensive to evaluate (in comparison to the other
methods).

Part d)
We have that f is continuous but not differentiable. ????

Problem 2.3
Part b)
The algorithm I chose was based on first plotting the points (see Part a) and
seeing the that it looked linear. As trapezoid rule approximates using a linear
function between the points. Thus, it was appropriate to use it.
In comparing my solution to solution calculated by the built-in trapz function,
it can be seen that my implementation is correct.

Part d)
This time the plot of the function is not at all linear looking (see Part c for the
plot). It looks like a higher order polynomial or even an oscillatory function.
In part a), the function looked very linear for the domain given. Thus, I am
confident that the data points given accurately represent the continuous function
for which it was sampled form. Thus, I was confident that trapezoidal rule would
do a good job integrating it.
For part c), I am not at all sure what the actual function looks like. I simply
do not know how it behaves. Thus, I am not confident in the result and how
accurately it represents the actual functions area.
However, it is completely possible that the plot in Part A) does not represent the
actual function at all. The sample times could have made the function appear
linear from the data points but in reality it my not be.
On the other hand, the data points in Part C) could have come form a piecewise
continuous function of linear equations. In that case, my integration would be
essentially perfect.
The point is that I will always be unsure to some degree unless I know the actual
function for all values of x. Only then would I be 100% confident in the result
(or at least as confident as I could be depending on the accuracy of the method
used based on the function).

You might also like