Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10227 > unrolled thread

Sqrt of complex number

Started byJacare Omoplata <walkeystalkey@gmail.com>
First post2012-05-27 08:44 +0000
Last post2012-06-02 09:43 +0000
Articles 11 — 7 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Sqrt of complex number Jacare Omoplata <walkeystalkey@gmail.com> - 2012-05-27 08:44 +0000
    Re: Sqrt of complex number Helen Read <readhpr@gmail.com> - 2012-05-28 09:12 +0000
    Re: Sqrt of complex number Erik Max Francis <max@alcyone.com> - 2012-05-28 09:13 +0000
    Re: Sqrt of complex number Richard Fateman <fateman@cs.berkeley.edu> - 2012-05-29 09:51 +0000
    Re: Sqrt of complex number Andrzej Kozlowski <akozlowski@gmail.com> - 2012-05-30 08:10 +0000
      Re: Sqrt of complex number Richard Fateman <fateman@cs.berkeley.edu> - 2012-05-31 06:50 +0000
      Re: Sqrt of complex number Andrzej Kozlowski <akozlowski@gmail.com> - 2012-05-31 06:51 +0000
    Re: Sqrt of complex number Murray Eisenberg <murray@math.umass.edu> - 2012-05-30 08:15 +0000
      Re: Sqrt of complex number Richard Fateman <fateman@cs.berkeley.edu> - 2012-05-31 06:49 +0000
    Re: Sqrt of complex number danl@wolfram.com - 2012-06-01 09:22 +0000
      Re: Sqrt of complex number Richard Fateman <fateman@cs.berkeley.edu> - 2012-06-02 09:43 +0000

#10227 — Sqrt of complex number

FromJacare Omoplata <walkeystalkey@gmail.com>
Date2012-05-27 08:44 +0000
SubjectSqrt of complex number
Message-ID<jpspgr$hdj$1@smc.vnet.net>
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.

[toc] | [next] | [standalone]


#10236

FromHelen Read <readhpr@gmail.com>
Date2012-05-28 09:12 +0000
Message-ID<jpvfi2$q6q$1@smc.vnet.net>
In reply to#10227
If you ask for the square root, cube root, or 4th root etc., Mathematica 
will return the principal root. To get them all, use Solve.

Solve[z^2 == 3 - 4 I, z]


Solve[z^3 == -8, z]

Solve[z^3 == -8, z] // ComplexExpand

Helen Read
University of Vermont


On 5/27/2012 4: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.
>



[toc] | [prev] | [next] | [standalone]


#10238

FromErik Max Francis <max@alcyone.com>
Date2012-05-28 09:13 +0000
Message-ID<jpvfjv$q72$1@smc.vnet.net>
In reply to#10227
On 05/27/2012 01:44 AM, Jacare Omoplata wrote:
> 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?

It's the principal square root.  Does this result surprise you, after 
all, even though -2 squared is also 4?

In[3]:= Sqrt[4]

Out[3]= 2

If you want to actually ask for _all_ the possible answers, use Solve:

In[1]:= Solve[x^2 == 3 - 4 I, x]

Out[1]= {{x -> -2 + I}, {x -> 2 - I}}

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Jabber erikmaxfrancis
   The side that stays within its fortifications is beaten.
    -- Napoleon Bonaparte

[toc] | [prev] | [next] | [standalone]


#10257

FromRichard Fateman <fateman@cs.berkeley.edu>
Date2012-05-29 09:51 +0000
Message-ID<jq267j$6k3$1@smc.vnet.net>
In reply to#10227
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





[toc] | [prev] | [next] | [standalone]


#10259

FromAndrzej Kozlowski <akozlowski@gmail.com>
Date2012-05-30 08:10 +0000
Message-ID<jq4klv$fsf$1@smc.vnet.net>
In reply to#10227
On 29 May 2012, at 11:48, Richard Fateman wrote:

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

Objects of the kind  Root[#^2-3+4I&,n], where n is a symbol would be mathematically meaningless and very unlikely to be of any serious use. The reason is that there is no canonical ordering of the complex roots of a polynomial and thus there is nothing "mathematical" that can be said about the "n-th root of a polynomial".

The only orderings that exist are specific to programs like Mathematica (and even Mathematica uses two different methods of root isolation with different resulting orderings so Root[f,n] has a different in general  a different meaning for each ordering). So any statement about Root[f,n] is a statement about a particular ordering using by Mathematica, and not,in general, a universal mathematical statement. For example, the statement that Root[f,1] is always real if f is a polynomial of odd degree is a statement about Mathematica (although it does imply the mathematical statement that every polynomial of odd degree has a real root).

It would be at best very clumsy to have to use an artificial ordering of roots to make general statements that have nothing to do with any orderings. The entire sense of these orderings is that you first perform "root isolation" before you order them. Isolating roots when you do not need to isolate them (in order to make a statement about all roots) would be wasteful and pointless. If you want to make a general statement about all roots of a polynomial there are at least two ways of doing it, both better than using artificial orderings. One way is to compute all the roots using Solve (better than using Table and Root). The other method is to use Reduce and quantifiers.


>
> For example,  we would know the unambiguous single value for y^2, and
> we could perhaps compute  y*Conjugate[y].

For example:

Reduce[
 ForAll[y, y^2 - (3 - 4 I) == 0,
  Element[a, Reals] && a == y*Conjugate[y]]]

a == 5

Reduce[ForAll[y, y^2 - (3 - 4 I) == 0, a == y^2]]

a == 3 - 4 I



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

Because when you evaluate Root[#^2-3+4I&,1]  or Root[#^2-3+4I&,2] Mathematica isolates the roots of the equation x^2-3+4I==0. When you write Root[#^2-3+4I&,n] there is nothing for Mathematica to do. You are thinking of using root ordering as a just a dumb notation, which it is not. If it were meant to me just notation it would be a very clumsy one.

Andrzej Kozlowski


[toc] | [prev] | [next] | [standalone]


#10281

FromRichard Fateman <fateman@cs.berkeley.edu>
Date2012-05-31 06:50 +0000
Message-ID<jq74ce$qie$1@smc.vnet.net>
In reply to#10259
On 5/30/2012 1:10 AM, Andrzej Kozlowski wrote:
> On 29 May 2012, at 11:48, Richard Fateman wrote:
>
>>
>> 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).
>
> Objects of the kind  Root[#^2-3+4I&,n], where n is a symbol would be mathematically meaningless

certainly not meaningless.  y^2 would be -3+4I.
  and very unlikely to be of any serious use.

How can you predict what serious use can be made of this?

> The reason is that there is no canonical ordering of the complex roots of a polynomial and thus

> there is nothing "mathematical" that can be said about the "n-th root of a polynomial".

Clearly false; I just said something mathematical.  I can say more, like 
the sum of n different roots is defined, assuming you can pick
roots n, n+1, ... n+k of a degree k polynomial.



>
>>
>> For example,  we would know the unambiguous single value for y^2, and
>> we could perhaps compute  y*Conjugate[y].
>
> For example:
>
> Reduce[
>   ForAll[y, y^2 - (3 - 4 I) == 0,
>    Element[a, Reals]&&  a == y*Conjugate[y]]]
>
> a == 5

<sarcasm> thats clear </sarcasm>
>
> Reduce[ForAll[y, y^2 - (3 - 4 I) == 0, a == y^2]]
>
> a == 3 - 4 I
>
>
>
>>
>> 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.
>>
>
> Because when you evaluate Root[#^2-3+4I&,1]  or Root[#^2-3+4I&,2]
> Mathematica isolates the roots of the equation x^2-3+4I==0.

>When you write Root[#^2-3+4I&,n] there is nothing for Mathematica to do.

Right.  It should leave it alone, until you do something with it.
Like there is nothing for Mathematica to do with Sin[n].

> You are thinking of using root ordering as a just a dumb notation,
No, you are insisting that you can do something useful
only by using root ordering.

> which it is not. If it were meant to me just notation it would be a very clumsy one.

Not as clumsy as your Reduce [...].
RJF

[toc] | [prev] | [next] | [standalone]


#10293

FromAndrzej Kozlowski <akozlowski@gmail.com>
Date2012-05-31 06:51 +0000
Message-ID<jq74eb$qjb$1@smc.vnet.net>
In reply to#10259
On 31 May 2012, at 05:52, Richard Fateman wrote:

> On 5/30/2012 1:10 AM, Andrzej Kozlowski wrote:
>> On 29 May 2012, at 11:48, Richard Fateman wrote:
>>
>>>
>>> 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).
>>
>> Objects of the kind  Root[#^2-3+4I&,n], where n is a symbol would be mathematically meaningless
>
> certainly not meaningless.  y^2 would be -3+4I.
> and very unlikely to be of any serious use.
>
> How can you predict what serious use can be made of this?
>
>> The reason is that there is no canonical ordering of the complex roots of a polynomial and thus
>
>> there is nothing "mathematical" that can be said about the "n-th root of a polynomial".
>
> Clearly false; I just said something mathematical.  I can say more, like the sum of n different roots is defined, assuming you can pick
> roots n, n+1, ... n+k of a degree k polynomial.
>
>
>
>>
>>>
>>> For example,  we would know the unambiguous single value for y^2, and
>>> we could perhaps compute  y*Conjugate[y].
>>
>> For example:
>>
>> Reduce[
>>  ForAll[y, y^2 - (3 - 4 I) == 0,
>>   Element[a, Reals]&&  a == y*Conjugate[y]]]
>>
>> a == 5
>
> <sarcasm> thats clear </sarcasm>
>>
>> Reduce[ForAll[y, y^2 - (3 - 4 I) == 0, a == y^2]]
>>
>> a == 3 - 4 I
>>
>>
>>
>>>
>>> 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.
>>>
>>
>> Because when you evaluate Root[#^2-3+4I&,1]  or Root[#^2-3+4I&,2]
>> Mathematica isolates the roots of the equation x^2-3+4I==0.
>
>> When you write Root[#^2-3+4I&,n] there is nothing for Mathematica to do.
>
> Right.  It should leave it alone, until you do something with it.
> Like there is nothing for Mathematica to do with Sin[n].
>
>> You are thinking of using root ordering as a just a dumb notation,
> No, you are insisting that you can do something useful
> only by using root ordering.
>
>> which it is not. If it were meant to me just notation it would be a very clumsy one.
>
> Not as clumsy as your Reduce [...].
> RJF

Bravo. A very impressive and intellectual argument.

[toc] | [prev] | [next] | [standalone]


#10273

FromMurray Eisenberg <murray@math.umass.edu>
Date2012-05-30 08:15 +0000
Message-ID<jq4kvh$g0e$1@smc.vnet.net>
In reply to#10227
"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@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

[toc] | [prev] | [next] | [standalone]


#10294

FromRichard Fateman <fateman@cs.berkeley.edu>
Date2012-05-31 06:49 +0000
Message-ID<jq749j$qgq$1@smc.vnet.net>
In reply to#10273
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
>>
>>
>>
>>
>>
>>
>

[toc] | [prev] | [next] | [standalone]


#10304

Fromdanl@wolfram.com
Date2012-06-01 09:22 +0000
Message-ID<jqa1l1$bjp$1@smc.vnet.net>
In reply to#10227
On Thursday, May 31, 2012 1:49:23 AM UTC-5, Richard Fateman wrote:
> On 5/30/2012 1:15 AM, Murray Eisenberg wrote:
[...]
> 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.

It is not incorrect, as you yourself observe, that Sqrt[] return a single entity rather than a list. Incomplete is a separate issue. I defer to others for the discussion of how various algebraic functions in Mathematica might be applicable to uncovering multivalued "functions" as sets of results.


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

I think it does, actually. One simply leaves them alone, as symbolic objects. They can be instantiated by plugging in specific values for the paramete
rs.

This is similar to what you advocate, I believe, for multivalued sets.


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

Mathematica also uses such expressions for roots of transcendental functions. That said, some of the things you might do with, say, quadratic roots, may not generalize so nicely to (infinite sets of) transcendental roots.


> [...]
> 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)?

One waits until x and y have been supplied with actual values...


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

Who would build it? Who would use it? What features would it have that existing systems do not? That is to say, what would be the structure and semantics of "multi-valued function objects"? And is this a problem of sufficient merit to warrant the R&D resources needed to address it?


>   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.
> [...]

Okay, it was really this that I wanted to comment upon. It is relatively uncommon for an integral to "come out wrong" due to use of principal values. It happens, yes. In some fairly dark corners of indefinite integration. In definite integrals, in cases where path singularities go undetected, or limits at the singularities are not correctly found.

As you surely know, there are indeed researchers who work on ways to avoid principal value issues arising from following paths, e.g. by "unwinding number". If you discuss this with them (as I have), you will learn that they are not particularly closer than the rest of us to addressing these vexing issues of definite integration. I would venture to say that they are, like the rest of us, much closer to retirement than to sorting out such problems.

Daniel Lichtblau
Wolfram Research

[toc] | [prev] | [next] | [standalone]


#10311

FromRichard Fateman <fateman@cs.berkeley.edu>
Date2012-06-02 09:43 +0000
Message-ID<jqcn8d$133$1@smc.vnet.net>
In reply to#10304
On 6/1/2012 2:22 AM, danl@wolfram.com wrote:

>
>> [...]
>> 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)?
>
> One waits until x and y have been supplied with actual values...

If you give numerical values to x and y,  there is no
difference between  (x-y)^2  and (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.
>
> Who would build it?
Oh, I was thinking of some PhD student.

Who would use it? What features would it have that existing systems do not?
I would hope it would have fewer "features" meaning that it would work
mathematically correctly as opposed to having
ideas/features/excuses/ bugs  injected by program designers
That is to say, what would be the structure and semantics of 
"multi-valued function objects"?

If an ordinary structure looks like  Plus[x,y] then the multivalued 
object could be something like
OneOf[x,y]
or
OneOf[Hold[Table[n*Pi,{n,0, Inf}]
or
Root[ ...,n].

Note that there is already a multivalued object in Mathematica,
namely
Interval[{a,b}]  which should mean One (unspecified) number between
a and b.
   (Mathematica sometimes conflates this with the notion of the
continuous range of numbers between a and b.  This is probably a
mistake in some circumstances, but it often doesn't seem to matter.)

The semantics would be essentially:  A op OneOf[B]  ->   OneOf[A op B]

e.g.

A+ OneOf[Hold[Table[n*Pi,{n,0, Inf}]
OneOf[Hold[Table[A+ n*Pi,{n,0, Inf}]

(If I am misusing "Hold" I apologize.  I think you get the idea.)

see also
http://www.cs.berkeley.edu/~fateman/papers/sets.pdf


> And is this a problem of sufficient merit to warrant the R&D resources needed to address it?

PhD students working under an NSF grant are low cost, if not free.
I suppose that the "merit" may be a business decision.  In that case
the question is
"Can one can make just as much money delivering the wrong answer as
the right one?"


>
>
>>    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.
>> [...]
>
> Okay, it was really this that I wanted to comment upon.
> It is relatively uncommon for an integral to "come out wrong" due to use of principal values.
> It happens, yes. In some fairly dark corners of indefinite integration.
 >In definite integrals, in cases where path singularities go undetected,
 >or limits at the singularities are not correctly found.

If one's goal is to encode all of mathematics into a computer system,
then one must deal with even the "relatively uncommon cases".

If one's goal is to encode a subset of mathematics (dependably,
reliably, robustly, correctly) into a computer system, then one
must deal with even the "relatively uncommon cases" that occur
in that subset of mathematics.

Here it appears that we have a system that will solve
relatively common problems correctly but sometimes
without warning gives incorrect answers to well-formed questions.


>
> As you surely know, there are indeed researchers who work on ways to
 >avoid principal value issues arising from following paths, e.g.
 > by "unwinding number".
Yes
  If you discuss this with them (as I have),
 >you will learn that they are not particularly closer than the rest
 >of us to addressing these vexing issues of definite integration.

Maybe they need better tools,  say representation of multivalued 
functions.  There were at Berkeley at least 2 MS projects under
my supervision that went off in this direction -- conformal mapping,
(Adam Dingle), and another that tried not very successfully to
write a simplifier for multivalued expressions.

I think the MKM people  (who intend to study mathematical "knowledge")
worry about this more than "practical" system builders.  Certainly
someone intending to use a computer to prove mathematical theorems
cannot just ignore the occasional contradiction.

 > I would venture to say that they are, like the rest of us, much
 >closer to retirement than to sorting out such problems.

In the current movie "Best Exotic Marigold Hotel" there is the line..
“Everything will turn out alright in the end, and if it’s not alright 
(at present), then it’s not the end!’

RJF

>
> Daniel Lichtblau
> Wolfram Research
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web