Re: Not Plotting Vertical Assymptotes
- To: mathgroup at smc.vnet.net
- Subject: [mg18930] Re: Not Plotting Vertical Assymptotes
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 27 Jul 1999 22:17:29 -0400
- References: <7m6ivl$2l5@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Patrick McLean <p_mclean at postoffice.utas.edu.au> wrote in message news:7m6ivl$2l5 at smc.vnet.net... > Anyone have any idea how to stop Plot putting a (near) vertical line at > x=2 in the command: > > Plot[1/(1-x),{x,0,2}] > > ie. detect that the function 1/(1-x) has a singularity at x=2 and do > something about it. This is analagous to numerically integrating over a > (integrable) singularity, where the following remedy works: > > NIntegrate[1/Abs[Sqrt[x-1]]^2,{x,0,1,2}] > > But in this case it doesn't work. Decreasing MaxBend works a bit but the > line is still there. > > (I am really interested in drawing paths in the plane using ParmetricPlot) > > Any ideas or comments > > -- > Patrick McLean > > No news is good news... Patrick Here is a way: more work will be needed with ParametricPlot Using Split we can write a function that operates on Graphics objects and splits lines at points where the absolute slope gets big, DeleteVerticals[gr_Graphics, slopeMax_] := gr /. Line[lst_] :> Map[Line, Split[lst, Abs[Divide @@ Reverse[#1 - #2]] < slopeMax &], 1]; Test: some experimentiation to get the right value for slopeMax may be needed. Show[DeleteVerticals[Plot[1/(1-x),{x,0,2}] , 20000]] Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565