MathGroup Archive 2006

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

Search the Archive

Re: Re: Re: solve and Abs

On 14 Sep 2006, at 08:21, Andrzej Kozlowski wrote:

> On 13 Sep 2006, at 23:51, Daniel Lichtblau wrote:
>> Andrzej Kozlowski wrote:
>>> On 12 Sep 2006, at 20:40, Peter Pein wrote:
>>>> Andrzej Kozlowski schrieb:
>>>>> On 10 Sep 2006, at 20:20, Peter Pein wrote:
>>>>>> Richard J. Fateman schrieb:
>>>>>>> Is there a reason (in 5.1) for Solve[x-Abs[x]==0,x] to return  
>>>>>>> {{}}?
>>>>>>> This supposedly means all variables can have all possible  
>>>>>>> values.
>>>>>>> Reduce does better.
>>>>>> Oops, I should have read further...
>>>>>> Help says
>>>>>> "Solve gives {{}} if all variables can have all possible values."
>>>>>> I would consider this a bug, not a feature.
>>>>>> Sorry for overhasty posting,
>>>>>> Peter
>>>>> However, the documentation does not say "Solve gives {{}} if  
>>>>> and  only if all variables can have all possible values." There  
>>>>> are  other cases when Solve returns {{}}. For example, Solve  
>>>>> also gives  {{}} when, for example, there is no "generic"  
>>>>> solution. (This is  stated in the Help also). In addition,  
>>>>> although this does not seem  to be stated, Solve never returns  
>>>>> solutions that would have to be  given in conditional form  
>>>>> (like the solution returned in this  example by Reduce). This  
>>>>> does not appear to be stated in the help  but has been pointed  
>>>>> out several times on this list.
>>>>> Andrzej Kozlowski
>>>>> Tokyo, Japan
>>>> all variables can have all possible values =:AVAPV
>>>> solve rteurns {{}} =:SRE
>>>> But if AVAPV=>SRE but not SRE=>AVAPV, what use has SRE? It would  
>>>> be  better to admit "no solutions found" (by returning {}).
>>>> Or am I completely wrong?
>>>> Confused greetings,
>>>> Peter
>>> Oops, I think you are right. In fact, when Solve can find no  
>>> generic  solutions it returns {} and not {{}}.
>>> Solve[{x + y == 1, x + y == a}, {x, y}]
>>> {}
>>> So it does seem that {} has a different meaning from {{}}, which   
>>> makes me now also confused ;-)
>>> Andrzej
>> An empty result, {}, indicates that either there are no generic  
>> solutions (as in the case above, because all solutions force a  
>> parameter  constraint a==1), or else that Solve found no solutions  
>> (can happen e.g. with transcendentals that get "algebraicized" but  
>> then fail to yield viable solutions using Solve's creaky technology).
>> An AVAPV result, in the terminology above, is a different fish. It  
>> means any value for the solve variable(s) will satisfy the  
>> "polynomialized" problem. So what does that mean? In the simple  
>> case that began this thread, Abs[x] is converted to Sqrt[x^2]  
>> (which many will realize is already a mistake off the real line.  
>> C'est la vie.) We make a new variable y which "encapsulates" Sqrt 
>> [x^2], and new equation y^2==(Sqrt[x^2])^2==x^2. So we are doing,  
>> in effect,
>> Solve[{x==y,y^2==x^2}, x, y]
>> (that is, eliminating y).
>> This correctly returns {{}}. Ordinarily when radicals are present  
>> Solve understands that parasite solutions may be found, and makes  
>> an attempt to check them. But in this case what can it check, when  
>> every possible value is a viable solution? So {{}} is the returned  
>> result.
>> Generally speaking, {{}} will be returned if there is some  
>> continuum on which all values are viable results. This is because  
>> a continuum of solutions implies (e.g. by the identity theorem of  
>> complex analysis) that, after polynomialization, all values are  
>> solutions. Even worse, there can be cases where all solutions will  
>> be parasites but algebraicization caused a continuum of apparent  
>> solutions to appear, etc. etc.
>> Daniel Lichtblau
>> Wolfram Research
> Would it not be better, however, to be less ambitious here and also  
> return the usual message about the presence of "non-algebraic  
> functions"? Perhaps, this ought to be done as soon as the presence  
> of Abs in the equations is detected. At least this might avoid  
> postings like the one that started this thread.
> Andrzej Kozlowski

Now that I have looked at this a little more closely, the situation  
looks even more confusing ;-)

I guess, in the strictest sense,  the correct behaviour of Solve in  
this situation is what we get when we evaluate:

Solve[Sqrt[Im[x]^2 + Re[x]^2] == x, x]

The difference between this and what Mathematica actually does in the  
example that started this thread can be expressed in the following  
way: when Solve sees Abs[x] it replaces it by ComplexExpand[Abs 
[x],TargetFunctions->{Re,Im}] while strictly speaking it should use  

But compare the above with the following example:

Solve[Abs[x] == 1, x]

Solve::"Inverse functions are being used by Solve  so some solutions  
may not be found; use
Reduce for complete solution information.

{{x -> -1}, {x -> 1}}

Note that this time we get the "inverse functions" message, which is  
also somewhat confusing. What "inverse functions"? Presumably the  
"inverse functions" of x->Abs[x] referred to are the functions  x->x  
and x->-x. If the same method were to be used in the original problem  
the answer should be some kind of "union" of the following two.

Solve[x == x, x]
Solve[x == -x, x]
{{x -> 0}}

It is not clear to me whether that ought to be {{}} or {{x->0}} or  
what. Moreover, note that

Solve[Sqrt[x^2] == 1, x]

{{x -> -1}, {x -> 1}}

with no message, so this time Abs[x] is clearly not replaced by Sqrt 
[x]^2 (ComplexExpand[Abs[x],TargetFunctions->{Re,Im}]).

Of course Daniel has already acknowledged replacing Abs[x] by Sqrt[x] 
^2 is a "mistake of the real line". Presumably the original  
justification for this is based on Mathematica's basic principle: it  
is better to return a partially correct answer than no answer at all.  
Since considering Abs[x] in the complex plane would practically  
guarantee that no useful answer will be returned, one might as well  
make the tacit assumption that x is real and try to see if an answer  
can be given.
However, it seems to me that this approach, which was very natural in  
early versions of Mathematica, is less appropriate now, when  
computing power is much greater and Reduce can often return full and  
rigorous answers to such problems. I would argue that the right  
approach for Solve nowadays is this: when given a polynomial equation  
(or one that is equivalent to a polynomial equation) try to give a  
complete solution (with the provision of non-generic solutions and  
"equations satisifed for all values of the variables, like Solve 
[x==x,x]). When given an equation an algebraic involving radicals and  
parameters a message about possible parasite solutions should be  
issued. With any equation involving non-algebric functions including  
Abs is given a message about the presence of non-algebriac functions  
and a disclaimer concerning the possibility of additional solutions  
as well as the possibility of "parasite" solutions should be issued  
and, if possible, some kind of solution should be returned, on the  
principle "better this than nothing" (with the user having the full  
knowledge that this is what he is getting).  However, using this  
principle the solution {{x->0}} would appear to me to be better than  
the solution {{}}. Admittedly, the latter is not quite  
"nothing" ( compare it with Solve[x==x,x]) but it is certainly  
nothing in particular. And it seems to me that "something" is a  
little better than "nothing in particular".

Andrzej Kozlowski

  • Prev by Date: Re: Color names and the 10 elementary colors?
  • Next by Date: Re: Re: Re: solve and Abs
  • Previous by thread: Re: Re: Re: solve and Abs
  • Next by thread: Re: Re: Re: Re: solve and Abs