[SciPy-dev] scipy.stats: sf for symmetric distributions.

Pauli Virtanen pav at iki.fi
Wed Sep 16 17:25:21 EDT 2009


ke, 2009-09-16 kello 17:01 -0400, David Warde-Farley kirjoitti:
> On 16-Sep-09, at 3:53 PM, David Warde-Farley wrote:
> 
> > incidentally, this breaks two
> > ttest tests because they differ in the 17th decimal place, how sure
> > are you of those hard-coded numbers?).
> 
> I just did the integral with Sage and requested 100 bits of precision,  
> more than we need, and got
> 
> sage: thepdf
> 1/4*sqrt(2)/(1/2*x^2 + 1)^(3/2)
> sage: n(2 * integral(thepdf, x, -infinity, -1), prec=100)
> 0.42264973081037423549085121950

Btw, this integral evaluates to

	1 - 1/sqrt(3)

Now, depending on how you evaluate this in floating point, you get
different results:

	1. - 1./sqrt(3.)        = 0.42264973081037416
	(sqrt(3.) - 1)/sqrt(3.) = 0.42264973081037421
	(3. - sqrt(3.))/3.      = 0.42264973081037427

Perhaps the 0.###27 was obtained like this...

It's nice if you can actually maintain this level of accuracy in
scipy.stats in a way that works on all platforms -- doesn't work in
scipy.special as the boost tests show.

Cheers,
Pauli






More information about the SciPy-Dev mailing list