# Plotting for very large argument values

g[x_] = 2 x*Log[1 + 1/x] - x/(1 + x) - 1;
Plot[g[100000*x], {x, 2, 3}]
FindRoot[g[x], {x, 0.1}]
g[200000] // N
g[250000] // N


I am trying to find zeros of $g(x)$ (if any) and conveniently to plot the graph. FindRoot shows that it has a number of zeros which are very large, so I tried to plot the rescaled function $g(10^5x)$ but it didn't work.

• Raise the WorkingPrecision: Plot[g[100000*x], {x, 2, 3}, WorkingPrecision -> 30]. Feb 3 '17 at 18:41
• Thanks, I added WorkingPrecision but still can't see the roots on the plot. The problem is that I want to see the behavior of this function near its roots, Findroot finds too many roots, this is suspicious... Feb 3 '17 at 18:47
• Looking at the result of that (look at the axes particularly) should probably have tipped you off. It is very likely that those crossings are spurious, due to the limitations of machine precision. Feb 3 '17 at 19:06

g[x_] = 2 x*Log[1 + 1/x] - x/(1 + x) - 1;

Plot[g[100000*x], {x, 0, 10}, WorkingPrecision -> 50]


Using high precision calculation with reduced display precision

Table[g[x*10^5] // N[#, 50] & // N, {x, 2, 10}]

(*  {-8.33327*10^-12, -3.70369*10^-12, -2.08333*10^-12,
-1.33333*10^-12, -9.25924*10^-13, -6.80271*10^-13,
-5.20832*10^-13, -4.11522*10^-13, -3.33333*10^-13}  *)

Limit[g[x], x -> Infinity]

(*  0  *)


Here is another solution, based on a change of variable. You can see that $\log(1+1/x)=\log((1+x)/x)=-\log(x/(1+x))$ so it's quite natural to try $u=x/(1+x)$:

f[u_] = g[u/(u - 1)] // FullSimplify;


You can easily plot f:

Plot[f[u], {u, 0.1, 2}]


and compute it's limit in 1:

Limit[f[u], {u -> 1}] (* {0} *)


And $x=u/(u-1)\to \infty$ when $u\to 1$ (note that $x>0$).