close all
clear all
clc

g=@(x) log(x)./x;


a=3;
f=@(x) x-a*log(x)/log(a);
fp=@(x) 1-a/x/log(a);

TOL=1e-12;
d=1;
x=1;

while d>TOL
    xnew=x-f(x)/fp(x);
    d=abs(xnew-x)/abs(xnew);
    x=xnew;
end

x
%%
x=1:0.01:20;
for a=1:0.01:5
    
   c=log(a)/a; 
   plot(x,g(x),[x(1),x(end)],[c,c])
   xlabel('x')
   ylabel('y')
   axis([1 20 0 0.4])
   pause(0.02)
end