RE: Re: Re: Holes when plotting funtions
- To: mathgroup at smc.vnet.net
- Subject: [mg42217] RE: [mg42200] Re: [mg42194] Re: Holes when plotting funtions
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Tue, 24 Jun 2003 01:27:03 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: Andrzej Kozlowski [mailto:akoz at mimuw.edu.pl] To: mathgroup at smc.vnet.net >Sent: Monday, June 23, 2003 11:50 AM >To: mathgroup at smc.vnet.net >Subject: [mg42217] [mg42200] Re: [mg42194] Re: Holes when plotting funtions > > >Roman Maeder's article deals with (among other things) detecting >singularities. However, in this case there is no singularity: > >In[19]:= >Limit[x(1-Cos[x])/(x-Sin[x]),x->0] > >Out[19]= >3 > >If you try Maeder's IntervalPlot on this graph you will get something >rather surprising and very far from what was asked for. > > >In fact Mathematica's interval arithmetic doesn't seem to be able to >deal with this function properly, try: >Function[x, x(1-Cos[x])/(x-Sin[x]][Interval[-1,1]] > > >Andrzej Kozlowski >Yokohama, Japan >http://www.mimuw.edu.pl/~akoz/ >http://platon.c.u-tokyo.ac.jp/andrzej/ > > >On Sunday, June 22, 2003, at 05:05 PM, Bill Rowe wrote: > >> On 6/21/03 at 8:57 PM, Elansary at btopenworld.com (Ashraf El Ansary) >> wrote: >> >>> Is there any way to mathematica to distinguish non-continous >>> equations in >>> the 'Plot' function. For example: >>> f[x_]:=x(1-Cos[x])/(x-Sin[x]) >>> Plot[f[x],{x,-20,20},AxesLabel->{x,y},AxesOrigin->{0,0}] >> >>> The above example is not defined around zero, but when plotted by >>> Mathematica , it looks as if the function is continous. Is there any >>> way to >>> plug a whole in those intervals which are not continous (simillar to >>> those >>> depicted in textbooks for step /open/closed intervals]...... >> >> Roman Maeder wrote an article for the Mathematica Journal (vol 7.3) >> regarding interval plots that identifies problems like this. If you >> have a subscription to the Mathematica Journal you can download the >> this artical in electronic format from their web site. If not, try a >> search on the Wolfram Information Center. Look for articles written by >> Roman Maeder on the subject of interval plots or global optimization >> >> >> > Andrzej, for the intervals, that's quite adequate, see In[77]:= 1/(x - Sin[x]) /. x -> Interval[{-1., 1.}] Out[77]= Interval[{-\[Infinity], -0.543044}, {0.543044, \[Infinity]}] In[78]:= (1 - Cos[x]) /. x -> Interval[{-.1, .1}] Out[78]= Interval[{0, 0.00499583}] In[79]:= x /. x -> Interval[{-.1, .1}] Out[79]= Interval[{-0.1, 0.1}] In[80]:= %77*%79 Out[80]= Interval[{-\[Infinity], \[Infinity]}] In[81]:= %77*%78 Out[81]= Interval[{-\[Infinity], \[Infinity]}] In[82]:= %78*%79 Out[82]= Interval[{-0.000499583, 0.000499583}] as the factors to %77 contain 0. With respect to the original question, as about the continous plot: That's not quite true, see: In[91]:= Plot[x (1 - Cos[x])/(x - Sin[x]), {x, -.0001, .0001}] In fact it needs quite a macroscopic hole, to cut out the numerical instabilities! It could not be seen with the original graphics, because In[103]:= g = Plot[f[x], {x, -20, 20}, AxesLabel -> {x, y}, AxesOrigin -> {0, 0}] In[104]:= Select[First /@ g[[1, 1, 1, 1]], Positive] // First Out[104]= 0.040572 In[105]:= Select[First /@ g[[1, 1, 1, 1]], NonPositive] // Last Out[105]= -0.0119875 -- Hartmut Wolf