# It is reasonable to change doctest from asinh(1.0) to asinh(2.0)?

4 views

### Dr. David Kirkby

Aug 13, 2010, 1:46:23 AM8/13/10
to sage-devel
Maxima is printing what I consider a strange result on two Solaris machines,
when computing the asinh of 1.0. The leading zero is not printed, so a doctest
fails.

sage: maxima('asinh(1.0)')
.8813735870195429

which fails a doctest

Expected:
0.881373587019543
Got:
.8813735870195429

http://trac.sagemath.org/sage_trac/ticket/9693

The Maxima developers can reproduce similar examples on Linux machines and seem
to see this more as a feature than a bug, as it allows printing more digits in
the 17 places allocated to printing numbers.

http://www.math.utexas.edu/pipermail/maxima/2010/022230.html

How should this doctest be changed so it passes?

What seems easiest to me, is just to change the test. So instead of finding the
asinh of 1.0, we do it of 2.0

sage: maxima('asinh(2.0)')
1.44363547517881

That gives a number > 1, so the problem with the missing leading zero goes. For
the point of view of a test, I don't see it really matters what the value is
going to be chosen.

A higher precision result of this, which I computed with Mathematica is:

In[4]:= N[ArcSinh[2],30]

Out[4]= 1.44363547517881034249327674027

It so happens I get *exactly* the same result then on all these machines.

* sage.math (Linux)
* bsd.math (OS X)
* t2.math (Solaris 10 on SPARC)
* fulvia @ skynet (Solaris 10 on x86)
* My Ultra 27 (OpenSolaris on x86)

In all cases, all digits are in fact correct - at least they agree with a higher
precision result I computed with Mathematica.

So I propose we change symbolic/expression.pyx to compute the asinh(2.0) instead
of asinh(1.0), and set the expected result to 1.44363547517881, as that's that
result is correct in every digit, and is given on all the machines where I have
managed to try Sage.

Does that seem a reasonable change?

Perhaps setting the expected result to 1.4436354751788... might be better, as
that will allow a bit of room for numerical noise, though all machines I've
tested on give exactly the same result.

Dave

### Mike Hansen

Aug 13, 2010, 2:10:29 AM8/13/10
On Thu, Aug 12, 2010 at 10:46 PM, Dr. David Kirkby
<david....@onetel.net> wrote:
> Does that seem a reasonable change?

+1

--Mike

### Dr. David Kirkby

Aug 13, 2010, 3:08:53 AM8/13/10

Thank you Mike. I'll make that change if there are no objections. But I'll wait
until I get a few responses from the answer to

sage: maxima('asinh(2.0)')

as I'd like to know if other systems give other results.

How can I add a comment to the doc test, which will not be printed in the
documentation? I'd like to add the result from a high-precision computation, so
anyone looking at the doctest in future could see what's a reasonable answer and
what is not. I get very frustrated when I see an expected result of
"23.32233298" or something like that, with no explanation why that result is
expected.

Dave

### Carl Witty

Aug 13, 2010, 11:29:46 AM8/13/10