Question: 1. Write a function with the prototype function r secant (f, x0, x1, tol, kmax) which implements the secant method to find a root

1. Write a function with the prototype function r secant (f, x0, 

1. Write a function with the prototype function r secant (f, x0, x1, tol, kmax) which implements the secant method to find a root of a function f between x0 and x1. Successive estimates are calculated until either the relative error ek is less than tol or k=kmax. Recall that ek Ik-k-1 Ik Test that your function is working correctly by choosing a simple test function where you know the location of one (or more) of its roots. 2. Write a script that uses your function from question 1 to find the roots of 1 f(x)=+xsin ( with tol 10 and kmax = 20. Plot the graph of f(x). The plot will help you = choose appropriate values of x0 and x1 to find all of the roots of f(x). 3. Check your answers to the previous question using MATLAB's built-in fzero function. 4. Add the roots of f(x) to your plot of f(x), ensuring that they are clearly marked.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!