2
$\begingroup$

I am reporting an unexpected behavior of the Manipulate statement. In the Manipulate[expression, {par, parmin, parmax}] previously by default the freshly evaluated expression has been hold at the value of the parameter equal to parmin.

Here are two statements. In the first statement the initial value of the parameter y is not specified, and should by default be 0:

    Manipulate[
 Plot[-3 x^2, {x, 0, Sqrt[y]}, PlotRange -> {{0, 3}, {-7, 1}}],
 {y, 0, 3}]

It yields the following view with the error: enter image description here,

while the statement

    Manipulate[
 Plot[-3 x^2, {x, 0, Sqrt[y]}, PlotRange -> {{0, 3}, {-7, 1}}],
 {{y, 1}, 0, 3}]

with the specified initial value of the parameter y gives the following outcome:

enter image description here

One should also mention that in the first case any motion of the slider generates a correct work of the manipulate. However, as just evaluated it does not work.

This started after I have installed the Mma 11.1 on Win7.

$\endgroup$
2
  • $\begingroup$ @Kuba In my understanding according to documentation Manipulate should assign the initial value of var (that is, 0 in your example) to the expression. $\endgroup$ Commented Mar 21, 2017 at 10:05
  • $\begingroup$ Manipulate[ Plot[-3 x^2, {x, 0, Sqrt[y]}, PlotRange -> {{0, 3}, {-7, 1}}], {y, $MachineEpsilon, 3}] behaves expected. $\endgroup$ Commented Mar 21, 2017 at 11:48

1 Answer 1

12
$\begingroup$

It is expected and can be reduced to:

var = 0; 
Plot[-3 x^2, {x, 0, var}]

enter image description here

Plot[-3 x^2, {x, 0, var}]

So the range spec: {x, 0, 0} doesn't make sense for Plot and it returns Unevalauted input, which means that 0 won't be there in var place because Plot is HoldAll.

As soon as you move the slider the body is triggered and now the value makes sense for Plot which results in a graphics.

Here is a custom minimal example:

f // Attributes = {HoldAll};
f[x_] := x + 1 /; (x > 0)
var = 0;
f[var]
f[2]
Manipulate[f[x], {x, 0, 1}]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.