Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Sqrt of complex number

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126686] Re: Sqrt of complex number
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Thu, 31 May 2012 02:47:13 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jpspgr$hdj$1@smc.vnet.net> <201205290948.FAA06757@smc.vnet.net> <jq4kvh$g0e$1@smc.vnet.net>

On 5/30/2012 1:15 AM, Murray Eisenberg wrote:
> "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!

I assume you agree that Mathematica gives the answer because it was 
programmed that way;  you may even agree that it lacks generality.

Let's look at the incomplete and incorrect, and see where we (dis)agree.
>
> There is nothing incomplete or incorrect (arguably or otherwise) about
> Mathematica's behavior with Sqrt.

As long as you are talking about Sqrt[]  and not "square root", you (or
Wolfram) is arguably entitled to associate nearly any behavior at all.  E.g.
Sqrt[-2]  could return 0 or an error.   I believe some version of the
UNIX library square-root program did this, to avoid complex numbers.

If you look up "square root"  in wikipedia  you get an extensive
discussion of square roots of numbers, and their principal values.

Unfortunately, the discussion there does not generalize to square roots of
symbolic items  like sqrt(a*x+b)  or sqrt(x^2).

There is a way of thinking about these, and computing with them, for example
using Root[]  expressions.



  A design decision was made that
> mathematically multi-valued numerical functions should return single
> values;
true.

  the documentation states that the principal root is returned;
> and that's what happens.
What is the definition of the principal root of sqrt((x-y)^2)?  how does
it differ from the principal root of sqrt((y-x)^2)?
>
> You might _prefer_ that Mathematica return all possible values of a
> multi-valued function,

maybe, but maybe not.  Maybe there should be another system that does 
multi-valued functions correctly.

  but that would raise a host of difficulties --
sure, it is part of the design. That's why certain integrals come out 
wrong because the chosen "principal value" happens to be the wrong value.
Fixing these errors without doing the mathematics correctly is perhaps
far more difficult than doing the mathematics right and avoiding the
errors entirely.  This was understood by some of the builders of the
earlier systems, but Wolfram based his design on the old systems -- with
their problems -- rather than coming up with a solution.


> e.g., what if there are infinitely many values -- that would ripple
> through the system and cause difficulties for most computations by most
> users.

Mathematicians have many ways of representing and computing with 
infinite sets.

>
> 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
>>
>>
>>
>>
>>
>>
>




  • Prev by Date: Re: Simplify and then discretize a set of equations with derivatives and integrals
  • Next by Date: Re: Stop on message?
  • Previous by thread: Re: Sqrt of complex number
  • Next by thread: Creating custom VertexLabels