Discuss the below:
Q: a. Write a Matlab function newton.m which uses Newton-Raphson algorithm to compute an approximate solution to the equation f(x) = 0 starting from X0 and stopping when the magnitude of f(x) becomes smaller than e. The program should also restrict the maximum number of iterations to N. Your m-file should have a header line function [x, nitr] = newton (f, fp, x0, e, N) where fp is a user supplied function that computes f'(x).
Note: You can use Algorithm 2 on page 52 of Steven Pav's lecture notes as a template for your program.
b. Use your function newton.m to find the positive root of a function f(x) = exp(x) - sin(x) -2 with at least 10 correct digits after the decimal point. How many iterations did the algorithm require to converge the result.