I am trying to use the following input


however the output is:

plotted function

How can I adjust it so the line goes down to the PlotRange mark specified. Or is this a limitation of Mathematica?

  • $\begingroup$ Your question is not especially original, it's going to be closed in a while. I'd do this: Plot[{Re@#, Im@#}&@Log[x + 1], {x, -50, 50}, Evaluated -> True, PlotStyle -> Thick], PlotRange serves a different purpose than you seem to expect, see documentation pages. $\endgroup$
    – Artes
    Aug 19 '13 at 9:46
  • $\begingroup$ I just tried that and got the following: Link To Graph $\endgroup$
    – VikeStep
    Aug 19 '13 at 9:53
  • $\begingroup$ Does it make you wonder? If it does, start to learn complex functions, there are many helpful questions. $\endgroup$
    – Artes
    Aug 19 '13 at 9:59
  • 2
    $\begingroup$ It's a problem of how Plot[] works. There is only one pixel per x-value, and the curve at x=-1 is so steep that it doesn't take up more than one pixel in width. Use this instead: ParametricPlot[{x, Log[x + 1]}, {x, -1, 3}, PlotRange -> {{-2, 3}, {-10, 2}}] $\endgroup$
    – Volker
    Aug 19 '13 at 10:12
  • 1
    $\begingroup$ @SjoerdC.deVries This poor question is not even a bit clear what the OP wants, why not e.g. Plot[Log[x + 1], {x, -2, 50}, PlotRange -> {{-2, 50}, All}] $\endgroup$
    – Artes
    Aug 19 '13 at 12:23

As I mentioned in the comments, it's a problem of Plot[]. Mathematica won't draw more than one pixel per pixel column. So I'd use ParametricPlot instead, which makes it a little better, but still not perfect. The line becomes so steep that you can't tell the difference between it and a straight line, so you just extend it manually:

ParametricPlot[{{x, Log[x + 1]}, {-1, -x - 9}}, {x, -2, 50},
     PlotRange -> {{-2, 50}, {-50, 10}}, PlotStyle -> {Blue, Blue}]

enter image description here

  • 1
    $\begingroup$ Works perfectly, I decided to use a method similar to this, I still used Plot, but I added Epilog->Line[{{-1,-4},{-1,50}}] $\endgroup$
    – VikeStep
    Aug 19 '13 at 10:29
  • $\begingroup$ @user9053 I don't think your soulution is in any way similar to the one given here. $\endgroup$ Aug 19 '13 at 12:59
  • $\begingroup$ what I'm saying is, is that he explained why it wasn't working and said that I should manually extend the line, so instead of manually extending it in ParametricPlot, I did it in Plot $\endgroup$
    – VikeStep
    Aug 20 '13 at 7:21

This is what I'd do, the idea is to use ParametricPlot[{b^y, y}] for Log[b, x]. So we can use Solve to make it a little bit more general:

Block[{x, y}, 
 With[{notimportantoptions = Sequence[PlotStyle -> Thick, PlotRange -> {All, {-25, 6}}, 
                                      AspectRatio -> 1,  AxesStyle -> Arrowheads@.05,
                                      AxesOrigin -> {0, 0}, BaseStyle -> {18, Bold}]

  ParametricPlot[{x, y} /. Solve[y == 2 Log[15 + x], x, Reals][[1]], {y, -25, 6}, 
                 RegionFunction -> (# < 10 &), notimportantoptions, Evaluated -> True]

enter image description here


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.