2
$\begingroup$

This is a bit involved example, but I have not been able to reproduce it in more simple cases.

Print[$Version, $System]
9.0 for Linux x86 (64-bit) (November 20, 2012)Linux x86 (64-bit)

Lets define this function:

Clear@ff; ff[d_, x_] = Exp[-d/(1 + x)];

Now the idea is to plot this function but with x being the solution to $x=ff[d,x]$.

Plot[ff[d,FixedPoint[ff[d, #] &, 0.1, SameTest -> (Abs[1 - #1/#2] < 0.01 &)]], {d, 1, 4}]

And worked!

worked!

But LogPlot (and LogLogPlot and LogLinearPlot) hangs forever..

LogPlot[ff[d,FixedPoint[ff[d, #] &, 0.1, SameTest -> (Abs[1 - #1/#2] < 0.01 &)]], {d, 1, 4}]

However, if I define

zz[d_?NumberQ] :=  ff[d,FixedPoint[ff[d, #] &, 0.1,SameTest -> (Abs[1 -#1/#2] < 0.01 &)]];

then it works:

LogPlot[zz[d], {d, 1, 4}]

works

Why this happens?

$\endgroup$
  • 2
    $\begingroup$ The Plot, LogPlot, and LogLogPlot versions run equally well and quickly in MMA 10.1 on Win7-64bit. This may be version dependent. $\endgroup$ – MarcoB Jul 3 '15 at 21:20
  • $\begingroup$ @MarcoB bummer.. $\endgroup$ – user13427 Jul 3 '15 at 21:23
  • $\begingroup$ Everything works fine in Mma 10.1 on Mac OS 10.10.4 $\endgroup$ – Bob Hanlon Jul 3 '15 at 22:55
  • $\begingroup$ Same issue on Windows 7, 9.01. You can use, e.g., ListLogPlot[ Table[{d, FixedPoint[ff[d, #] &, 0.1, SameTest -> (Abs[1 - #1/#2] < 0.01 &)]}, {d, 1, 4, .001}], Joined -> True] $\endgroup$ – ciao Jul 4 '15 at 2:11
1
$\begingroup$

I do get the same behavior in 10.0 for Microsoft Windows (64-bit) (December 4, 2014)Microsoft Windows (64-bit). How ever, if you run the test for NumberQ in the code being evaluated for the plot, the answer pops out:

LogPlot[
    If[NumberQ[d]
       , ff[d,FixedPoint[ff[d, #] &
            , 0.1
            , SameTest -> (Abs[1 - #1/#2] < 0.01 &)]
         ]
       ,Print[d];
    ]
    , {d, 1, 4}]

It prints out d and then does the plot. I don't know why it does that though.

$\endgroup$

Your Answer

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