[SciPy-user] Using scipy specfunc in integration

Robert Kern robert.kern@gmail....
Fri Jun 13 13:57:40 CDT 2008


On Fri, Jun 13, 2008 at 09:21, Neal Becker <ndbecker2@gmail.com> wrote:
> Any ideas on this?
> from scipy.special import erf
> from math import exp, tan
> def cot(x):
>    return 1/tan(x)
>
> N = 8
> esnodB = 10
> Rd = 10**(.1 * esnodB)
>
> def F (y):
>    return exp (-(y**2)) * erf (y * cot (pi/N))
>
>
> Pe = float(N-1)/float(N) - 0.5 * erf (sqrt (Rd * sin (pi/N))) - 1/(sqrt(pi))
> * quadrature(F, 0, sqrt(Rd) * sin (pi/N))[0]
> TypeError: only length-1 arrays can be converted to Python scalars
>
> It seems to be complaining about erf.
> erf
> Out[33]: <ufunc 'erf'>

I think it's complaining about exp(), actually. quadrature() is going
to pass arrays to F(), not scalars.

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