[Matrix-SIG] Re: cephesmodule
Travis Oliphant
Oliphant.Travis@mayo.edu
Sat, 13 Mar 1999 17:28:24 -0600 (EST)
>
> >> It would handle it superbly, this is exactly what ufuncs are
> >> for.
> i'm gonna have to lok through the ufunc docs and internals just to see
> how it all works, and how to write extensions which use them. it
> sounds great,
>
> >> But it could go beyond this. With a single statement you could
> >> evaluate Y(l,m,theta,phi) for all l and m up to some limit
> >> where for each l and m the function is evaluated over matrices
> >> theata and phi. This bit of magic is accomplished using the
> >> broadcasting rules that are builtin to ufunc objects.
>
> okay. i am starting to think about how i wanna code the spherical
> harmonics stuff. one thing i need which i dont see: a factorial
> function. it'd be nice to have one (rather than using the gamma
> function, say), since lots of the series solutions type of stuff i
> gonna use them. and its a no brainer to code up? would you wanna add
> one to the cephes module, or should i see if guido would want to add
> it to the math library in pythn, or perhaps into NumPy math.
>
> les
You know I think there are a lot of things that don't get coded up
formally because they are so easy to produce. For example:
def fact(n):
return multiply.reduce(arange(1,n))
This of course is not a ufunc which means it can't be called with an array
of numbers. You know it would be really easy for me to add it to the
cephes library. I don't know what to do about overflow though, as the
question of handling errors in the cephes module is still up in the air.
Another question is developing a library of functions that are implemented
in Python. So far cephes is all C or Fortran code. I'm thinking it would
be good to have a Python wrapper around the module that defined some
functions in Python. I would want all of these functions to be built
around ufuncs though so that the caller could count on broadcasting and
array handling.
Perhaps a separate Python-only module should be developed? Are you
thinking of writing your spherical harmonic code in Python or C?
I was poking around in MATLAB and noticed that their spherical harmonics
(associated legendre function) function legendre.m is written in MATLAB
and it handles complex numbers. I've not heard of an application of
associated Legendre polynomials evaluated over the complex field, but
would it be useful to have?
-Travis