Re: Reduce and Indeterminate

*To*: mathgroup at smc.vnet.net*Subject*: [mg87802] Re: Reduce and Indeterminate*From*: "Szabolcs HorvÃt" <szhorvat at gmail.com>*Date*: Thu, 17 Apr 2008 06:58:11 -0400 (EDT)*References*: <fu6mb9$nl0$1@smc.vnet.net> <4806EE02.6060105@metrohm.ch>

Yes, a statement can be true, it can be false, or it might not make any sense. If it does not make sense, then considering it false is just as bad as considering it true. On 4/17/08, dh <dh at metrohm.ch> wrote: > Hi Szabolcs, > it would certainly be nice and consistent if a message about a invalid > comparison is produced. But we must ask if real harm can be produced from > this result and I think this is possible. Although all arthmetic operations > on Indeterminate give Indeterminate, it is not hard to come up with a simple > example where things go wrong: > f[x_]:=If[Reduce[x>0],"pos","neg","ind"]; > Therefore, I think a warning is a must. > Daniel > > Szabolcs HorvÃ¡t wrote: > > If a complex number appears in an inequality, Reduce issues a warning: > > > > Reduce[I > 0] > > > > This is useful (to avoid mistakes). But if Indeterminate appears in an > inequality, Reduce will immediately say False: > > > > Reduce[Indeterminate > 0] > > > > While it is debatable what is the correct thing to do mathematically, I > naively believe that it would be useful if Reduce at least gave a warning. > It is true that it is not a good idea to manipulate expressions completely > blindly (without paying attention to what they contain), but some functions > may return very large expressions ... and the main advantage of using > computers is that they can do large and tedious calculations quickly. > > > > What do MathGroup readers think about this? > > > > Here's a somewhat artificial example: > > > > In[1]:= Integrate[1/x, {x, a, b}] > > > > Out[1]= If[(-Im[b] Re[a] + Im[a] Re[b])/(Im[a] - Im[b]) >= > > 0 && ((Re[a/(-a + b)] >= 0 && a/(-a + b) != 0) || > > Re[a/(a - b)] >= 1 || Im[a/(-a + b)] != 0), -Log[a] + Log[b], > > Integrate[1/x, {x, a, b}, > > Assumptions -> ! ((-Im[b] Re[a] + Im[a] Re[b])/(Im[a] - Im[b]) >= > > 0 && ((Re[a/(-a + b)] >= 0 && a/(-a + b) != 0) || > > Re[a/(a - b)] >= 1 || Im[a/(-a + b)] != 0))]] > > > > In[2]:= First[%] > > > > Out[2]= (-Im[b] Re[a] + Im[a] Re[b])/(Im[a] - Im[b]) >= > > 0 && ((Re[a/(-a + b)] >= 0 && a/(-a + b) != 0) || > > Re[a/(a - b)] >= 1 || Im[a/(-a + b)] != 0) > > > > In[3]:= Reduce[% && (a | b) \[Element] Reals] > > > > Out[3]= False > > > > Note that unlike Reduce, FullSimplify gives a warning: > > > > In[4]:= FullSimplify[%%, (a | b) \[Element] Reals] > > > > During evaluation of In[4]:= FullSimplify::infd: Expression (-Im[b] \ > > Re[a]+Im[a] Re[b])/(Im[a]-Im[b]) simplified to Indeterminate. >> > > > > Out[4]= Indeterminate >= > > 0 && (Im[a/(-a + b)] != 0 || > > Re[a/(a - b)] >= 1 || (a/(a - b) != 0 && Re[a/(-a + b)] >= 0)) > > > > In[5]:= Reduce[Rest[%] && (a | b) \[Element] Reals, {a, b}] > > > > Out[5]= (a < 0 && (b < a || a < b <= 0)) || (a > > > 0 && (0 <= b < a || b > a)) > > > > > > > > 1