Date: Jul 24, 2013 7:38 AM
Author: Waldek Hebisch
Subject: Re: An independent integration test suite

Nasser M. Abbasi <> wrote:
> I remember reading that some math people, 100 or 200 years ago,
> decided that sqrt (of non-negative, non-complex values) was single valued
> function and its value is the non-negative root (ie. principal
> square root).

Beware that mathematicians have Humpty Dumpty attitude:
: When I use a word. it means just what I choose it to
: mean -- neither more nor less.
Another mathematician may use the same word with different
meaning (of course, in good math text meaning is explained).

Before complex numbers were invented only nonnegative
square root was in use.

Currently there are three sligtly different conventions:

- real one: sqrt can be only applied to non-negative numbers
and produces non-negative values. This one is used in
schools before pupils learn about complex numbers,
sometimes in real analysis and in theory of real fields

- algebraic: y = sqrt(x) is basically abbreviation for
equation y^2 = x. Using functional notation is
justified by fact that in algebraic context it normally
does not matter which root you use. In fact, given
a single root there is no algebraic way to distinguish
it from the other one. Only dependent roots, like
sqrt(2)*sqrt(3) versus sqrt(6) allows you to see
difference. In some context dependent roots are
just illegal input, in other context case reasoning
is needed.

- complex analytic: sqrt is a multivalied function. When
we need a single branch this branch is choosen so that
resulting function is analytic

You may ask: Is not the principial branch of squre root
the "true" one? My opinion is that using principial branch
for numerical computation is unavoidable imperfection
morally not much different from using floating point
instead of true reals. Simply, for numeric computations
we choose alternative which can be implemented with
reasonable effort and frequently gives correct results.
But ultimately it is up to programmers to make sure
that correct branch is choosen. For example FriCAS
numeric code for elliptic functions makes heavy use
of square roots. To ensure nice branch cuts for
elliptic integrals I had to compute appropriate
branch of square root and this branch is different
than principal branch.

Waldek Hebisch