[Numpy-discussion] Another suggestion for making numpy's functions generic
Anne Archibald
peridot.faceted@gmail....
Tue Oct 20 10:04:23 CDT 2009
2009/10/20 Sebastian Walter <sebastian.walter@gmail.com>:
> On Tue, Oct 20, 2009 at 5:45 AM, Anne Archibald
> <peridot.faceted@gmail.com> wrote:
>> 2009/10/19 Sebastian Walter <sebastian.walter@gmail.com>:
>>>
>>> I'm all for generic (u)funcs since they might come handy for me since
>>> I'm doing lots of operation on arrays of polynomials.
>>
>> Just as a side note, if you don't mind my asking, what sorts of
>> operations do you do on arrays of polynomials? In a thread on
>> scipy-dev we're discussing improving scipy's polynomial support, and
>> we'd be happy to get some more feedback on what they need to be able
>> to do.
>
> I've been reading (and commenting) that thread ;)
> I'm doing algorithmic differentiation by computing on truncated
> Taylor polynomials in the Powerbasis,
> i.e. always truncating all operation at degree D
> z(t) = \sum_d=0^{D-1} z_d t^d = x(t) * y(t) = \sum_{d=0}^{D-1}
> \sum_{k=0}^d x_k * y_{d-k} + O(t^D)
>
> Using other bases does not make sense in my case since the truncation
> of all terms of higher degree than t^D
> has afaik no good counterpart for bases like chebycheff.
> On the other hand, I need to be generic in the coefficients, e.g.
> z_d from above could be a tensor of any shape, e.g. a matrix.
In fact, truncating at degree D for Chebyshev polynomials works
exactly the same way as it does for power polynomials, and if what you
care about is function approximation, it has much nicer behaviour. But
if what you care about is really truncated Taylor polynomials, there's
no beating the power basis.
I realize that arrays of polynomial objects are handy from a
bookkeeping point of view, but how does an array of polynomials, say
of shape (N,), differ from a single polynomial with coefficients of
shape (N,)? I think we need to provide the latter in our polynomial
classes, but as you point out, getting ufunc support for the former is
nontrivial.
Anne
More information about the NumPy-Discussion
mailing list