[SciPy-user] Inconsistent standard deviation and variance implementation in scipy vs. scipy.stats

Robert Kern robert.kern@gmail....
Mon Oct 6 21:40:38 CDT 2008


On Mon, Oct 6, 2008 at 21:30, Anne Archibald <peridot.faceted@gmail.com> wrote:
> The case I was concerned about was
>
> import scipy as sp
> x = sp.cos(2*sp.arccos(y))
>
> If this is changed to
>
> import numpy as np
> x = np.cos(2*np.arccos(y))
>
> it suddenly stops working for values y>1. To keep the same behaviour
> it needs to be
>
> import scipy as sp
> import numpy as np
> x = np.cos(2*sp.arccos(y))
>
> This is perhaps all right, but it does mean that users need to pay attention.

Well, if we remove some names from scipy/__init__.py, we should remove
them all. The actual definitions of those extended-domain functions
are actually in numpy.lib.scimath, not scipy. We can make a convenient
module inside numpy that basically does this:

  from numpy import *
  from numpy.lib.scimath import *

Then the transition for people using "import scipy" becomes quite easy.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list