Plotting A Discontinuous Function

The tangent function is well-known to all of us. In particular, we know that the graph of [Maple Math] has vertical asymptotes at all odd multiples of [Maple Math] . Let's see how Maple handles this.

> f := tan(x);

Note: This definition completely replaces the previous definition of f.

> plot( f , x = -Pi .. Pi );

>

Is this what you expected to see?

Why does the graph look like this?

What can be done to improve the appearance of the plot?

>

The key is to restrict the vertical range of the plot and tell Maple that the function is discontinuous.

> plot( f, x = -Pi .. Pi , -10 .. 10 );

> plot( f, x = -Pi .. Pi , -10 .. 10 , discont=true );

>

> plot ( ( 1 - 0.4*t^3) / ( 1 - t^2 ) , t = -3 .. 5 , -10 .. 10 ,

> discont = true, title = "vertical asymptotes [by DM]" ) ;

>

This technique is very useful for any function that has vertical asymptotes.

>