I'm having difficulty understanding how to express text in Epilog that is dynamically updated using Log[b, x]. Mathematica changes this to base $e$, but I would like it to be Log[b, x] in traditional format with base $b$, and I can't seem to make it work. I'm guessing I need to break the $\log$ apart using boxes or something, but don't know how to make a subscript that is a dynamically updated b value. Any ideas?

 Plot[{b^x, x, Log[b, x]}, {x, -10, 10}, 
  PlotRange -> {{-5, 5}, {-10, 10}}, PerformanceGoal -> "Quality", 
  ImageSize -> All, 
  Epilog -> {Text[b^x, {-3, 4}], Text[Log[b, x], {3, -5}]}, 
  GridLines -> {Range[-10, 10, 1], Range[-10, 10, 1]}, 
  GridLinesStyle -> Opacity[.04]], {{b, 2, "Choose a base"}, 0.01, 4}]
  • 1
    $\begingroup$ Epilog -> {Text[Subscript[Log, b] "(x)", {3, -5}]}] $\endgroup$ – Dr. belisarius Jan 16 '16 at 6:48

The code in the OP will work right off the bat if the following (sadly undocumented) setting is first executed:

SetSystemOptions["SimplificationOptions" ->
                 {"AutosimplifyTwoArgumentLog" -> False}]

After running that line, the Manipulate[] works as expected:

now it works!


Here's a way that let's Mathematica take care of the typesetting. Use With to inject the value of b into a held expression for the logarithm (see HoldForm).

Epilog -> {Text[b^x, {-3, 4}], Text[With[{b = b}, HoldForm@Log[b, x]], {3, -5}]}

Mathematica graphics


Thanks to Dr. Belisarius,

Epilog -> {Text[Subscript[Log, b] "(x)", {3, -5}]}]
  • 2
    $\begingroup$ I think this Text[Row[{Subscript[Log, b], "(x)"}], {3, -5}] is preferrable. $\endgroup$ – Mike Honeychurch Jan 16 '16 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.