Mathematica plot without asymptotes

In summary, you are trying to plot a range that spans both segments of the plot but are having trouble getting Mathematica to plot the hyperbola correctly. You can try choosing a different range for t that avoids the discontinuities.
  • #1
PeetPb
29
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
  • #2
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:
  • #3
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 ...
 
  • #4
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...
 
  • #5
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

Related to Mathematica plot without asymptotes

1. What is an asymptote in a Mathematica plot?

An asymptote in a Mathematica plot is a line or curve that a function approaches, but does not intersect or touch. This can occur when there is a vertical or horizontal shift in the function, resulting in a gap between the function and the asymptote.

2. How can I plot a function without asymptotes in Mathematica?

To plot a function without asymptotes in Mathematica, you can use the "Exclusions" option in the Plot function. Set the value of Exclusions to "None" to remove any asymptotes from the plot.

3. Can I manually add asymptotes to a Mathematica plot?

Yes, you can add asymptotes to a Mathematica plot by using the "Epilog" option in the Plot function. You can specify the location and style of the asymptote using graphics primitives such as Line or Dashed.

4. Why do I see asymptotes in my Mathematica plot?

Asymptotes in a Mathematica plot are typically caused by discontinuities or singularities in the function. This can happen when the function is undefined or has a vertical or horizontal shift that creates a gap between the function and the asymptote.

5. How can I remove specific asymptotes from a Mathematica plot?

To remove specific asymptotes from a Mathematica plot, you can use the "Exclusions" option and specify the location of the asymptotes to be excluded. You can also use the "Epilog" option to manually remove specific asymptotes from the plot.

Similar threads

  • STEM Educators and Teaching
Replies
5
Views
767
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
12K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • Programming and Computer Science
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
22
Views
1K
  • General Discussion
Replies
24
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Back
Top