10

Bug introduced in 10.0 and fixed in 10.3


It appears that perhaps the iterator variable r is not Block-ed in the ParametricPlot code below. This does not happen with other Plot* commands nor with Table. The plot is produced successfully, however.

r = {0., 0.5, 1.};
ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 1}, {t, 0, 2 Pi}]

Thread::tdlen: Objects of unequal length in {0.,0.5,1.} {Cos[t],Sin[t]} cannot be combined. >>

Am I doing something wrong, or is it a bug?

This happens in V10.0.2 and V10.1 (Mac OSX). It does not happen in V9. I came across this in my answer to How to make a ArrayPlot/MatrixPlot in polar coordinates?.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • 4
    It's not a bug. It's a feature called "A New Kind of r" – Dr. belisarius Apr 14 '15 at 03:02
  • 1
    I say it's a bug, introduced in v10. v9 is fine. I'm going to add the tag. Can you report it? Note that Evaluated -> False doesn't fix it, but (very weirdly!) Evaluated -> True does! Exactly the opposite of what I would expect. – Szabolcs Apr 14 '15 at 03:19
  • @Szabolcs I've reported it to WRI. – Michael E2 Apr 14 '15 at 03:29
  • 1
    In v9 this doesn't print but in v10 it does: x := Print["x!"]; Plot[x, {x, 0, 1}]. – Szabolcs Apr 14 '15 at 03:55
  • 1
    @Szabolcs These are not equivalent, given r = {0., 0.5, 1.}: Plot[r^2 {2, 3}, {r, 0, 1}, Evaluated -> True] and Plot[Evaluate[r^2 {2, 3}], {r, 0, 1}]. I think they should be. I don't know if that's the same bug or even a bug. Evaluated is no longer documented, it seems, so WRI could argue that the discrepancy is unimportant. – Michael E2 Apr 14 '15 at 11:39

1 Answers1

5

I assume it is a bug based on the following findings:

  • In v9.0.1 it does not happen.

  • Adding Evaluated -> False does not fix it. Strangely Evaluated -> True does fix it.

  • As you mention, other plotting functions, such as ParametricPlot3D, do not have this problem, regardless of the Evaluated setting.

This is not an answer, just some arguments on why I think it is a bug.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • Bug, yes. But, I don't think it's serious as the plotting functions still work, so it is slight evaluation leak. – rcollyer Apr 14 '15 at 20:20
  • @rcollyer What about the x := Print["x!"]; Plot[x, {x, 0, 1}] example (which is slightly different)? In v9 it doesn't leak at all. – Szabolcs Apr 14 '15 at 20:25
  • Right. I was including that. It only prints once, implying the leak is a one time affair; the plot is otherwise unaffected. So, annoying, but not serious. – rcollyer Apr 14 '15 at 20:29
  • @rcollyer Agreed, just wanted to check it's really a bug. – Szabolcs Apr 14 '15 at 20:38
  • @Szabolcs, Dear Szabolcs, your package MaTex has the V10 syntax <||>, so I'd like to know that how to revise it to make this package could be applied in the ealier version. Thanks:) – xyz Apr 15 '15 at 07:46
  • @ShutaoTang Unfortunately I cannot make it compatible with M9. It would be too much work, and in particular it would increase the long-term maintenance burden (I get lots of support requests already). If you are willing to try to get a stripped down version work on your own computer only, check here: http://mathematica.stackexchange.com/a/79979/12 – Szabolcs Apr 15 '15 at 16:08