Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I just need a simple program written in MATLAB to solve part A. It is desired to

ID: 2988773 • Letter: I

Question

I just need a simple program written in MATLAB to solve part A.

It is desired to determine a recursive expression (difference equation) for finding the rth root of a real number N. We start by writing the I aylor series expansion of function f(x) about a point xn: If the series is truncated after two terms, we have Let x represent the next iterate xn+1, and let x also represent a solution 01 the equation f(x) = 0. Then Eq. (P2-4-2) becomes Eauation (P2-4-4) is a difference equation useful for solving fix) = 0. Choose J(x) appropriately and determine the corresponding difference equation for finding the rth root of a number N. Do five iterations to calculate the cube root of six using x0 = 1 as the initial guess.

Explanation / Answer

hello, i just wrote a function in matlab which takes in 4 arguments and gives the results

here is the program:

****************************************************************************************************************************

function [ xn] = rRoot( N,r,nof_iterations,initial_guess )
%rRoot calculates the rth root of N using the finite difference method
% the appropriate function to be used to calculate rth root will be F(x) =
% x^r -N. the root or solution of this function is what we require, the rth
% root of N.
xn = initial_guess; % plugging in the value of x0 as the initial guess

for i=1:nof_iterations %iterating given no. of times

xn1 = xn - ( xn^r - N )/(r * xn^(r-1));
xn = xn1;
end

  
end

*************************************************************************************************************************

as you can see the first argument is the no itself, N

second argument defines the 'r'th root

third specifies the no of iterations to be done

and 4 th asks for an initial guess.

hope this helps :)