The old Google Groups will be going away soon, but your browser is incompatible with the new version.
It is reasonable to change doctest from asinh(1.0) to asinh(2.0)?
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 4 messages

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Aug 13 2010, 1:46 am
From: "Dr. David Kirkby" <david.kir...@onetel.net>
Date: Fri, 13 Aug 2010 06:46:23 +0100
Local: Fri, Aug 13 2010 1:46 am
Subject: It is reasonable to change doctest from asinh(1.0) to asinh(2.0)?
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

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

To post a message you must first join this group.
You do not have the permission required to post.
More options Aug 13 2010, 2:10 am
From: Mike Hansen <mhan...@gmail.com>
Date: Thu, 12 Aug 2010 23:10:29 -0700
Local: Fri, Aug 13 2010 2:10 am
Subject: Re: [sage-devel] It is reasonable to change doctest from asinh(1.0) to asinh(2.0)?
On Thu, Aug 12, 2010 at 10:46 PM, Dr. David Kirkby

<david.kir...@onetel.net> wrote:
> Does that seem a reasonable change?

+1

--Mike

To post a message you must first join this group.
You do not have the permission required to post.
More options Aug 13 2010, 3:08 am
From: "Dr. David Kirkby" <david.kir...@onetel.net>
Date: Fri, 13 Aug 2010 08:08:53 +0100
Local: Fri, Aug 13 2010 3:08 am
Subject: Re: [sage-devel] It is reasonable to change doctest from asinh(1.0) to asinh(2.0)?
On 08/13/10 07:10 AM, Mike Hansen wrote:

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

> +1

> --Mike

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

To post a message you must first join this group.
You do not have the permission required to post.
More options Aug 13 2010, 11:29 am
From: Carl Witty <carl.wi...@gmail.com>
Date: Fri, 13 Aug 2010 08:29:46 -0700
Local: Fri, Aug 13 2010 11:29 am
Subject: Re: [sage-devel] It is reasonable to change doctest from asinh(1.0) to asinh(2.0)?
On Fri, Aug 13, 2010 at 12:08 AM, Dr. David Kirkby

<david.kir...@onetel.net> wrote:
> 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.

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

Carl