Re: Re: Re: solve and Abs
- To: mathgroup at smc.vnet.net
- Subject: [mg69565] Re: [mg69456] Re: [mg69398] Re: solve and Abs
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 15 Sep 2006 06:46:44 -0400 (EDT)
Andrzej Kozlowski wrote: > > 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: >>>>> >>>>>> (tm) Pro* >>>>>> >>>>>> 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. >>>>>>>> [...] >>> 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 Might be reasonable. But see below. > 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 > ComplexExpand[Abs[x],{x},TargetFunctions->{Re,Im}]. > > 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. Hard to say. The message does not arise in the development kernel. Offhand I'm not sure what caused this change and don't want to take the time to find out. > 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. No argument from me. But given that Solve has behaved more or less in this way for 10 or so years, I am not convinced of the wisdom of changing it. > 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 > Solve won't know when {{}} is actually the correct thing and when not. The policy has always been, when confronted with a disjunction, to take the union of the solutions from each branch. Departing from this only when some branches contain {{}} would seem to be a special case treatment not easily defended. As for a warning message, yes, we've considered at times the possibility of something to the effect: "Solve has encountered a many-to-one inverse function in the equations or intermediate transformations thereof. This may result in parasite solutions, scrambling of your television stations, and/or decalcification of bones in the elderly." But Mathematica has lived without this message since it was introduced. I'm not so sure it would be a good thing to have it now appear every time an ArcTrig, say, is present. Especially given the documented behavior that it is intended primarily for polynomials. Daniel Lichtblau Wolfram Research