Re: Interval[{a,b}]-Interval[{a,b}] = 0?
- To: mathgroup at smc.vnet.net
- Subject: [mg66644] Re: [mg66613] Interval[{a,b}]-Interval[{a,b}] = 0?
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Thu, 25 May 2006 02:58:37 -0400 (EDT)
- References: <200605240701.DAA08477@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Richard Fateman wrote: > Is this a bug or a feature? > Notice that Interval[{-1,1}]-Interval[{-1,1}] is Interval[{-2,2}]. > > (I'm using Mathematica 5.1) > > RJF It is a very important feature in that this is exactly how intervals are supposed to work (read this as though it were ALL IN CAPS). Intervals are to be treated as independent values, and interval arithmetic (as presented in the literature) should indeed do exactly as you see above. For ranges of values that are meant to correlate e.g. obtaining zero from With[{x=Interval[...]}, x-x] the fact is that interval arithmetic is not the correct tool. Likewise for finding max and min values of a function of x over some interval on the real line, though sometimes interval arithmetic is used to get fast overshooting of such bounds. Here is a related example I ran across yesterday, from a bug report sent in by a user. We want to get a sensible result from Limit[ArcTan[Sin[x]], x->Infinity] Here is a sensible result from my development version (I am ignoring some of the things stated in the recent sci.math.symbolic thread: http://groups.google.com/group/sci.math.symbolic/browse_frm/thread/305c7f6f5405e51d/86468049d07c1a28?lnk=st&q=Fateman+Limit&rnum=1&hl=en#86468049d07c1a28 ) In[4]:= InputForm[Limit[ArcTan[Sin[x]], x->Infinity]] Out[4]//InputForm= Interval[{-Pi/4, Pi/4}] Here is a result that is not so good. It is what prompted the user to send in a bug report. In[1]:= Limit[ArcTan[Sin[x]], x->Infinity] Out[1]= 0 Why did we get 0? Well, we found some limits of summands from a series representation. The series used was not optimal, but that's beside the point. Here is an intermediate form of the limit sum. Log[(2 - (1 + I)*Interval[{-1, 1}] + (1 + I)*Interval[{-1, 1}])/2] - Log[(2 - (1 + I)*Interval[{-1, 1}] + (1 + I)*Interval[{-1, 1}])/2] Notice that this is of the form Log[ii]-Log[ii] where ii contains Interval objects. Mathematica's eager Plus handling cancels the summands, giving 0. We are (today) experimenting with weakening this handler to not coalesce terms containing Interval. If this proves to give acceptable results on relevant parts of our test suite then we will be able to give the better interval result shown above. Daniel Lichtblau Wolfram Research
- References:
- Interval[{a,b}]-Interval[{a,b}] = 0?
- From: "Richard Fateman" <fateman@cs.berkeley.edu>
- Interval[{a,b}]-Interval[{a,b}] = 0?