f(x) = (exp(x)-1)/x;
g(x) = (exp(x)-1)/log(exp(x))
Analytically, f(x) = g(x)
for all x
.
When x approaches 0, both f(x)
and g(x)
approach 1.
% Compute y against x
for k = 1:15
x(k) = 10^(-k);
f(k) =(exp(x(k))-1)/x(k);
De(k) = log(exp(x(k)));
g(k)= (exp(x(k))-1)/De(k);
end
% Plot y
plot(1:15,f,'r',1:15,g,'b');
However, g(x)
works better than f(x)
. f(x)
actually diverges when x
approaches 0. Why is g(x)
better than f(x)
?