Mathematica Mathematica plot without asymptotes

  • Thread starter Thread starter PeetPb
  • Start date Start date
  • Tags Tags
    Mathematica Plot
AI Thread Summary
The discussion focuses on plotting a hyperbola in Mathematica without displaying asymptotes. The user initially struggles with the default behavior of Mathematica, which includes asymptotes due to the discontinuities of the secant and tangent functions. A suggested solution involves using the Exclusions option to avoid discontinuities by specifying the range for t. The user also shares a workaround that visually hides the asymptotes but acknowledges it is not an elegant solution. Ultimately, the key takeaway is that adjusting the plotting range and using exclusions can effectively manage asymptotes in Mathematica plots.
PeetPb
Messages
29
Reaction score
0
hi there,

I've a got a little problem here. I was trying to parametrically plot the hyperbola x=sec(t) y=tan(t) and mathematica always plots the asymptotes as well. Is there a way to hide these kind of asymptotes I know how to use the exclusions option to hide horizontal or maybe even vertical asymptotes but what about these ?

thanx for help
 
Physics news on Phys.org
Since you didn't show exactly how you are plotting this it is somewhat difficult to guess exactly what you are doing.

Presumably you are plotting a range that spans both segments of the plot.

Try this and see if it works for you

ParametricPlot[{{Sec[t], Tan[t]}, {Sec[t + Pi], Tan[t + Pi]}}, {t, -Pi/2, Pi/2}]

If that solves your asymptote problem then explore the plot range until you get closer to what you need
 
Last edited:
oh sorry I forgot to post it .. I'm plotting it just like this ParametricPlot[{Sec[t], Tan[t]}, {t, 0, 2 Pi}] so no plot ranges defined ... I'm trying your script but it does not plot any hyperbola ... I'm trying to play with it ... I was thinking how to use exclusions something like Exclusions -> {y==x} or something like that ...
 
I've actually found a rude way how to do it

Show[ParametricPlot[{Sec[t], Tan[t]}, {t, 0, 2 Pi},
PlotStyle -> {Blue, Thickness[0.005]}],
Plot[{x, -x}, {x, -8, 8},
PlotStyle -> {{White, Thickness[0.008]}, {White,
Thickness[0.008]}}]]

I know it's not elegant and it messes a lil bit up the hyperbola but it works just fine for me .. however I'm really interested if they really didn't put in their soft any option to disable the asymptotes...
 
The asymptotes are not something that they put in. They happen because Sec and Tan each have two discontinuities over the range from 0 to 2 Pi. Mathematica just trys to connect the different parts of the discontinuous function you specified.

If you want to avoid the asymptotes then you need to choose a range for t that avoids the discontinuities. The easiest way to do that is using the Exclusions option:

ParametricPlot[{Sec[t], Tan[t]}, {t, 0, 2 Pi}, Exclusions -> {Pi/2, 3 Pi/2}]
 
  • Like
Likes Emmo Amaranth

Similar threads

Replies
2
Views
12K
Replies
1
Views
3K
Replies
5
Views
3K
Replies
3
Views
11K
Replies
4
Views
11K
Replies
1
Views
4K
Back
Top