1function [nth_rt,iterations,hstry] = nrt(varargin)
 2%This function will use a Newton Search Technique to find
 3%the nth root of a number, a, to the tolerance, tol.
 4% The square root
 5% nrt(10,2), or nrt(10,2,1e-9)
 6% The "n" root
 7% nrt(10,n), or nrt(10,n,1e-9)
 8
 9a=varargin{1};
10n=varargin{2};
11
12if nargin~=3
13    tol=1e-9;
14else
15    tol=varargin{3};
16end
17
18if a<0
19    nth_rt=0;
20    iterations=0;
21    hstry=zeros(1,50);
22else
23    [nth_rt,hstry] = newtonSearchAlgorithm(a,n,tol);
24    % Determine iterations
25    iterations = 0;
26    for jj=1:length(hstry)
27        if hstry(jj)~=0
28            iterations = iterations+1;
29        else
30            break;
31        end
32    end
33    %iterations=length(find(hstry~=0));
34end