# Cannot Plot Log

I tried following command and it worked well (you can see the function is positive).

Plot[1 - x^(2^(n + 1)^a - 2^n^a) /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, {n, 85, 98}, WorkingPrecision -> 100]

But, I couldn't plot Log of this function:

Plot[Log[1 - x^(2^(n + 1)^a - 2^n^a)] /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, {n, 85, 98}, WorkingPrecision -> 100]

This shows only axes. I tried LogPlot, but it fails as well:

LogPlot[1 - x^(2^(n + 1)^a - 2^n^a) /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, {n, 85, 98}, WorkingPrecision -> 100]

Why Mathematica can't show log of this function?

• The above is done in Mathematica 11.1. I tried in Mathematica 10.4, then LogPlot showed something but wrong. This function must vanish as x decrease but LogPlot showed that it approaches to 1 (Plot[1 - x^(2^(n + 1)^a - 2^n^a)] showed vanishing property). Jul 8, 2017 at 8:48
• If I replace Log by RealExponent, it works. (RealExponent[..] is equivalent to Log[Abs[..]], though.) Jul 8, 2017 at 19:32

$Version (* "11.1.1 for Mac OS X x86 (64-bit) (April 18, 2017)" *)  Clear[f] f[n_, prec_: 25] := Module[{rn = Rationalize[n, 0]}, N[1 - x^(2^(rn + 1)^a - 2^rn^a) /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, prec]] f[90.1] (* 0.07970588475709084543825009 *) Plot[f[n], {n, 85, 98}] LogPlot[f[n], {n, 85, 98}] • It's a very simple but smart solution! Jul 8, 2017 at 14:11 In Mathematica 10.1.0 LogPlot works: LogPlot[1 - x^(2^(n + 1)^a - 2^n^a) /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, {n, 85, 98}, WorkingPrecision -> 100] Plot however returns empty: Plot[Log[1 - x^(2^(n + 1)^a - 2^n^a)] /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, {n, 85, 98}, WorkingPrecision -> 100] A work-around is Table and ListLinePlot: ListLinePlot[ Table[Log[1 - x^(2^(n + 1)^a - 2^n^a)] /. {a -> 1 - 1/10, x -> 1 - 4^(-30)}, {n, 85100, 98100}], DataRange -> {85, 98} ] • Thanks! This problem seems to be very sensitive to the implementation of Mathematica. Plot and LogPlot does not use the same method of evaluation. Jul 8, 2017 at 13:05 fun = 1 - x^(2^(n + 1)^a - 2^n^a) /. {a -> 1 - 1/10, x -> 1 - 4^(-30)} For real n this monster formula returns Indeterminate: Table[Log @ N[fun, 5], {n, 85, 98, 0.5}] // Short  {Indeterminate, ..., Indeterminate} But it produces results for integer and rational n: Table[N[Log @ fun, 3], {n, 85, 98, 1/4}] // Short which you can display with ListLinePlot ListLinePlot @ Table[Log @ fun, {n, 85, 98, 1/4}] • Thanks a lot! Oh, this formula needs too big precision. I decided to use Round[n, 1/100] instead of n. Jul 8, 2017 at 13:02 Here is an approach that works equally in versions 11.1 and 11.0: Plot[Log[SetPrecision[ 1 - x^(2^(n + 1)^a - 2^n^a),$MachinePrecision] /. {a -> 1 - 1/10,

I wrapped the original function in SetPrecision, which also allows me to omit the original WorkingPrecision option, so I think this is the simplest solution.
This also works with LogPlot.