[Numpy-discussion] [ANN]: Taylorpoly, an implementation of vectorized Taylor polynomial operations and request for opinions

Friedrich Romstedt friedrichromstedt at gmail.com
Sat Feb 27 17:11:32 EST 2010


Ok, it took me about one hour, but here they are: Fourier-accelerated
polynomials.

> python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdft_polynomial
>>> p1 = gdft_polynomial.Polynomial([1])
>>> p2 = gdft_polynomial.Polynomial([2])
>>> p1 * p2
<gdft_polynomial.polynomial.Polynomial instance at 0x00E78A08>
>>> print p1 * p2
[ 2.+0.j]
>>> p1 = gdft_polynomial.Polynomial([1, 1])
>>> p2 = gdft_polynomial.Polynomial([1])
>>> print p1 * p2
[ 1. +6.12303177e-17j  1. -6.12303177e-17j]
>>> p2 = gdft_polynomial.Polynomial([1, 2])
>>> print p1 * p2
[ 1. +8.51170986e-16j  3. +3.70074342e-17j  2. -4.44089210e-16j]
>>> p1 = gdft_polynomial.Polynomial([1, 2, 3, 4, 3, 2, 1])
>>> p2 = gdft_polynomial.Polynomial([4, 3, 2, 1, 2, 3, 4])
>>> print (p1 * p2).coefficients.real
[  4.  11.  20.  30.  34.  35.  36.  35.  34.  30.  20.  11.   4.]
>>>

github.com/friedrichromstedt/gdft_polynomials

It's open for bug hunting :-)

Haven't checked the last result.

I used my own gdft module.  Maybe one could incorporate numpy.fft
easily.  But that's your job, Sebastian, isn't it?  Feel free to push
to the repo, and don't forget to add your name to the copyright
notice, hope you are happy with MIT.

Anyway, I don't know whether numpy.fft supports transforming only one
coordinate and using the others for "parallelisation"?

Friedrich



More information about the NumPy-Discussion mailing list