Re: Bug In LogPlots with WorkingPrecision option?
- To: mathgroup at smc.vnet.net
- Subject: [mg97169] Re: [mg97140] Bug In LogPlots with WorkingPrecision option?
- From: "David Park" <djmpark at comcast.net>
- Date: Sat, 7 Mar 2009 02:37:41 -0500 (EST)
- References: <19041450.1236333952924.JavaMail.root@m02>
I don't understand why Mathematica does that. WorkingPrecision seems to throw the LogPlot logic off. It is possible to make perfectly good Log plots by hand using WorkingPrecision. I do it with the Presentations package because I also need to introduce custom ticks. Needs["Presentations`Master`"] With[{yticks = CustomTicks[Log[10, #] &, {-16, -2, {1}, {2, 5}}, CTNumberFunction -> (N[#] &)]}, Draw2D[ {Draw[Log[10, Exp[-7 x]], {x, 1, 5}, WorkingPrecision -> 20]}, AspectRatio -> 1, Frame -> True, FrameTicks -> {{yticks, yticks // NoTickLabels}, {Automatic, Automatic}}, ImageSize -> 400] ] The following plots your more complicated function. With the factor of 10^13 in the Sin function the function oscillates so rapidly that Mathematica can't do a fine enough sample to catch a smooth set of points. (WorkingPrecision is no help there.) I changed the factor to 1000 and then we obtain a nice smooth descending sinusoidal curve on the Log scale. With[{yticks = CustomTicks[Log[10, #] &, {-10, 2, {1}, {2, 5}}, CTNumberFunction -> (N[#] &)]}, Draw2D[ {Draw[Log[10, Exp[-7 x]/Exp[-10 Sin[1000/(13 \[Pi]) x]]], {x, 1, 2}, WorkingPrecision -> 20, MaxRecursion -> 2]}, AspectRatio -> 1, Frame -> True, FrameTicks -> {{yticks, yticks // NoTickLabels}, {Automatic, Automatic}}, ImageSize -> 400] ] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: M.Roellig [mailto:markus.roellig at googlemail.com] Hi Group, the Documentation states that LogPlot takes the same options as Plot. Unfortunately, LogPlot seems to have difficulties to properly swallow them. Compare the follwoing examples: p1 = Plot[Exp[-7 x], {x, 1, 5}] p2 = LogPlot[Exp[-7 x], {x, 1, 5}, PlotRange -> {10^-10, 20}] p3 = LogPlot[Exp[-7 x], {x, 1, 5}, PlotRange -> {10^-10, 20}, WorkingPrecision -> 20] p4 = LogPlot[Exp[-7 x], {x, 1, 5}, WorkingPrecision -> 20] p2 looks good. But if I use the WorkingPrecision option (even though the example does not demands a particularly high precision) the plots are messed up. p3 is plotting something very strange but at least is able to keep the axes ticks and labeling. Once I leave out the PlotRange everything is completely messed up. I hope this is not a feature because I don't understand it. This occurs with all kinds of logarithmic plots. Even more puzzling is the following example: LogPlot[Exp[-7 x]/Exp[-10 Sin[10^13/(13 \[Pi]) x]], {x, 1, 2}, PlotRange -> {10^-10, 20}] LogPlot[Exp[-7 x]/Exp[-10 Sin[10^13/(13 \[Pi]) x]], {x, 1, 2}, PlotRange -> {10^-10, 20}, WorkingPrecision -> 20] Bug ? I am using logarithmic plots a lot and am always surprised how fragile the present implementation is. Especially in science Log(Log)Plots are used all the day and deserve some more love from the developers (e.g. better automatic tick selection/control or consistency in positioning of text/Insets, etc...). Cheers, Markus R=F6llig