Re: LessEqual vs Inequality, was ..Re: Replacement Rule with Sqrt in denominator
- To: mathgroup at smc.vnet.net
- Subject: [mg114724] Re: LessEqual vs Inequality, was ..Re: Replacement Rule with Sqrt in denominator
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Tue, 14 Dec 2010 06:55:42 -0500 (EST)
On 12/13/2010 11:56 AM, Andrzej Kozlowski wrote: > On 13 Dec 2010, at 17:53, Andrzej Kozlowski wrote: > >>> FullSimplify [Less[x,y,z]-Inequality[x,Less,y,Less,z] ] >>> does not reduce to zero, as it should. So Mathematica, dare >>> I say, exhibits a bug. > In fact, I am (almost) amazed to see you claim that. There are certainly advantages to having a mathematics education for I am sure that nobody with that would ever expect this to work. What sort of algebraic structure is this subtraction taking place in, according to you? What sort of algebraic transformations is FullSimplify supposed to use here? The same structure that allows (3<4) - (5<6) to come out as 0. That is, in Mathematica, True - True is zero. You may argue that truth values do not support subtraction as an operation, but then you are imposing either an algebraic structure (mathematically speaking) or a type system (programming-language speaking -- or perhaps mathematically, a category theory), on Mathematica. There is very little evidence of such sensitivity in Mathematica, and I, for one, am not a keen fan of imposing such a structure in a computer algebra system that is kind of open ended. The algebraic transformation that FullSimplify can, and I think should, apply, is <object X> - <object X> --> 0. This is ordinarily, but not universally true . e.g. Indeterminate - Indeterminate is not zero. Nor is it zero for X= Interval[{-1,1}]. But True - True seems to me kind of OK to simplify to 0. After all, if someone has asked you to do subtraction on these things, he might know what he is doing. Maybe he is just a physicist, and not particularly educated in modern algebra or programming language types. (I could also suggest circumstances in which True-True is not a great idea, and what should be used is TautologyQ[p==q] rather than p-q. But in this case, especially because it means that I disagree with you, I will defend the usage FullSimplify[p-q], which could be interpreted as Tautology[p==q].) > Good grief! > > As I already pointed out: > > > Refine[Less[x, y, z], Inequality[x, Less, y, Less, z]]&& > Refine[Inequality[x, Less, y, Less, z], Less[x, y, z]] > > True > > This simply means that truth of each expression implies the truth of the other - which is all that you could expect Mathematica to tell you. I don't understand why you think that. I can expect Mathematica, when asked, to convert each of these expressions to a canonical form. I would prefer, at the moment, to have the simplification be Less[x,y,z] --> Inequality[x,Less,y,Less,z] or perhaps Comparison[x,Less,y,Less,z] or even And[Comparison[x,Less,y],Comparison[y,Less,z]]. Comparisons, especially inequality, of more than 2 items is tricky. 1 != 2 != 1 is, by convention, false, and is not the same as not[1==2==1]. > And please do not point out that > > (2< 3) - (5< 7) > > 0 > > for you surely know that what is going on here has is an entirely different thing. Not at all. It means exactly what I intend it to mean, which is True - True, which is a simple way of comparing two objects to see if they are isomorphic. Mathematica also can subtract strings, "abc" -"abc" is 0. Mathematica also can subtract Graphics objects. Plot[Sin[x],{x,-1,1}] - Plot[Sin[x],{x,-1,1}] is 0. If you don't like this behavior, I suggest you report it as a bug. RJF