Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Weird result in Mathematica 6

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76628] Re: [mg76432] Re: [mg76393] Weird result in Mathematica 6
  • From: Adam Strzebonski <adams at wolfram.com>
  • Date: Fri, 25 May 2007 06:22:38 -0400 (EDT)
  • References: <200705211001.GAA10071@smc.vnet.net> <EB6D3224-597F-4DD6-B05D-08B9F6A05D2D@mimuw.edu.pl> <200705220648.CAA19836@smc.vnet.net> <63B2BBD7-455D-42F6-AFB2-63F7D37D62D3@mimuw.edu.pl> <465461D4.5000109@wolfram.com> <1FA17BCB-CFF6-4C96-BC81-F5C84629F61C@mimuw.edu.pl> <5B668FAB-4950-497D-9CCF-E7C37A9D5A5E@mimuw.edu.pl>
  • Reply-to: adams at wolfram.com

Andrzej Kozlowski wrote:
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> 
> On 24 May 2007, at 05:18, Andrzej Kozlowski wrote:
> 
>> *This message was transferred with a trial version of CommuniGate(tm) 
>> Pro*
>>
>> On 24 May 2007, at 00:46, Adam Strzebonski wrote:
>>
>>> Andrzej Kozlowski wrote:
>>>> *This message was transferred with a trial version of 
>>>> CommuniGate(tm) Pro*
>>>> On 22 May 2007, at 15:48, Adam Strzebonski wrote:
>>>>> Andrzej Kozlowski wrote:
>>>>>> *This message was transferred with a trial version of 
>>>>>> CommuniGate(tm) Pro*
>>>>>>
>>>>>> On 21 May 2007, at 19:01, Sebastian Meznaric wrote:
>>>>>>
>>>>>>> I was playing around with Mathematica 6 a bit and ran this 
>>>>>>> command to
>>>>>>> solve for the inverse of the Moebius transformation
>>>>>>>
>>>>>>> FullSimplify[
>>>>>>>  Reduce[(z - a)/(1 - a\[Conjugate] z) == w && a a\[Conjugate] < 1 &&
>>>>>>>    w w\[Conjugate] < 1, z]]
>>>>>>>
>>>>>>> This is what I got as a result:
>>>>>>> -1 < w < 1 && -1 < a < 1 && z == (a + w)/(1 + w Conjugate[a])
>>>>>>>
>>>>>>> Why is Mathematica assuming a and w are real? The Moebius
>>>>>>> transformation is invertible in the unit disc regardless of 
>>>>>>> whether a
>>>>>>> and w are real or not. Any thoughts?
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> Reduce and FullSimplify will usually deduce form the presence of
>>>>>> inequalities in an expression like the above that the variables
>>>>>> involved in the inequalites are real. In your case it "sees"
>>>>>> a*Conjugate[a]<1 and "deduces" that you wanted a to be real. This was
>>>>>> of coruse not your intention but you can get the correct behaviour by
>>>>>> using:
>>>>>>
>>>>>>  FullSimplify[
>>>>>>  Reduce[(z - a)/(1 - Conjugate[a]*z) == w && Abs[a]^2 < 1 && 
>>>>>> Abs[w] ^2 <
>>>>>> 1, z]]
>>>>>>
>>>>>>
>>>>>>  -1 < Re[w] < 1 && -Sqrt[1 - Re[w]^2] < Im[w] < Sqrt[1 - Re[w]^2] 
>>>>>> &&  -1 <
>>>>>>   Re[a] < 1 &&
>>>>>>    -Sqrt[1 - Re[a]^2] < Im[a] < Sqrt[1 - Re[a]^2] &&
>>>>>>  z == (a + w)/(w*Conjugate[a] + 1)
>>>>>>
>>>>>> Mathematica knows that the fact that an inequality involves 
>>>>>> Abs[a]  does
>>>>>> not imply that a is real but it does not "know" the same thing  about
>>>>>> a*Conjugate[a]. This is clearly dictated by considerations of
>>>>>> performance than a straight forward bug.
>>>>>> Andrzej Kozlowski
>>>>>>
>>>>>
>>>>> By default, Reduce assumes that all algebraic level variables 
>>>>> appearing
>>>>> in inequalities are real. You can specify domain Complexes, to make
>>>>> Reduce assume that all variables are complex and inequalities
>>>>>
>>>>> expr1 < expr2
>>>>>
>>>>> should be interpretted as
>>>>>
>>>>> Im[expr1]==0 && Im[expr2]==0 && Re[expr1]<Re[expr2]
>>>>>
>>>>> For more info look at
>>>>>
>>>>> http://reference.wolfram.com/mathematica/ref/Reduce.html
>>>>> http://reference.wolfram.com/mathematica/tutorial/RealReduce.html
>>>>> http://reference.wolfram.com/mathematica/tutorial/ComplexPolynomialSystems.html 
>>>>>
>>>>>
>>>>> In your example we get
>>>>>
>>>>> In[2]:= Reduce[(z - a)/(1 - a\[Conjugate] z) == w && a 
>>>>> a\[Conjugate] < 1 &&
>>>>>     w w\[Conjugate] < 1, z, Complexes]
>>>>>
>>>>>                                           2                          2
>>>>> Out[2]= -1 < Re[w] < 1 && -Sqrt[1 - Re[w] ] < Im[w] < Sqrt[1 - 
>>>>> Re[w] ] &&
>>>>>
>>>>>                                        2                          2
>>>>>>    -1 < Re[a] < 1 && -Sqrt[1 - Re[a] ] < Im[a] < Sqrt[1 - Re[a] ] &&
>>>>>
>>>>>                  a + w
>>>>>>    z == ------------------
>>>>>            1 + w Conjugate[a]
>>>>>
>>>>>
>>>>> Evaluate
>>>>>
>>>>> Reduce[x^2+y^2<=1, {x, y}, Complexes]
>>>>>
>>>>> to see why I think that assuming that variables appearing
>>>>> in inequalities are real is a reasonable default behaviour.
>>>>>
>>>>> Best Regards,
>>>>>
>>>>> Adam Strzebonski
>>>>> Wolfram Research
>>>>>
>>>> Still, it seems to me that there is a certain problem with this, not 
>>>> very important but still, a "logical difficulty". It concerns not 
>>>> Reduce, where you can specify the domain to be Reals or Complexes 
>>>> etc, but Simplify, where you can't. So for example:
>>>> Simplify[Re[x], x*Conjugate[x] > 1]
>>>> x
>>>> folowing the principle also used by reduce, Simplify assumed that x 
>>>> is real. On the other hand:
>>>> Simplify[Re[x], Abs[x] > 1]
>>>>  Re(x)
>>>> which also agrees with the principle, sicne Abs in non-algebraic. 
>>>> But, unlike in the case of Reduce, there seems to be no way to make 
>>>> Simplify treat the first assumption as taking place over the 
>>>> Complexes as in the Reduce example:
>>>>  Simplify[Re[x], x*Conjugate[x] > 1 && Elment[x, Complexes]]
>>>> x
>>>
>>> Adding Element[x, Complexes] doesn't change anything, since
>>>
>>> Element[x, Reals] && Element[x, Complexes] <=> Element[x, Reals]
>>>
>>> The way to specify that variables used in an inequality are complex
>>> is to use Im[expr]==0 && Re[expr]>0 instead of expr>0.
>>>
>>> In[1]:= Simplify[Re[x], Im[x*Conjugate[x]]==0 && Re[x*Conjugate[x]]>1]
>>> Out[1]= Re[x]
>>>
>>> Best Regards,
>>>
>>> Adam Strzebonski
>>> Wolfram Research
>>>
>>
>>
>> Yes, you are right, this works, although it is a little un-intuitive, 
>> since, of course,
>>
>>  FullSimplify[Im[x*Conjugate[x]]]
>>  0
>>
>> without any assumptions on x.
>>
>> Aslo, instead of
>>
>>> Simplify[Re[x] && ! Element[x, Reals], x*Conjugate[x] > 1]
>>> False
>>
>>
>> which is of course completely right, what  I really should have 
>> pointed out was :
>>
>> Simplify[Re[x], x*Conjugate[x] > 1 && Not[Element[x, Reals]]]
>>  x
>>
>> Andrzej
>>
> 
> More along the same lines:
> 
> Simplify[Re[x], x*Conjugate[x] > 1 && Im[x] != 0]
> 
> Simplify::cas:Warning: Contradictory assumption(s) x*Conjugate[x] > 1 && 
> Im[x] != 0 encountered.
> 
> x
> 
> The assumptions are, of course, not contradictory in "ordinary 
> mathematics" so somone who did not know what is going here might find 
> this a bit of a shock. Of course, all this can be justified on grounds 
> of performance but it takes getting used to (as witnessed by the fact 
> that in spite of many years of "knowing" about this, I am still getting 
> confused by it).
> 
> In practice, it is clearly much simpler, to express conditions of this 
> kind using Abs[x] insead of x*Conjugate[x].
> 
> With best regards
> 
> Andrzej
> 

The rules for what are the "intuitive" implicit assumptions are too
vague for programmatic implementation.

In[1]:= Simplify[expr, x^2+y^2<1 && x+y==100]

Simplify::cas: Warning: Contradictory assumption(s)
      2    2
     x  + y  < 1 && x + y == 100 encountered.

Out[1]= expr

In[2]:= Simplify[x+y==100, x^2+y^2<1]
Out[2]= False

These do not seem counterintuitive despite the fact that there
exist complex "solutions".

In[3]:= FindInstance[x^2+y^2<1 && x+y==100, {x, y}, Complexes]
Out[3]= {{x -> 50 - 67 I, y -> 50 + 67 I}}

I wrote "solutions" in quotes, because x^2+y^2<1 && x+y==100
is not really a mathematical formula with complex variables
x and y, since for most pairs of complex numbers {x, y},
it is neither true nor false. So the meaning of "solutions"
is here extended to "the formula is well defined and is True".

On the the other hand if Im or Conjugate of a variable is used
somewhere else in the input, it does seem intuitive to assume
that the variable is complex. So "intuitively" in

x^2+y^2<1 && x+y==100

x and y are real, but in

x^2+y^2<1 && x+y==100 && Im[x]>Im[y]+1

x and y are complex. But this "intuitive rule" doesn't really
translate well into programmatic rules. For instance, one would
expect that adding an assumption should restrict the values of
variables, but with the "intuitive rule" adding Im[x]>Im[y]+1
would result in removing assumptions that x and y are real...

Now, x*Conjugate[x]>1 is different, because it actually is
a valid formula for arbitrary complex x. But other syntactically
similar formulas, like (x^2+1)*Conjugate[x]>1, are not valid for
arbitrary complex x and the sets of complex numbers for which they
are well defined are rather complicated.

With the implemented rule, which assumes that all algebraic level
variables in inequalities are real, it is at least easy to tell
what assumptions are being made.

Best Regards,

Adam Strzebonski
Wolfram Research


  • Prev by Date: Re: On typesetting
  • Next by Date: Re: V6 evaluation inside Table and plot
  • Previous by thread: Re: Re: Weird result in Mathematica 6
  • Next by thread: Re: Weird result in Mathematica 6