Re: Interval, Range of a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg81651] Re: Interval, Range of a function*From*: "David W.Cantrell" <DWCantrell at sigmaxi.net>*Date*: Sun, 30 Sep 2007 04:06:10 -0400 (EDT)*References*: <fdkrt6$7s7$1@smc.vnet.net>

janos <janostothmeister at gmail.com> 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? As Andrzej has already pointed out, there is no bug. It should also be mentioned that one can, easily, get the desired range in this example using f[Interval[{-Infinity, Infinity}]]. To do so, we must avoid the so-called "problem of dependence" by being careful about exactly how f is expressed. (Just think of "completing the square" in order to rewrite f.) In[1]:= f[x_] := 5*(Exp[-x] - 3/10)^2 - 9/20 In[2]:= f[Interval[{-Infinity, Infinity}]] Out[2]= Interval[{-9/20, Infinity}] But be aware that it is all too easy to find functions which cannot be expressed in a way that avoids the problem of dependence. David W. Cantrell