Texts:
1. The first task will be to write a function that will compute the logarithm of a number b. (20 points)
The process will involve using the Newton-Raphson (N-R) approach to compute the root of a function.
a) Write out the Newton-Raphson (NR) iteration that will solve for the root of the function
f(x) = e^(-b)
Note that f(x) = 0 at x = log(b).
This part is to be done either by hand or as a document. (7 points)
b) Write a function that uses the NR iteration to solve for log(b). (8 points)
function [y,terms] = NR_log(x, MaxTerms)
% [y,terms] = NR_log(x, MaxTerms)
% Computes log of the number x, using a MaxTerms terms.
%
% Input: x - Number that we want the natural log of.
% [default: 1000]
% Output: y - log of x
% terms - number of terms used.
One question that we will be discussing is how can you set the initial value for this solution.
c) Compare the results of NR_log with the built-in function log(x), for the following four test values (x = 0.5, 3, 200, 2000). It is assumed that log(x) will be the most accurate, so compare the results you get from the NR_log approaches to the result from log(x). Use the Absolute Relative Error in comparing your results. (5 points)