Mathematica plot, exclude endpoints?
Why does the following give me errors about dividing by 0?
ParametricPlot[{1/Sin[t], t}, {t, 0, 3 Pi}, Exclusions -> Sin[t] == 0]
Power::infy: Infinite expression 1/0 encountered.
It does successfully exclude the points at Pi an开发者_如何学Cd 2 Pi, but not the points at 0 and 3 Pi. If I exclude the endpoints by changing the interval...
ParametricPlot[{1/Sin[t], t}, {t, 0.001, 2.999 Pi}, Exclusions -> Sin[t] == 0]
I get no errors.
How do you exclude the endpoints of a plot?
thanks,
RobIn this particular case, you can reformulate the plot with Csc[t]
instead of 1/Sin[t]
and things seem to work:
ParametricPlot[{Csc[t], t}, {t, 0, 3 Pi}, Exclusions -> {Sin[t] == 0}]
I suspect the behavior with 1/Sin[t]
is simply a bug and will report it as such.
As a more-general workaround, you can wrap your original expression with Quiet
to surpress the error messages:
Quiet[ParametricPlot[{1/Sin[t], t}, {t, 0, 3 Pi},
Exclusions -> Sin[t] == 0], Power::infy]
精彩评论