Comments on Motion P1788/M0010.01_ElementaryFunctions...
Folks,
Now that we are in the discussion period of this motion
let me make some comments. It is a long list, I fear,
but all of them are minor.
First, I would eliminate issues of accuracy as well as
the accuracy column in the table at this time. We have
yet to settle on issues of how we are going to deal with
defining accuracy & I would not want this motion to suffer
from arguments of whether this function or that should
adhere to this or that standard of accuracy. This motion
is not about that.
Our standard of portability is higher than 754's. So if
we are to define a function I believe we should define
it as required (shall) not recommended (should). But it
is worthy of discussion so I'll not press this point.
You define these functions with domains & ranges that are
subsets of R when, in fact, we are seeking to define
functions with domains & ranges that are subsets of IR.
This may make some of the definitions you have difficult
to express in tabular form but it is what we are doing.
For example the domain of log(xx) is the set of all elements
of IR that are CONTAINED in (0,oo).
Also you might make some general comment on what you expect
to be done when some subset of an argument domain is outside
the set which includes the function domain.
As part of concentrating on the domain of IR rather than
R, we have the opportunity to more carefully define some
functions in IR that are ill defined in R. For example,
we could define the signum function (which I would call
signum rather than sign3) as follows:
Signum(xx) = if 0 \in xx then [-1,1]
else if 0 < xx then [1,1]
else {if xx < 0} then [-1,-1].
There are also details WRT [empty] & NaI but I would like
to exclude such issues from this motion if you don't mind.
As I mentioned in a previous note, I would like there NOT
to be a proliferation of x^y functions with different
definitions. Still, sqr, pown, pow, root, & compound all
have their place & can be usefully accomodated together
so long as they are consistently defined. That is, so
long as things like sqr(xx) = pown(xx,2) = pow(xx,[2,2])
for all xx. I would also expand the domain of pow to
include xx < 0 with the definition described in my
previous note.
All of this having been said, I would include root &
compound but not powr as it is not needed in the case of
a properly defined pow & it is inconsistent with the 754
definition of powr.
You include all of log, log10, & log2 but only exp (e^x)
not exp2 (2^x) & exp10 (10^x). This is less a mathematical
or implementation accuracy issue than it is an issue of
user convenience. I see that you were motivated to do
this due to a name space clash with 'exp2'. I would go
ahead & include them for convenience & I'll comment on
the name space thing below.
There is a mistake in the domain of rSqrt. It should be
the set of all elements of IR that are contained in (0,oo).
Strictly speaking, compound could be defined everywhere as
compound(xx,n) = pown(1+xx,n) = pow(1+xx,[n,n]) but it has
no useful meaning for xx < -1. You could go either way on
this.
All of exp2, cos2, sin2, cosh2, sinh2, & exp1 as you have
defined them are, as far as I know, limited in their
utility to people who are trying to write accurate exp,
sin, cos, sinh, & cosh. I think they can be safely
eliminated from a library of general utility. This would
also solve the name space clash you have with exp2 (2^x).
On the other hand, all of expm1 (e^x - 1), exp2m1 (2^x - 1),
exp10m1 (10^x - 1), logp1 (ln(1 + x)), log2p1 (lg(1 + x)), &
log10p1 (log(1 + x)) are of general utility. As someone has
pointed out these latter functions would be more properly
called log1p were it not for the fact that log21p & log101p
look silly. That is why logp1, log2p1, & log10p1 were chosen
for 754. But it is correct to say that they should be
WRITTEN as ln(1 + x), lg(1 + x), & log(1 + x) on the grounds
that they are generally used when their arguments are small
relative to 1. Also, remember the domain is (-1,oo) not
[-1,oo). Well, their domains are those subsets of IR that
are CONTAINED in (-1,oo) anyway. I have to watch myself. :-)
You were wise NOT to include sinPi, cosPi, atanPi, & atan2Pi
as they were defined in 754 for accuracy (& political)
reasons that don't apply to 1788 & intervals. :-)
Finally, even though it is confined to a rationale section,
the discussion of how we might decorate the interval results
of these functions is generally a detail we can postpone for
the future & need not be part of this motion. But this is
your call.
Well, that's it for now.
For some reasons these functions bring out the frustrated
mathematician in all of us so I expect a lively discussion
on this one. :-)
It should be fun. :-)
Enjoy,
Dan