Re: Re: Re: Re: Solve Limitations

*To*: mathgroup at smc.vnet.net*Subject*: [mg63148] Re: [mg63123] Re: [mg63107] Re: [mg62980] Re: [mg62963] Solve Limitations*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 15 Dec 2005 07:14:07 -0500 (EST)*References*: <IRGQVT$2C607F9DAA7468FE284C86E7560B5F2C@bol.com.br> <A67108E9-A365-40E5-856F-610C5E0BAEF1@mimuw.edu.pl> <200512140936.EAA02453@smc.vnet.net> <200512150806.DAA19469@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 15 Dec 2005, at 17:06, Pratik Desai wrote: > Andrzej Kozlowski wrote: > >> On 14 Dec 2005, at 10:25, Andrzej Kozlowski wrote: >> >> >> >>> On 14 Dec 2005, at 10:02, Marcelo Mayall wrote: >>> >>> >>> >>>>>> Let's suppose that we are interested in the roots analytic >>>>>> expression of >>>>>> the following function: >>>>>> In[1] := f = a x + b x^(3/2) + c; >>>>>> The function Solve could be used: >>>>>> In[2] := sol = Solve[f==0, x]; >>>>>> Defining the values of the constants a, b, c would return the >>>>>> following numeric values: >>>>>> In[3] := froots = Solve[f==0, x]/. {a->1, b->1, c->1} //N >>>>>> Out[3] = {{x-> 2.1479}, {x-> -0.57395 + 0.368989 I}, {x-> >>>>>> >>>>>> >>>> -0.57395 >>>> >>>> >>>>>> - 0.368989 I}} >>>>>> However, f is not null for those values and therefore, these are >>>>>> not the roots of f: >>>>>> In[4] := f/. froots/. {a-> 1, b-> 1, c-> 1} //Chop >>>>>> Out[4] = {6.2958, 0, 0} >>>>>> At first, it seems that the function Solve doesn't take >>>>>> appropriately in >>>>>> consideration the term in square root. >>>>>> Some idea to obtain the correct analytic solution of f ??? Or, in >>>>>> fact, this a limitation of the function Solve??? >>>>>> >>>>>> Thanks, >>>>>> Marcelo Mayall >>>>>> >>>>>> >>>>>> >>>>>> >>>>> There is no way, in general, to avoid getting so called "parasite" >>>>> solutions in parametric equations with radicals. This is not a >>>>> limitation of Solve but of known mathematics. >>>>> >>>>> If your equation has numerical coefficients then the option >>>>> VerifySolutions->True will usually (but not always) insure that >>>>> the >>>>> parasite solutions are eliminated. >>>>> >>>>> Andrzej Kozlowski >>>>> >>>>> >>>>> >>>>> >>>> Another simple case that could, a priori, exemplify the limitation >>>> of the Solve function: >>>> >>>> In[1] := Solve[x^0.5 + a x == 0, x] >>>> >>>> Out[1] {{x -> 0}, {x -> 1 / a^2}} >>>> >>>> However, the correct answer should have the following form: >>>> If a >= 0, {x -> 0} >>>> If a < 0 , {{x -> 0}, {x -> 1 / a^2}} >>>> It seems to me that, in this case, this is not a limitation of the >>>> known mathematics but a limitation of the algorithm of the Solve >>>> function. >>>> >>>> Thanks, >>>> Marcelo Mayall >>>> >>>> >>> First of all, your answer assumes that a is a real number, but this >>> is of course an assumption that Mathematica never makes >>> >>> >>> Solve[x^(1/2) + I*x == 0, x] >>> >>> >>> {{x -> -1}, {x -> 0}} >>> >>> Mathematica has to give an answer that is valid for complex a. The >>> answer it has given will therefore be valid in far more cases than >>> your answer. However, if you want to assume that a is real you >>> should use Reduce that allows such assumptions: >>> >>> In[38]:= >>> Reduce[x^(1/2) + a*x == 0, x, Reals] >>> >>> Out[38]= >>> (a < 0 && (x == 0 || x == 1/a^2)) || (a >= 0 && x == 0) >>> >>> Now you have got exactly he answer you wanted. >>> >>> Andrzej Kozlowski >>> >>> >>> >>> >>> >> >> In fact, it may be worth adding that in this case again (as in most >> such chases) no general answer valid for all complex numbers can be >> given. You can see this when you try to get Reduce to do it: >> >> In[1]:= >> Reduce[x^(1/2) + a*x == 0, x] >> >> The answer found by >> Reduce contains unsolved equation. A likely reason for this is >> that \ >> the solution set depends on branch cuts of Mathematica functions. >> >> Out[1]= >> (a == 0 && x == 0) || (a != 0 && x == 0) || >> (a != 0 && 0 == ((-Sqrt[1/a^2])*a - 1)/a && x == 1/a^2) >> >> This also explains why "Solve" has the "limitation" that you are >> complaining about. Actually, the only limitation Solve has is that it >> is not Reduce: that is, it does not attempt to return complete >> answers and it does not return conditional answers. The advantage of >> this approach is that there is only a relatively small number of >> problems that can be solved by Reduce in an acceptable time (Reduce >> uses some functions of very high complexity) while Solve will return >> answers generally much quicker and in a lot more cases. Of course in >> some situations solutions returned by Solve will be incomplete and in >> other situations there will be solutions not valid for certain values >> of parameters and sometimes even solutions not valid for any values >> of the parameters. However, in most such cases the alternative would >> be either not returning a solution at all or to keep the user waiting >> possibly for the rest of his life. >> >> As it is, there are two functions, Solve and Reduce, which are >> optimised for different purposes and which use different (though >> intersecting) sets of algorithms. It is up to the user to judiciously >> choose the function that is the best suited to the problem at hand. >> >> Andrzej Kozlowski >> >> >> >> > To state the obvious, in general roots of analytic functions are > hard to > find. I had the misfoutune to come across a nasty complex > trancendental > equation. I found this Fortran Code ZEAL (Zeros of Analytic Functions) > quite invaluable. Needless to say, Solve, Reduce did not help much. > http://cpc.cs.qub.ac.uk/summaries/ADKW_v1_0.html > > A Mathematica implimentation of this software would come a long way in > helping us poor engineers deal with such trancendental equations. The > system that I was dealing with has obvious practical significance, the > only hinderance being the lack of tools such as root solvers such as > ZEAL. Any takers?? > > Pratik > > > PS: Zeal not only can find the zeros of f(z) but also gives one the > values for f(z) with high degre of precision > > -- > Pratik Desai > > ...Moderation, as well as Regularity of Thinking, so much to be > wished for in the Heads of those who imagine they come into the > World only to watch and govern it?s Motion > Gulliver's Travels > by Jonathan Swift > > > It looks lie Zeal is a numerical solver, which means that it is quite wrong to compare it with Solve or Reduce, which work symbolically and therefore are by nature much more limited in what they can do. The proper proper tools for this sort of thing are FindRoot and NMinimize. Have you really tried them? Andrzej Kozlowski

**References**:**Re: Re: Solve Limitations***From:*Andrzej Kozlowski <akoz@mimuw.edu.pl>

**Re: Re: Re: Solve Limitations***From:*Pratik Desai <pdesai1@umbc.edu>

**Re: Re: Mathematica Programmer vs. Programming in Mathematica**

**Re: Re: Re: Re: Solve Limitations**

**Re: Re: Re: Solve Limitations**

**Re: Re: Re: Re: Solve Limitations**