Re: Not Plotting Vertical Assymptotes
- To: mathgroup at smc.vnet.net
- Subject: [mg18616] Re: [mg18542] Not Plotting Vertical Assymptotes
- From: "Wolf, Hartmut" <hwolf at debis.com>
- Date: Tue, 13 Jul 1999 01:01:36 -0400
- Organization: debis Systemhaus
- References: <199907100618.CAA02940@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
Hello Patrick
Patrick McLean schrieb:
>
> 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.
>
Perhaps there is a better method, but a quick fix would be:
In[3]:=
g1=Plot[1/(1-x),{x,0,1},DisplayFunction->Identity]
In[4]:=
g2=Plot[1/(1-x),{x,1,2},DisplayFunction->Identity]
In[5]:=
Show[g1,g2,PlotRange->{{0,2},Automatic},DisplayFunction->$DisplayFunction]
maybe that helps a little bit (Of course you could forge the idea to a
real program) ....
....ok, e.g. like that:
In[31]:= Unprotect[Plot]
In[32]:= Plot[f_,{var_Symbol,min_,sing__,max_},opts___]:=
Module[{ranges=Prepend[#,var]&/@Partition[{min,sing,max},2,1], g},
g=Map[Plot[f,#,opts,DisplayFunction->Identity]&,ranges];
Show[g,DisplayFunction->$DisplayFunction]]
In[33]:= Protect[Plot]
In[34]:= Plot[1/((1-x)(2-x)),{x,0,1,2,3},PlotRange->{All,{-50,50}}]
---your's hw
- References:
- Not Plotting Vertical Assymptotes
- From: p_mclean@postoffice.utas.edu.au (Patrick McLean)
- Not Plotting Vertical Assymptotes