Re: Sqrt of complex number
- To: mathgroup at smc.vnet.net
- Subject: [mg126677] Re: Sqrt of complex number
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Wed, 30 May 2012 04:12:28 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jpspgr$hdj$1@smc.vnet.net> <201205290948.FAA06757@smc.vnet.net>
- Reply-to: murray at math.umass.edu
"You have been given a bunch of answers, each of which is correct but unresponsive to your concern. "Mathematica gives the answer it gives because it was programmed that way, a way that lacks generality, is incomplete and arguably incorrect." Nonsense! There is nothing incomplete or incorrect (arguably or otherwise) about Mathematica's behavior with Sqrt. A design decision was made that mathematically multi-valued numerical functions should return single values; the documentation states that the principal root is returned; and that's what happens. You might _prefer_ that Mathematica return all possible values of a multi-valued function, but that would raise a host of difficulties -- e.g., what if there are infinitely many values -- that would ripple through the system and cause difficulties for most computations by most users. On 5/29/12 5:48 AM, Richard Fateman wrote: > On 5/27/2012 1:44 AM, Jacare Omoplata wrote: >> Hi, >> >> When I try to find the square root of of a complex number, I get only one answer. >> >> In[1]:= Sqrt[3-4 I] >> Out[1]= 2-I >> >> But -2+I is an answer as well. >> >> In[2]:= (-2+I)^2 >> Out[2]= 3-4 I >> >> Why does Mathematica give the first answer and not the second? > > Does it choose the answer with the positive real number? > > Is there any way I can get both answers? > > Or do I just have to remember that the negative of the given answer is > also an answer? >> >> Thanks. >> > > ................ > > You have been given a bunch of answers, each of which is correct but > unresponsive to your concern. > > Mathematica gives the answer it gives because it was programmed that > way, a way that lacks generality, is incomplete and arguably incorrect. > I think it does this probably because it copied earlier systems that > had similar errors. If it was addressed specifically in the design, > then the decision was made to provide a mathematically incomplete > solution, in the hope that nobody would either not notice or not care. > > However, you noticed and appear to care. > > What you ask for is an expression that includes all answers: the > algebraic solution to the equation x^2-(3-4 I)=0. > > Notice that you can create the set of the 2 roots of a quadratic, that > is, both square roots, by typing this. > > > Table[Root[#^2 - (3 - 4 I)&, n], {n, 1, 2}] > > but this is a list, not "an algebraic number". > > If you want to manipulate "an arbitrary root", that is -2+I OR 2-I > without specifying which one, it seems that Mathematica could provide > this facility by allowing you to type, for a symbol n, > > y = Root[#^2- (3-4I)&,n] > > (actually, Root[x^2-3+4I,n] might do just a well and be less obscure). > > For example, we would know the unambiguous single value for y^2, and > we could perhaps compute y*Conjugate[y]. > > Unfortunately, Mathematica's designers/programmers do not allow you to > write Root[x^2-3+4I,n] unless n is a specific integer, namely 1 or 2. > > Conclusion: Mathematica has a notation for what you want, and it can in > fact do a few things with Root[], but it is defective in handling > Root[polynomial,n] for symbolic n. I would call it a mis-feature. Maybe > it will be fixed, which would not be easy. (while you are at it, > consider Root[Exp[I x]-1,n] ) > > Doing it right would require considerable effort, both to figure out > what the right features should be, and to implement them. > > RJF > > > > > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Re: Sqrt of complex number
- From: Richard Fateman <fateman@cs.berkeley.edu>
- Re: Sqrt of complex number