advertisement

Tutorial 7 Solution Question 1 We can use a root finding method that uses the difference of f(x) and g(x) as the function parameter. Question 2 Multiply f(x1) and f(x2). If the result is negative, x1 and x2 bracket a root (assuming a wellbehaved function). Question 3 Root-finding methods are used to find out where a 2D function intersects the y-axis. Integration methods sum the area underneath a function between two points specified by the code. Question 4 In the first iteration, a=0 and b=3. Their midpoint ("y") is 1.5. Since f(a) is 4 and f(y) is -5/4, the product of a and y is negative, indicating a root in the interval. b becomes 1.5, and y is now .75. In the next iteration: a = 0, b = 1.5, y = .75 --> f(0) = 4, f(.75) = 13/16, and 4* 13/16 > 0, so a is moved to .75 Question 5 The derivative allows us to find out the distance between the current guess and the point at which the line tangent to our function at the point of the guess hits the x-axis. When the difference between our guess and this new point are very small, we settle on a root.