Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sqrt of complex number

123 views
Skip to first unread message

Jacare Omoplata

unread,
May 27, 2012, 4:44:11 AM5/27/12
to
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.

djmpark

unread,
May 28, 2012, 5:11:02 AM5/28/12
to
You can find all the solutions by using Solve.

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

{{root -> -2 + I}, {root -> 2 - I}}

If you ask for the value of a function that is multivalued then Mathematica
returns the "principal value" and this is determined by picking (arbitrary)
branch cuts. This is discussed in:

tutorial/FunctionsThatDoNotHaveUniqueValues

However, in a sense, branch lines are an artifact of insisting on a single
principal value. Riemann showed that one can construct a surface, now called
a Riemann surface, on which a multiple valued complex function is single
valued and continuous, and on which all the multiple values are recovered by
moving around the surface. The critical points (0 for the square root
function) are real but the branch cuts disappear.

One can simulate this along a parameterized line by calculating all the
roots, remembering the most recent values, and maintaining continuity of the
roots along a path by reordering if necessary.

The Presentations application has facility for this in the Multivalues
section of the ComplexGraphics sub-package. The Sqrt example is included in
the package (under the "Writing Presentations" essay). There the Sqrt
function is represented by a locator that can be dragged around the
projection of the Riemann surface onto the complex plane. The value of the
complex function is represented by an arrow attached to the point. If one
drags the point around the origin the value of the function is perfectly
smooth - the arrow never jumps discontinuously. However, it is necessary to
drag the locator around the origin twice to return to the initial value,
which indicates that we are moving on an (invisible) Riemann surface.

Murray Eisenberg and I wrote a paper, "Visualizing Complex Functions with
the Presentations Application" in The Mathematica Journal, which contained a
Riemann surface plot for:

Sqrt[z - 1] Power[z - I, (3)^-1]

This contains critical points at 1 and I. If we drag the locator around the
plane the arrow, representing the function value, varies perfectly smoothly.
If we circle, close in, the critical point at 1 we need two circuits to
return to the original value. Circling the critical point at I requires 3
circuits. Circling both critical points requires 6 circuits. However, the
Riemann surface about 1 actually has three leafs. If we repeatedly circle 1
we remain on one leaf, but if we detour to circle the critical point at I
and then return to circling 1 we will be on a different leaf and this will
be represented in the arrow values. Similarly there are two leafs to the
surface about the critical point at I and we can switch between them by
detouring around the critical point at 1.

Some functions, such as log, have an infinite number of multivalues and in
such cases we would only be able to explore a portion of the surface by this
technique. Nevertheless, Riemann surfaces are an actual practical method for
exploring and visualizing complex functions in Mathematica.


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/index.html

Dave Snead

unread,
May 28, 2012, 5:12:03 AM5/28/12
to
Use Solve to get both answers:

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

{{z->-2+I},{z->2-I}}

Cheers,
Dave Snead

Helen Read

unread,
May 28, 2012, 5:12:34 AM5/28/12
to
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

Erik Max Francis

unread,
May 28, 2012, 5:13:35 AM5/28/12
to
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 && m...@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

Murray Eisenberg

unread,
May 28, 2012, 5:14:36 AM5/28/12
to
As the documentation says:

Sqrt[z] means z^(1/2)

z^p gives the _principal value_ -- of Exp[p Log[z]].

As with any rational power 1/m, then, you'll need another way to find
other roots. One way:

z /. Solve[z^2 == 3 - 4 I, z]
{-2 + I, 2 - I}

(In some such situations, you'll want to wrap the z/.Solve[...]
expression with ComplexExpand in order to get the Cartesian forms of the
roots.

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

--
Murray Eisenberg mur...@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

Bob Hanlon

unread,
May 28, 2012, 5:10:01 AM5/28/12
to
A function (e.g., Sqrt) must be single-valued at each point so Sqrt is
defined as the "principal root." The two values you are looking for
are

y /. Solve[y^2 == x, y]

{-Sqrt[x], Sqrt[x]}

y /. Solve[y^2 == 3 - 4 I, y]

{-2 + I, 2 - I}

See http://reference.wolfram.com/mathematica/tutorial/FunctionsThatDoNotHaveUniqueValues.html


Bob Hanlon

David Bailey

unread,
May 29, 2012, 5:46:41 AM5/29/12
to

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

In addition to what others have said, it is maybe worth pointing out
that in general, the Sqrt expression would be embedded in a larger
expression, such as a+Sqrt[3-4 I]+42 - so what should Mathematica do? If
it returns a list of all possible answers, that might not be acceptable
to something that was expecting a single value, and anyway, expressions
such as ArcSin[.2] would have an infinite number of answers!

The only possible alternative strategy would be not to evaluate at all,
as is the case with Sqrt[x^2] (since the answer can by x or -x).

David Bailey
http://www.dbaileyconsultancy.co.uk


Richard Fateman

unread,
May 29, 2012, 5:51:47 AM5/29/12
to
................

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






Andrzej Kozlowski

unread,
May 30, 2012, 4:10:39 AM5/30/12
to

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



Richard Fateman

unread,
May 30, 2012, 4:13:12 AM5/30/12
to
On 5/29/2012 2:46 AM, David Bailey wrote:
.....
>>
>
> In addition to what others have said, it is maybe worth pointing out
> that in general, the Sqrt expression would be embedded in a larger
> expression, such as a+Sqrt[3-4 I]+42 - so what should Mathematica do? If
> it returns a list of all possible answers, that might not be acceptable
> to something that was expecting a single value,
That suggests to me that whatever was expecting a single value has a bug
in it. Ideally if the mathematics dictates "there are multiple answers"
then a good program should be able to deal with it. Otherwise it is
not doing mathematics.

and anyway, expressions
> such as ArcSin[.2] would have an infinite number of answers!
There are several possible notations for infinite sets.
Here's one: Table[f[x],x,1, Inf]

>
> The only possible alternative strategy would be not to evaluate at all,
No, see above.

> as is the case with Sqrt[x^2] (since the answer can by x or -x).
Root[x^2,n] works for me, if n is an integer. We could have all even
n choose one sign and odd n choose the other.


These suggestions may not fit into today's Mathematica very well, but that
does not mean that a better system could not be constructed.

RJF


>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>
>


Murray Eisenberg

unread,
May 30, 2012, 4:15:45 AM5/30/12
to
"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:
> ................
>
> 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
>
>
>
>
>
>

Richard Fateman

unread,
May 31, 2012, 2:50:54 AM5/31/12
to
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

Andrzej Kozlowski

unread,
May 31, 2012, 2:51:55 AM5/31/12
to

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.

Richard Fateman

unread,
May 31, 2012, 2:49:23 AM5/31/12
to
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.

da...@wolfram.com

unread,
Jun 1, 2012, 5:22:41 AM6/1/12
to
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


Richard Fateman

unread,
Jun 2, 2012, 5:43:41 AM6/2/12
to
On 6/1/2012 2:22 AM, da...@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
>
>


0 new messages