Bug introduced in 9.0 and fixed in 9.0.1
In Mathematica 7 it is very easy to conditionally suppress plotting of individual lines using If
:
Plot[{
If[x^2 < 2, x^2],
If[Exp[x] > x^2, Exp[x]],
If[False, x] (* check recommended by Rahul *)
},
{x, -2, 2},
PlotStyle -> Thick, Frame -> True]
Or more verbosely using Piecewise
and Indeterminate
:
Plot[{
Piecewise[{{x^2, x^2 < 2}}, Indeterminate],
Piecewise[{{Exp[x], Exp[x] > x^2}}, Indeterminate],
Piecewise[{{x, False}}, Indeterminate] (* check recommended by Rahul *)
},
{x, -2, 2},
PlotStyle -> Thick, Frame -> True]
It is reported that neither method works in version 9.0.0 (at least on OSX.)
Furthermore it is reported that my attempt using ConditionalExpression
also fails:
Plot[{
ConditionalExpression[x^2, x^2 < 2],
ConditionalExpression[Exp[x], Exp[x] > x^2]
},
{x, -2, 2},
PlotStyle -> Thick, Frame -> True]
Plotting a zero is reported to "work" but that is hardly a solution:
Plot[{
Piecewise[{{x^2, x^2 < 2}}],
Piecewise[{{Exp[x], Exp[x] > x^2}}]
},
{x, -2, 2},
PlotStyle -> Thick, Frame -> True]
1. Is this indeed a bug in version 9.0.0?
2. Is there a workaround for the affected systems?
9.0.0
. $\endgroup$