views:

33

answers:

1

Hi,

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 and 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,
Rob

+2  A: 

In 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]
Michael Pilat
Thanks! I didn't know about Quiet.
Rob N