Re: Interval, Range of a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg81624] Re: [mg81612] Interval, Range of a function*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Sat, 29 Sep 2007 06:26:22 -0400 (EDT)*References*: <200709290629.CAA07794@smc.vnet.net>

On 29 Sep 2007, at 15:29, janos wrote: > If you ask Mathematica what is the range of Sin restricted to e.g. > [0,Pi/4] > you will get a correct answer. > This is not always the case, however. Let > f[x_]:=5Exp[-2x]-3Exp[-x] > f[Interval[{-Infinity,+Infinity}]] > > Then the answer Interval[{-Infinity,+Infinity}] is different from what > you see on the figure of the function. > > Is there a bug here? > > Thanks, Janos > > This is not a bug but just the way "Interval arithmetic" works. Applying a function to an interval does not give you the range of the function: it gives you an interval which will contains the range of the function. The purpose of interval arithmetic is error estimation, and it tends to "over estimate". This is, indeed, its weakest point, but that is how it works. If you ever get an answer that does not contain the range of the function that you will certainly have found a bug. There are other methods of error estimation that do not suffer from this problem to such an extent (so called "affine arithmetic" is one) but they all overestimate (the principle that "it is better to be safe them sorry") To see how this overestimation comes about note that if: g[x_] := 5/E^(2*x); h[x_] := 3/E^x; then Through[{g, h}[Interval[{-Infinity, +Infinity}]]] {Interval[{0, =B0}], Interval[{0, =B0}]} which indeed give the correct ranges. But to compute the image of the difference Mathematica simply computes: Subtract @@ % Interval[{-Infinity, Infinity}] which is, of course, much larger than the true range. Andrzej Kozlowski

**References**:**Interval, Range of a function***From:*janos <janostothmeister@gmail.com>