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

Skip to first unread message

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

sage: maxima('asinh(1.0)')

which fails a doctest


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.

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

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.


Mike Hansen

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



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


Carl Witty

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

I don't know of a way to add a comment to the doctest that won't be
shown as part of the documentation. I'd recommend either letting it
show in the documentation or adding it as a Python comment just after
the doctest (at the first line of the function body).


Reply all
Reply to author
0 new messages