# [Numpy-svn] r8269 - in trunk/numpy/polynomial: . tests

numpy-svn@scip... numpy-svn@scip...
Sat Feb 27 02:01:35 CST 2010

```Author: charris
Date: 2010-02-27 02:01:35 -0600 (Sat, 27 Feb 2010)
New Revision: 8269

Modified:
trunk/numpy/polynomial/polytemplate.py
trunk/numpy/polynomial/tests/test_chebyshev.py
trunk/numpy/polynomial/tests/test_polynomial.py
Log:
BUG: Fix bug in lbnd implementation of the integ method of the Chebyshev and
Polynomial classes.

Modified: trunk/numpy/polynomial/polytemplate.py
===================================================================
--- trunk/numpy/polynomial/polytemplate.py	2010-02-27 07:59:34 UTC (rev 8268)
+++ trunk/numpy/polynomial/polytemplate.py	2010-02-27 08:01:35 UTC (rev 8269)
@@ -455,12 +455,12 @@
`\${nick}der` : similar function for derivative.

"""
-        off, scl = pu.mapparms(\$domain, self.domain)
+        off, scl = self.mapparms()
if lbnd is None :
lbnd = 0
else :
-            lbnd = off + scl*x
-        coef = \${nick}int(self.coef, m, k, lbnd, scl)
+            lbnd = off + scl*lbnd
+        coef = \${nick}int(self.coef, m, k, lbnd, 1./scl)
return self.__class__(coef, self.domain)

def deriv(self, m=1):
@@ -486,7 +486,7 @@
`\${nick}int` : similar function for integration.

"""
-        off, scl = pu.mapparms(self.domain, \$domain)
+        off, scl = self.mapparms()
coef = \${nick}der(self.coef, m, scl)
return self.__class__(coef, self.domain)

Modified: trunk/numpy/polynomial/tests/test_chebyshev.py
===================================================================
--- trunk/numpy/polynomial/tests/test_chebyshev.py	2010-02-27 07:59:34 UTC (rev 8268)
+++ trunk/numpy/polynomial/tests/test_chebyshev.py	2010-02-27 08:01:35 UTC (rev 8269)
@@ -419,6 +419,8 @@
def test_integ(self) :
p = self.p2.integ()
assert_almost_equal(p.coef, ch.chebint([1,2,3], 1, 0, scl=.5))
+        p = self.p2.integ(lbnd=0)
+        assert_almost_equal(p(0), 0)
p = self.p2.integ(1, 1)
assert_almost_equal(p.coef, ch.chebint([1,2,3], 1, 1, scl=.5))
p = self.p2.integ(2, [1, 2])

Modified: trunk/numpy/polynomial/tests/test_polynomial.py
===================================================================
--- trunk/numpy/polynomial/tests/test_polynomial.py	2010-02-27 07:59:34 UTC (rev 8268)
+++ trunk/numpy/polynomial/tests/test_polynomial.py	2010-02-27 08:01:35 UTC (rev 8269)
@@ -393,6 +393,8 @@
def test_integ(self) :
p = self.p2.integ()
assert_almost_equal(p.coef, poly.polyint([1,2,3], 1, 0, scl=.5))
+        p = self.p2.integ(lbnd=0)
+        assert_almost_equal(p(0), 0)
p = self.p2.integ(1, 1)
assert_almost_equal(p.coef, poly.polyint([1,2,3], 1, 1, scl=.5))
p = self.p2.integ(2, [1, 2])

```