Just recently I was confronted with a situation where I wanted to draw a sequence of plots with a "division by zero" asymptote. Using the 'discont' option proved impractical, because the computations were intensive.

There may have been (almost surely) a better workaround than what I did below, but let me describe what I did, for the record: I created plots that I "manually" truncated before the asymptote and then redisplayed together. The way I did it, unfortunately, the plot colors were the same for all the individual plots, so I used a workaround consisting in recoloring the plots. Tedious, but it worked. If there was an easier way, of course, it would be good to know.

restart;

f := (x,y) ->1+1/(y-1/x);

xMin := 0:

xMax := 1:

fMin := -50:

fMax := +2:

plot(f(x,1.1),x=0..xMax);

# curves to draw

yList := [1.01, 1.015, 1.02, 1.025, 1.03, 1.035]:

iMax := numelems(yList):

# critical points

# solve({1/(f(x,y)-1)=0,x>0},x);

# critical values for different values of y in yList

xAsymptote := [seq(rhs(op(solve({1/(f(x,y)-1)=0,x>0},x))), y = yList)]:

# Map y to critical values

xAsymptoteMap := y -> xAsymptote[ListTools:-Search(y,yList)]:

# Check critical values

[seq(xAsymptoteMap(y), y = yList)];

# plot a list -> colors change

# plot( [seq(f(x,y),y=yList)], x = xMin .. xMax);

# use 'discont' option to remove asymptotes

plot( [seq(f(x,y),y=yList)], x = xMin .. xMax, 'discont'):

plots:-display(%, 'view' = [ xMin .. xMax, fMin .. fMax ]);

# display a list of plots -> colors all the same

# wrong approach in general, unless the 'discont' option consumes too many resources

# seq([plot(f(x,y), x = xMin .. xMax)],y=yList):

# plots:-display(%);

seq([plot(f(x,y), x = xMin .. xMax, 'discont')],y=yList):

plots:-display(%);

# create a list of plots with default settings

plot_list := [seq( plot(f(x,y), x = xMin .. xMax), y = yList )]:

plots:-display(%, view = [xMin .. xMax, fMin .. fMax]);

# create a list of plots cut off before the asymptote

plot_list := [seq( plot(f(x,y), x = xMin .. 0.99*xAsymptoteMap(y)), y = yList )]:

plots:-display(%, view = [xMin .. xMax, fMin .. fMax]);

# above procedure generates the plots separately and displays them sequentially

# to obtain different colors, each plot's color must be reset

# there seems to be no easy way to otherwise deal with the asymptotes

# create list of colors (here using Maple default)

colorlist := plots:-setcolors(default): # obtain the default list of colors

# procedure to recolor each plot

recolor := proc(p, color) # takes Hex values as input

subsindets(p

, 'specfunc(anything, {COLOR, COLOUR})'

, clr -> COLOUR(RGB,op(ColorTools:-HexToRGB24(color))/255.0) # convert Hex values to RGB values

)

end proc:

xyPlot := plots:-display(

recolor~(plot_list, colorlist[1..iMax])

, 'tickmarks' = [5, 5]

, 'labels' = [ 'x', 'y' ]

, view = [ xMin .. xMax, fMin .. fMax ]

) : xyPlot ;

With the simple function above, there are no problems with the 'discont' option. However, if one replaces f with the following, the computations for the 'discont' option seemed to go on forever, and hence the tedious workaround I used.

f := (x,y) -> 1+1.04/((1.04*(1-.9805806757*sqrt(x)))*sqrt(3006.731693*y^2/x-3124)+1.000320102*y-1.04);

xMin := 0:

xMax := 1.1:

fMin := 0:

fMax := +10: