Mathematica plot without asymptotes

  • Context: Mathematica 
  • Thread starter Thread starter PeetPb
  • Start date Start date
  • Tags Tags
    Mathematica Plot
Click For Summary

Discussion Overview

The discussion revolves around how to plot a hyperbola parametrically in Mathematica without displaying its asymptotes. Participants explore various methods to achieve this, including the use of exclusions and adjustments to the plotting range.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant describes their attempt to plot the hyperbola using the function ParametricPlot[{Sec[t], Tan[t]}, {t, 0, 2 Pi}] and expresses frustration over the appearance of asymptotes.
  • Another participant suggests modifying the plot range to avoid asymptotes and provides an alternative plotting method using ParametricPlot[{{Sec[t], Tan[t]}, {Sec[t + Pi], Tan[t + Pi]}}, {t, -Pi/2, Pi/2}].
  • A different participant shares a workaround that involves overlaying a plot of the asymptotes in white to visually hide them, although they acknowledge this method is not elegant.
  • One participant explains that the asymptotes are a result of the discontinuities in the Sec and Tan functions and suggests using the Exclusions option to avoid them, specifically recommending Exclusions -> {Pi/2, 3 Pi/2}.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to hide asymptotes, with some proposing workarounds while others suggest adjusting the range or using exclusions. No consensus is reached on a definitive solution.

Contextual Notes

Participants note the presence of discontinuities in the functions used, which contribute to the appearance of asymptotes. The discussion includes various methods and suggestions but does not resolve the issue of a straightforward option to disable asymptotes in Mathematica.

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   Reactions: Emmo Amaranth

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
12K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
11K
  • · Replies 4 ·
Replies
4
Views
11K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
6K