Re: Interval arithmetic bug

*To*: mathgroup at smc.vnet.net*Subject*: [mg90804] Re: Interval arithmetic bug*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Fri, 25 Jul 2008 06:11:34 -0400 (EDT)*References*: <g670mq$s3n$1@smc.vnet.net>

On Jul 23, 12:21 pm, green tea <cetec... at gmail.com> wrote: > In[1]:= Limit[Sin[x], x -> Infinity] > > Out[1]= Interval[{-1, 1}] > > In[2]:= Limit[Sin[x + Pi/4], x -> Infinity] > > Out[2]= Interval[{-Sqrt[2], Sqrt[2]}] > > In[3]:= TrigExpand[Sin[x + Pi/4]] > > Out[3]= Cos[x]/Sqrt[2] + Sin[x]/Sqrt[2] > > In[4]:= (Limit[#1, x -> Infinity] & ) /@ {Cos[x]/Sqrt[2], > Sin[x]/Sqrt[2]} > > Out[4]= {Interval[{-(1/Sqrt[2]), 1/Sqrt[2]}], > Interval[{-(1/Sqrt[2]), 1/Sqrt[2]}]} > > In[5]:= Plus @@ % > > Out[5]= Interval[{-Sqrt[2], Sqrt[2]}] > > In[6]:= $Version > > Out[6]= "6.0 for Microsoft Windows (32-bit) (May 21, 2008)" > > oh my god.. I might have missed the point, but as far as I can tell, the interval arithmetic is correct. What you may have expected is to get the interval [-1, 1], which is included in the interval [-sqrt(2), sqrt(2)]; however, when computing limits, they is no guarantee whatsoever that Mathematica will return systematically the smallest interval that encompasses all possible values since an *Interval[]* object has no knowledge of the function that generated it in first instance (so the standard rules of interval arithmetic applied). For instance, the following example is perfeclty correct in terms of interval arithmetic, though one may have wished to get one for the last expression: In[1]:= Limit[Cos[x]^2 + Sin[x]^2, x -> Infinity] Limit[Cos[x]^2, x -> Infinity] Limit[Sin[x]^2, x -> Infinity] Limit[Cos[x]^2, x -> Infinity] + Limit[Sin[x]^2, x -> Infinity] Out[1]= 1 Out[2]= Interval[{0, 1}] Out[3]= Interval[{0, 1}] Out[4]= Interval[{0, 2}] Regards, -- Jean-Marc