[Numpy-discussion] Asymmetry in Chebyshev.deriv v. Chebyshev.integ
Charles R Harris
charlesr.harris at gmail.com
Fri Apr 2 13:46:24 EDT 2010
On Fri, Apr 2, 2010 at 11:27 AM, David Goldsmith <d.l.goldsmith at gmail.com>wrote:
> On Thu, Apr 1, 2010 at 6:42 PM, David Goldsmith <d.l.goldsmith at gmail.com>wrote:
>
>> >>> np.version.version
>> '1.4.0'
>> >>> c = np.polynomial.chebyshev.Chebyshev(1)
>> >>> c.deriv(1.0)
>> Chebyshev([ 0.], [-1., 1.])
>> >>> c.integ(1.0)
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "<string>", line 441, in integ
>> File "C:\Python26\lib\site-packages\numpy\polynomial\chebyshev.py", line
>> 739,
>> in chebint
>> k = list(k) + [0]*(m - len(k))
>> TypeError: can't multiply sequence by non-int of type 'float'
>> >>> c.integ(1)
>> Chebyshev([ 0., 1.], [-1., 1.])
>>
>> i.e., deriv accepts int_like input but integ doesn't.
>>
>> Given the way I just embarrassed myself on the scipy-dev list :-(, I'm
>> confirming this is a bug before I file a ticket.
>>
>
> Also:
>
> >>> c.deriv(0)
> Chebyshev([ 1.], [-1., 1.])
> >>> c.integ(0)
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "<string>", line 441, in integ
> File "C:\Python26\lib\site-packages\numpy\polynomial\chebyshev.py", line
> 729,
> in chebint
> raise ValueError, "The order of integration must be positive"
> ValueError: The order of integration must be positive
>
> i.e., deriv supports zero-order differentiation, but integ doesn't support
> zero-order integration (though I acknowledge that this may be a feature, not
> a bug).
>
>
It was inherited. I have no qualms about letting it integrate zero times if
folks think it should go that way. I think the reason derivatives allowed 0
for the number of derivations was for classroom instruction.
Chuck
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100402/9689b13d/attachment.html>
More information about the NumPy-Discussion
mailing list