COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Sqrt of complex number

• Email
• Follow

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

```
 0
Reply walkeystalkey (16) 5/27/2012 8:44:11 AM

See related articles to this posting

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

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

```
 0

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

```
 0
Reply max78 (1220) 5/28/2012 9:13:35 AM

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

.................

You have been given a bunch of answers, each of which is correct but

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

```
 0
Reply fateman2 (359) 5/29/2012 9:51:47 AM

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

```
 0
Reply akozlowski (200) 5/30/2012 8:10:39 AM

```"You have been given a bunch of answers, each of which is correct but

"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
>>
>> Thanks.
>>
>
> ................
>
> You have been given a bunch of answers, each of which is correct but
>
> 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

```
 0
Reply murray (1910) 5/30/2012 8:15:45 AM

```On 5/30/2012 1:15 AM, Murray Eisenberg wrote:
> "You have been given a bunch of answers, each of which is correct but
>
> "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
>>>
>>> Thanks.
>>>
>>
>> ................
>>
>> You have been given a bunch of answers, each of which is correct but
>>
>> 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
>>
>>
>>
>>
>>
>>
>

```
 0
Reply fateman2 (359) 5/31/2012 6:49:23 AM

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

```
 0
Reply fateman2 (359) 5/31/2012 6:50:54 AM

```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.
```
 0
Reply akozlowski (200) 5/31/2012 6:51:55 AM

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

```
 0
Reply danl1 (936) 6/1/2012 9:22:41 AM

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

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

```
 0
Reply fateman2 (359) 6/2/2012 9:43:41 AM

10 Replies
37 Views

Similar Articles

12/12/2013 6:21:16 AM
page loaded in 190151 ms. (0)

Similar Artilces:

complex numbers
#python supports complex numbers. # append a "j" to a number and it represents the imaginary number. e.g. # 3j means 3*i. #(3,4) can be written as 3+4j #another way to write is is #complex(3,4) #arithmetic operations can be applied normally. # to get the real part, imaginary part, or length, one can do a=complex(3,4) print a.real print a.imag print abs(a) print complex(3,4)+5+6j ---------------- # Perl doesn't support complex numbers. But there are packages that supports it. Xah xah@xahlee.org http://xahlee.org/PageTwo_dir/more.html xah@xahlee.org wrote: > #python suppor...

complex numbers #7
hello everyone i would like to know how to implement complex numbers using matlab and also how to get their fourier, wavelet, z, laplace transforms etc... pls help me out this is urgent Mohamed wrote: > i would like to know how to implement complex numbers using matlab > and also how to get their fourier, wavelet, z, laplace transforms etc... > pls help me out this is urgent You would have to write a new object class and write new versions of fft and so on. Which seems to me rather a waste of time when you could instead use the complex numbers already built in to matlab. >> ...

Roots of complex numbers
On my HP 49g+ I've written a program where I input the coefficients of a cubic polynomial, and it gives me the roots of the poly. (I've actually had to write three programs--one for each of the roots). The problem is that for some reason the calculator changes my "raised to the 1/3 power" to a "cube root". If I then try to use ->NUM to give a numerical approximation, it says "->NUM Error: Bad Argument Type". I think the problem has to do with complex numbers raised to exponents. For example, in equation writer, if I type in ((2+5i)^(1/3)), highl...

Hi everybody! &nbsp; Does anyone know if it is possible to create a Channel in Diadem 10 whose values are complex numbers? In my application I have&nbsp; channels with the real parts of the complex and other channels wih the imaginary parts. I need to create the complex number and divide it by another. &nbsp; Any help with this is very welcome. &nbsp; Best regards, S�rgio Cruz Smacruz, Post this in the <a href="http://forums.ni.com/ni/board?board.id=60" target="_blank">DIAdem forum</a> where ther is a higher probability of your question getting ...

Complex number after NIntegrate
Hi all! I need to do the following. I am using mathematica to take a multi-dimensional(8-mentional) integral with NIntegrate and MonteCarlo method. But there is one problem I couldn't solve. Mathematica gives complex number after NIntegrate. Integrand is a some kind of exponential function with sums of logarithms in exponent. So, what i do wrong and may be i have to change some options of NIntegrate? thanx ...

complex numbers #3
hi i have a problem comparing complex numers using matlab the code i am using is M=complex(1,1); M=0+0i; for n=1:nbus if(Y(n) > M ) M=Y(n) end end %y is a complex number matrix the problem is matlab is using mangitude on comple numbers to find the maximum complex number is there a mistake in the code and advice is needed on how to tackle this problem ...

Complex number results
When working with complex numbers I get the result as an ordered pair. For example (1+2i)+(3+4i) returns (4.,6.). What setting is used to return the a+bi form, so that I will get the answer in the form (4+6i). On page 7-4 of the 50g users manual this form is used for an answer, but no explanation for doing that is presented and I havn't been able to figure how that is done. Thanks. "JB" <wjbudd@yahoo.com> wrote in message news:1167680392.845909.324260@i12g2000cwa.googlegroups.com... > When working with complex numbers I get the result as an ordered pair. > For ...

Complex Numbers HP 49G+
Hello, How would I decompose a complex number containing a distance and polar angle? Regards, Mark In article <04618611-9f6c-4d28-8c0f-29bd43a53a51@x5g2000yqk.googlegroups.com>, PremiumBlend <mnhollinger@yahoo.com> wrote: > Hello, > > How would I decompose a complex number containing a distance > and polar angle? > > Regards, > > Mark One way: With the complex number on the stack execute DUP RE SWAP IM. IIRC this works correctly on all 48/49/50 models. Note that the angle will be in the currently set angular units, radians degrees or grads, wh...

Solving Equations for Complex Numbers
I've set the CAS to complex mode, but the symbolic commands don't produce complex solutions, e.g. '4*x^3+8*x-4' SOLVEVX gives an empty list. Am I doing something wrong? Does the CAS understand complex numbers? In article <1134924023.58fec87c58f249b740f40b921c33786d@roc.usenetexchange.com>, Borris <none@none.com> wrote: > I've set the CAS to complex mode, but the symbolic commands don't produce > complex solutions, e.g. > '4*x^3+8*x-4' SOLVEVX > gives an empty list. > > Am I doing something wrong? Does the CAS understand comp...

HP35s Complex Number Handling
Just a note on the HP35s' handling of complex numbers. When attempting sqrt(-1) - it responds with an error message: SQRT(NEG). Further, sqrt(-1+i0) also responds with an error message: INVALID DATA. I'm surprised; perhaps I've been spoiled by how smoothly the HP42s and HP48 series have handled complex data! TomCee ps: I'm overlooking the unusual design choice in that in RPN mode, x +iy is displayed as xiy. On Jul 23, 9:03 pm, tomcee <tomcees_calcula...@yahoo.com> wrote: > Just a note on the HP35s' handling of complex numbers. > > When attempting sqrt...

Complex numbers with symbolic variables
Hi, Matlab seems to convert my float numbers into quotient of integers (only when dealing with complex numbers). My expression is something like: syms t (3.7892+8.92109*i)*t and matlab converts it into: (9473/2500+1255531799991833/140737488355328*i)*t Is someone aware of those weird conversions and how to avoid them? Thanks, "maud comboul" <maud.comboul@laposte.net> wrote in message news:ef03d83.-1@webx.raydaftYaTP... > Hi, > Matlab seems to convert my float numbers into quotient of integers > (only when dealing with complex numbers). My expression is something &g...

polyfit (coefficients are complex numbers)
I am writing a program that will use polyfit to make a polynomial fit curve to some imported data. The problem I am having is that, when the data is noisy, frequently the returned coefficients for the polynomial generated by polyfit are complex numbers, which I don't want. How can I change it so that it will only use real numbers? In article <ef0fc17.-1@webx.raydaftYaTP>, JM <phyzix_chica@yahoo.com> wrote: > I am writing a program that will use polyfit to make a polynomial fit > curve to some imported data. The problem I am having is that, when > the data is noisy, ...

System of equations with complex numbers
How can i resolve a equation system with complex numbers? i try with num. solv. -> solve lin sys but this not accept comlex Thanks "Chapter" <davidsuarez82@gmail.com> wrote in message news:1146047372.566922.37050@e56g2000cwe.googlegroups.com... > How can i resolve a equation system with complex numbers? i try with > num. solv. -> solve lin sys but this not accept comlex You can break the system up into real and complex parts and "stack" those two parts on top of each other: [Re(A) ] [Re(x)] = [Re(b)] [Im(A) ] [Im(x)] = [Im(b)] ....then use "so...

nn using complex number
Hi all subscribers, I read in complex neural network and its uses in multivalued application . does any one know anything about the learning algorithm?? best wishes, blue On Jan 7, 12:37=A0am, blue <sra7...@gmail.com> wrote: > Hi all subscribers, > I read in complex neural network and its uses in multivalued > application . > does any one know anything about the learning algorithm?? > best wishes, > blue It depends, which application you are looking for. If it is multiple-class classification on continuous-valued appriximation or a hybrid problem, I beleive that a com...

missing arg for complex number
Hi. As I can see, the arg function for complex numbers -- for polar representation: z = abs(x) exp(arg(z)) -- is missing! Why? Thanks and regards Manlio Perillo Manlio Perillo <NOmanlio_perilloSPAM@libero.it> wrote in message news:<he01d0h4je91d0g37d6do6vrmvmn2a914o@4ax.com>... > Hi. > As I can see, the arg function for complex numbers > -- for polar representation: z = abs(x) exp(arg(z)) -- > is missing! > Why? Probably just an oversight. But it's easy to implement. def phase(z): return math.atan2(z.imag, z.real) ...

Complex Numbers #2 900620
Hi,: I always have problems when dealing with complex numbers. How can i work with Mathematica in such a way that every expression will be considered real unless it is declared explicitly complex (like a = 3 + 4 I ) ? For example if I type Re[ComplexExpand[ Exp[a I] Exp[b I]]] I get the answer -Im[Sin[ a+b]]+Re[Cos[a+b]] Instead of simply Cos[a+ b] Thnx! Alejandro Vizcarra Simplify[Re[Exp[a I] Exp[b I]], Im[a]==0 && Im[b]==0] Cos[a + b] Also look at the standard add-on package Algebra`ReIm` Bob Hanlon In article <c5b0tc\$7lc...

minimizing the absolute value of a complex number
hi can anybody tell me how to minimize the absolute value of the complex function exp(jP)+exp(2*pi/180j) where P is the unknown i have some clue regarding taking the Cos and Sin values but i dont know how to minimize the equations Re{exp(jP)}+Re{exp(2*pi/180j)}=0 Im{exp(jP)}+Im{exp(2*pi/180j)}=0 simultaneously in methamatica or other software Thanx On Aug 22, 1:17=A0pm, zingas <shammashah...@gmail.com> wrote: > hi > > =A0can anybody tell me how to minimize the absolute value of the complex > function > > exp(jP)+exp(2*pi/180j) > > =A0where P is the un...

Problem in Matlab with complex number calculations
I have created program ( as below) . I have calculated one parameter(amplitute of impedance) by analytical and matrix multiplication. In analytical calculation, same matrix is explanded and solved. But as Matlab gives direct matrix multiplication , I have calculated same parameter with matrix multiplication. But when when I compare figure 3, Amplitute vs frequency for analytical and Amplitude1 vs frequency for matrix multiplication one.. it gives me 2 different result. see the figure 3. I have checked it so many times but i am not finding any error in program. Is there any numerical error for...

Judge complex degree by state numbers?
Hi, I have met some situations that people evaluate a design's complex degree by asking "How many states does the state machine have". I think any designs based on state machine can be rewritten to counter style, which does not have any state. And in many times a combined mode is used, which means only using a few states and each state has a counter inside. By using state machine, syn_encoding value can be adjusted dynamically. For example, when we cannot get the desired speed, we can set syn_encoding to onehot. But when the speed is ok, is the counter style enough? Thanks &l...

Reading large arrays of complex numbers
Hi, everyone. I am fairly new to IDL, and I have a problem that I can't figure out. I have some large 2D arrays of complex numbers that I need to read into a program. I found some code in this group for reading in complex arrays that works by reading the data into a long 1D array of real numbers, then reforming the data into a 2D array of complex numbers. Unfortunately, the arrays I'm dealing with are so large (2048x2048), that IDL won't create a 1D array of the necessary length (2*2048*2048). Can anyone tell me how I can read in my arrays? acquiredtaste7 writes: > Hi, e...