Message Boards Message Boards

3
|
5696 Views
|
24 Replies
|
22 Total Likes
View groups...
Share
Share this post:

LogLogPlot doesn't transform coordinates in V11 (Fixed in 11.0.1)

Hi all,

I have the following code:

pdftanemura = 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;
data = Table[{y, pdftanemura}, {y, PowerRange[0.01, 100, 1.1]}];
ListLogLogPlot[data, PlotRange -> {{0.01, 100}, {10^-4, 10}}]
LogLogPlot[pdftanemura, {y, 0.01, 100}, PlotRange -> {{0.01, 100}, {10^-4, 10}}]

which give in 10.4.1:

enter image description here

However in 11 it gives:

enter image description here

The horizontal coordinate is not transformed properly, it can be fixed using:

% /. Line[x_] :> Line[{Log@x[[All, 1]], x[[All, 2]]}\[Transpose]]

It looks like this is some particular example where it is not correct? Can people recreate this?

POSTED BY: Sander Huisman
24 Replies

My bug-report was forwarded to developers. If you also want to send regarding this, please mention the case: CASE:3706853

Solved in version 11.0.1!

POSTED BY: Sander Huisman

Several people have complained about this on StackExchange since M11 was released. You will find my analysis of the problem here:

http://mathematica.stackexchange.com/q/123943/12

Another thread: http://mathematica.stackexchange.com/q/125127/12

Thanks for sharing. Same conclusion there. Use Evaluate for now...

POSTED BY: Sander Huisman

Hi Sander,

by the way, why is this:

pdftanemura[x_] := 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;
Plot[pdftanemura[y], {y, 0.01, 100}, 
PlotRange -> {{0.01, 100}, {10^-4, 10}}, 
ScalingFunctions -> {"Log", "Log"}, Mesh -> All,Meshstyle->Red]

enter image description here

Meshpoints do not coincide with the curve... Precision-issue? Cannot fix it with WorkingPrecision.

Cheers,

M.

POSTED BY: Marco Thiel

How did you get MeshStyle to work in Plot? It won't execute on my mac version 11. But those points are curious. Because those point would be 'negative' y values (with the right axes), but any negative to a some weird power would be complex numbers... So it would not be able to plot it. Abs[pdftanemura[x]] will plot those points too...

POSTED BY: Sander Huisman

Hi,

just executed the code in the codex. Runs on MMA11 on OSX10.11.6. Same result for Mathematica Online and Development Platform.

Because those point would be 'negative' y values (with the right axes)

yes, I know. that's exactly my problem. This is why I was thinking of a WorkingPrcision problem. For example:

pdftanemura[x_] := 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;
Plot[pdftanemura[y], {y, 0.01, 100}, 
 PlotRange -> {{0.01, 100}, {10^-4, 10}}, 
 ScalingFunctions -> {"Log", "Log"}, Mesh -> All, MeshStyle -> Red, 
 WorkingPrecision -> 1]

gives warnings, and this figure:

enter image description here

Not quite what I would expect, but I think it points at a precision problem mostly because of the error message:

enter image description here

Cheers,

Marco

POSTED BY: Marco Thiel

It might think that some values are (close to) real? and therefore includes them? I'm really not sure.

POSTED BY: Sander Huisman

What might happen internally is that they do a replacement y -> Exp[y] and f -> Log[f], now they can feed in 'linear values' of y, and get the vertical values out. But the replacement might not work on the symbol (because it is HoldFirst for the plot). So it remains untouched somehow? Terrible behavior in my opinion... very confusing, even for the more experienced. I just stumbled upon it because my 'old' code now gave a completely different plot...

POSTED BY: Sander Huisman

See my last post above. They do seem to replace y->Exp[y].

I agree. That is confusing. The main problem is if that is somewhere in a longer piece of code, it might take a good while to debug. It is very nice that you found it and posted it. Indeed, your posts are always very helpful. Thanks a lot!

Cheers,

Marco

POSTED BY: Marco Thiel

It took me way more time than it should to find the mistake, here is the 'distilled' version haha. I'm considering sending this in as a bug, as I can imagine lots of people will trip over this new behavior, especially beginners (which I am apparently)...

Some of the transformation stuff is happening here:

f = x^2
tr = Trace[LogLogPlot[f, {x, -3, 3}]];
Column[tr[[5, 2, 2, 3, 3, {14, 29, 31}]], Frame -> All]

enter image description here

But it is near impossible to compare it with the 10.4.1 implementation without the actual source code.

--SH

POSTED BY: Sander Huisman

Hi SH,

yes, I think it might be a good idea to alert the feedback team to this behaviour. I very much prefer the 10.4.1 behaviour.

Cheers,

Marco

POSTED BY: Marco Thiel

Hi Marco,

Thanks for verifying and brainstorming! I've send it to them. Might be solved in future 11.1...

POSTED BY: Sander Huisman

In the current pre-release version this issue has been fixed, so most likely this will be fixed in the next release-version.

This is indeed fixed in 11.0.1. Today was my first run of the script since version 11. I didn't check 11.0.1.

POSTED BY: Sander Huisman

I thought this was already fixed in 11.0.1.

You're correct!

POSTED BY: Sander Huisman

Hi Sander,

yes, I unfortunately see the same behaviour.

Cheers,

Marco

POSTED BY: Marco Thiel

Thanks Marco for checking... the strange thing is; it does work when you add an Evaluate... but I'm a bit confused on as why? Did this behavior change, and why? This will make a lot of people 'trip' on simple things...

pdftanemura = 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;
LogLogPlot[pdftanemura, {y, 0.01, 100}, PlotRange -> {{0.01, 100}, {10^-4, 10}}]
LogLogPlot[Evaluate[pdftanemura], {y, 0.01, 100}, PlotRange -> {{0.01, 100}, {10^-4, 10}}]

This should simply work, I don't see the need for an extra Evaluate, and I'm not sure why this behavior was changed...

POSTED BY: Sander Huisman

Dear Sander,

I think you are absolutely right. This is weird, and potentially a serious and hidden problem.

See also:

pdftanemura[x_] := 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;
LogLinearPlot[pdftanemura[y], {y, 0.01, 100}, 
 PlotRange -> {{0.01, 100}, {10^-4, 10}}]
LogLinearPlot[Evaluate[pdftanemura[y]], {y, 0.01, 100}, 
 PlotRange -> {{0.01, 100}, {10^-4, 10}}]

and

pdftanemura[x_] := 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;
Plot[pdftanemura[y], {y, 0.01, 100}, 
 PlotRange -> {{0.01, 100}, {10^-4, 10}}, 
 ScalingFunctions -> {"Log", "Linear"}]
Plot[Evaluate[pdftanemura[y]], {y, 0.01, 100}, 
 PlotRange -> {{0.01, 100}, {10^-4, 10}}, 
 ScalingFunctions -> {"Log", "Linear"}]

which will, of course, all be the same problem.

Cheers,

Marco

POSTED BY: Marco Thiel

To be honest, I never understood the need for Evaluate in some plotting functions and for some cases... Why it does plot, and why the results is what it is; I'm not sure...

I tried looking into Trace[LogLogPlot[f,{x,0.1,10}]] with f=x but didn't get much wiser...

POSTED BY: Sander Huisman

I can verify that problem, too! (11.0.0 for Linux x86 (64-bit) (July 28, 2016))

Yes, strange! But is your definition

pdftanemura[x_] := 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;

supposed to be like so? Should not it read:

pdftanemura[y_] := 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;

Because then it seems to work.

Regard -- Henrik

POSTED BY: Henrik Schachner

Good catch, but the original example remains problematic I would say...

I fixed my other post, such as to make the thread a bit clear for others...

POSTED BY: Sander Huisman

Dear Henrik,

yes, you are right! I overlooked this from Sander's reply to my post, but I am still confused. In the original post it reads:

pdftanemura = 15.344341419321385` E^(-3.04011` y^1.078`) y^2.315`;

so no proper function is defined. The expression is just substituted in the plot. The definition of the function was only introduced when Sander replied to my first post.

I am not really sure what is going on here. I think that the explicit dependence on x in the later definition does/should not matter. A bit like here:

g[x_] := Sin[y];
g[5]
(*Sin[y]*) 

If I try to plot

Plot[g[x], {x, -6, 6}]

this gives

enter image description here

whereas

Plot[g[x], {y, 0, 6}]

gives

enter image description here

If I define

pdftanemura[x_] := 15.344341419321385 E^(-3.04011  y^1.078) y^2.315;

I get:

 pdftanemura
(*15.3443 E^(-3.04011 y^1.078) y^2.315*)

So basically if I define pdftanemura as above and plot

GraphicsRow[{Plot[pdftanemura[x], {y, 0, 6}], Plot[pdftanemura[y], {y, 0, 6}]}]

I get

enter image description here

Which is, sort of, what I expect. In this case it should not matter whether I define the dependance on x or y, or should it?

Cheers, Marco

POSTED BY: Marco Thiel

It shouldn't. [n] is ignored completely.

Sometimes you want to isolate the exact variable you use for your function then the delayed-assignment (:=) is a good option. But other times you just want a direct assignment (=). Nice examples though!

O btw, for the curious people: it is the (fit of the) PDF of the areas of Voronoi-cells of 2D random points found by Tanemura...

Thanks all. I forwarded this to Mr. Wolfram...

POSTED BY: Sander Huisman

Dear Marco, dear Sander, yes, the original problem of course remains! Thanks for spotting and bringing this up! My post was just meant as minor remark ...

Regards -- Henrik

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract