in many applications including nancial


In many applications, including ?nancial mathematics, ?nding zeros of a function

f(x) = 0 (4)

is paramount. One of the simplest method is the Bisection Method. The bisection method is a systematic search technique for ?nding a zero of a continuous function. The method is based on a well-known property of continuous functions, the intermediate value theorem. We ?rst ?nd an interval in which a zero is known to occur. This is done by evaluating the function f(x) at a and b: if f(a) > 0 and f(b) < 0 or if f(a) < 0 and f(b) > 0 then there exists a number x = c, say, between a and b such that f(c) = 0.

Suppose that an interval [a, b] has been located which is known to contain a zero, since the function changes sign between a and b. The approximate solution is the midpoint of the interval and therefore the zero must now lie either in the interval [a, x1] or [x1, b]. The appropriate subinterval is determined by testing the function to see whether it changes sign on [a, x1].

If yes, the search continues to obtain the next point x2 = a+x1 Otherwise, the search continues on [x1, b to obtain x1 = x1+b And the search is repeated until one converges to the approximate root either given some tolerance or number of iterates to convergence.

Below, I give you a head start to writing a MATLAB function bisect to compute a zero of a function. Let us consider as inputs a, b, tolerance, nmax (we do not want our algorithm to run forever in case it can not ?nd a zero), and the function fun. You must ?nd was of declaring the function fun such that it can be read easily into our function bisect. We want to output xvect (the vector containing the approximates zeros x0, x1, · · · , etc.), xdif (this is the difference between the roots to monitor the error), fx (this is a vector with the values of the function evaluated at it approximate zero, i.e. a vector of all f(xi)) and ?nally nit (this is the maximum number of iterations taken to converge. If the  algorithm can not ?nd the zero, then nit = nmax).

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: in many applications including nancial
Reference No:- TGS0264558

Expected delivery within 24 Hours