[SciPy-dev] some interesting routines in Python SOMNEC program

eric eric at scipy.org
Wed Feb 13 14:41:20 CST 2002

Hey Rob,

So based on Travis O's comments and some simplification, the following are drop
in replacements for somnec.BESSEL and somnec.HANKEL.  Please note they aren't
vectorized though, so don't pass them an array (you don't in your code I don't

    from scipy import *
    _sign = array((1,-1),typecode=Complex)
    def bessel(z):
        return scipy.special.jv([0,1],z)._sign

    def hankel(z):
        return scipy.special.hankel1([0,1],z)*_sign

I know your purpose for the conversions is as much educational (for you and
others) as it is for development, so I'm sure you want to keep the Python
versions around -- there is just no need to convert them back to C unless you
just want to, because scipy already has them wrapped.

My cursory survey didn't reveal where I should try and plug in integrate.quad,
so I didn't try.  The comments say your using "Shank's" algorithm to speed up
convergence.  SciPy may not have that currently.  Do you have a feel if it is
one we should add, or does it handle the same sorts of problems as quad?


----- Original Message -----
From: "Rob" <rob at pythonemproject.com>
To: <scipy-dev at scipy.net>
Sent: Wednesday, February 13, 2002 1:00 PM
Subject: [SciPy-dev] some interesting routines in Python SOMNEC program

> I've just finished a Python port of the NEC2 SOMNEC routine.  I had a
> real headache resolving overlapping GO TO statements, but as far as I
> can tell it works.  Please feel free to plagarize any of the routines,
> including the Variable Width Romberg Integration.  Its chock full of
> neat stuff, and begs to be rewritten in C.  (no not f2c, that becomes
> unintelligible :)
> Rob.
> --
> The Numeric Python EM Project
> www.pythonemproject.com
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-dev

More information about the Scipy-dev mailing list