Plotting with big numbers

In many cases if you try to plot functions where very large numbers or very small numbers are involved Plot will not give a good plot of the function due to lack of precision. Here is an example.

f[x_]  :=  ((-(E^(-4 x)) + 3 (E^(-x)))/((E^(-x)) + (E^(-2 x)) Cos[x]^2))

Plot[f[x], {x, 50000, 10000000}, PlotRange  ->  All, 
      PlotPoints  ->  60]

High precision plots

The following function allows the points in the plot to be calculated with high precision. This means the rendering of the plot will be smooth and give a good representation of the function. The function will accept any of the options associated with ListPlot except PlotJoined. Although it might seem that increasing the number of points will give a better plot, there is an upper limit to this. In some cases there will be a maximal number of points that will work. Points which are too close together along the horizontal axis will not be distinguished from one another. Setting the value of precision to a very high number will cause the function to take much longer to evaluate without giving any appreciable increase in the accuracy of the plot.

PrecisionPlot[func_, {var_, varmin_, varmax_}, pts_, precision_, 
        opts___?OptionQ] :=  
      Module[{inc, f1, pltpts, 
          plt}, 
inc  =  (varmax - varmin)/
            pts; 
f1[tt_] = 
          If[Head[func] === Symbol, func[tt], 
            func /. var -> 
                tt]; 
$MaxExtraPrecision  =  
          2 precision; 
pltpts  =  
          Table[{tt, SetPrecision[f1[tt], precision]}, {tt, varmin, varmax, 
              inc}]; 
plt  = 
          If[{opts } =!=  {}, 
            ListPlot[pltpts, PlotJoined  ->  True, opts] , 
            ListPlot[pltpts, 
              PlotJoined  ->  True]]
]

PrecisionPlot[f[x], {x, 50000, 10000000}, 60, 40, 
      PlotRange  ->  All]

Here we add some plot options.

PrecisionPlot[f[x], {x, 50000, 10000000}, 800, 50, 
      PlotRange  ->  All, PlotStyle  ->  Hue[ .7], 
      AspectRatio  ->  1]