Starting from:

$30

ICSI401 Homework 2- Continuity, differentiability review Solved

2.1        Continuity, differentiability review
•    Give an example of a function f : R → R that is continuous everywhere on its domain but has at least one point at which it is not differentiable.

•    Give an example of a function f : R → R that is not continuous at 0.

Hint for both of these: You can define piecewise functions (i.e., you can think of a function that has some form on one interval and then a different form on another interval). The purpose of this problem is for you to recall intuitively/graphically what continuity and differentiability mean.

2.2         Floating point and related topics
1.    Write down the binary expansion of 50.5.

2.    Consider the gaps between representable floating point numbers. Which of the following has the larger gap between it and the next larger representable floating point number?

•    2

•    201

Just a definition and not a problem that you have to solve: we say that x is an accurate approximation to y to k decimal places if |x − y| < 5 × 10−k−1. For example, if we want 4 decimal places of accuracy, then |x − y| < 5 × 10−5. You should use this definition in the problems below.

2-1

2-2                                                   Homework 2: ICSI 401 – Numerical Methods

 

2.3       Bisection search
1.3 In Matlab, implement a function that performs a bisection search. It should take the following parameters:

•    F: A function (assumed to be continuous) whose roots you want to find,

•    a: A floating point number giving the left endpoint of the initial interval in which you want to search for a root of F.

•    b: A floating point number giving the right endpoint of the initial interval.

•    delta: A non-negative floating point number giving the acceptable proximity of the output to a root of F.

Your function should first check a and b to determine whether or not they satisfy the condition given by the Intermediate Value Theorem that allows us to conclude that [a,b] contains a root of F. If this condition is not satisfied, return NaN (Matlab for “Not a number”). If the condition is satisfied, your function should perform a bisection search until it finds a number z that it can guarantee satisfies |x−x∗| < delta, for some real-valued root x∗ of F. It should return z.

2.    Use the Matlab function that you wrote to find a real-valued root of the function F(x) = x5+x+1, with accuracy to 4 decimal places (this last requirement will determine your choice of delta).

A fun fact: You know about the quadratic formula, which gives the roots of a quadratic function in terms of its coefficients. It turns out that there exist similar formulas for polynomial functions of degree 3 and 4, but not for 5 or more (formally, such equations are not solvable by radicals). This is a result by Niels Henrik Abel, and the proof uses what is called Galois theory (sometimes covered in classes on abstract algebra). The fact that no such simple formula exists for the roots is a pretty good motivation for numerical methods.

3.    Suppose that you use bisection search to find a root of F(x) = sinx, with a = −π/2,b = 5π/2.

To which root will the bisection search converge?

2.4        Newton’s method
1.    Write a Matlab function that implements Newton’s method. It should take the following parameters:

•    F: A function whose roots you want to find,

•    Fprime: The derivative of F,

•    w0: An initial point at which F is differentiable,

•    k: A positive integer giving the number of iterations to execute.

Your function should execute k iterations of Newton’s method using the parameter functions F and Fprime and output the resulting number, wk.

2.    Suppose that you want to find the points at which the graphs of two functions f(x) and g(x) intersect. Write down a function H(x) such that f(x) and g(x) intersect at a point z if and only if H(z) = 0.

                                                          Homework 2: ICSI 401 – Numerical Methods                                                   2-3

 

3.    Find the point of intersection of f(x) = x and g(x) = xlogx:

•    Write down a function H(x) as above, such that the roots of H(x) are exactly the points of intersection of x and xlogx.

•    Write down the Newton iteration equation (i.e., wk+1 in terms of wk, H(x), and H0(x)) that you would use to find roots of H(x).

•    Use your Matlab implementation of Newton’s method with k = 50 and some appropriate starting point w0 to find an approximation wk to the root x∗ of H(x). In order to choose w0, you can plot H(x) and identify a point visually close to x∗.

More products