Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica plot without asymptotes

  1. Sep 19, 2011 #1
    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
  2. jcsd
  3. Sep 19, 2011 #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: Sep 19, 2011
  4. Sep 19, 2011 #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 ....
  5. Sep 19, 2011 #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,

    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....
  6. Sep 19, 2011 #5


    Staff: Mentor

    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}]
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook