Re: plotting graphs with asymptotes
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: plotting graphs with asymptotes
- From: Jack K. Cohen <jkc at dix.mines.colorado.edu>
- Date: Sun, 5 Sep 93 06:34:41 -0600
Tom Wickham-Jones at Wolfram, solved this problem elegantly a few months ago in response to a similar query. I made a nice NeXT notebook---mail me if you can take NeXTMail. But here is Tom's code: Unprotect[Plot]; Plot[ f_, {x_, lims__ /; Length[ {lims}] > 2}, opts___] := Module[ (* Tom Wickham-Jones, WRI *) {temp, eps = 10^-15, d}, temp = Partition[{lims}, 2, 1]; (* make pairs offset by 1 *) temp = ( d = (#[[2]] - #[[1]])*eps; (* get a delta *) # + {d, -d} (* shrink both ends by delta *) )& (* map over pairs to get shrunken pairs *) /@ temp; temp = Plot[f, Evaluate[Prepend[#,x]], (* iter triplets *) DisplayFunction -> Identity, opts ]& /@ temp; Show[temp, DisplayFunction -> $DisplayFunction]] Protect[Plot]; --- I call this "elegant" because you use this extended Plot in an already existing Mma syntax (that of NIntegrate) by specifying extra internal points at singularities: Plot[Tan[x], {x, 0, Pi/2, 3Pi/2, 2Pi}]