summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-02-27 08:01:35 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-02-27 08:01:35 +0000
commit4e59ff6240c9d6dc34e4b8b66d83f04a28ef16a2 (patch)
treede61beef144344b1f566fe630a36e408e045706a /numpy
parent7004a5a3652d5131ef9144ead7bc7cc549f0fae2 (diff)
downloadnumpy-4e59ff6240c9d6dc34e4b8b66d83f04a28ef16a2.tar.gz
BUG: Fix bug in lbnd implementation of the integ method of the Chebyshev and
Polynomial classes.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/polynomial/polytemplate.py8
-rw-r--r--numpy/polynomial/tests/test_chebyshev.py2
-rw-r--r--numpy/polynomial/tests/test_polynomial.py2
3 files changed, 8 insertions, 4 deletions
diff --git a/numpy/polynomial/polytemplate.py b/numpy/polynomial/polytemplate.py
index 29691496b..f91e2d5e2 100644
--- a/numpy/polynomial/polytemplate.py
+++ b/numpy/polynomial/polytemplate.py
@@ -455,12 +455,12 @@ class $name(pu.PolyBase) :
`${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 @@ class $name(pu.PolyBase) :
`${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)
diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py
index 4579902ce..10e3fdafa 100644
--- a/numpy/polynomial/tests/test_chebyshev.py
+++ b/numpy/polynomial/tests/test_chebyshev.py
@@ -419,6 +419,8 @@ class TestChebyshevClass(TestCase) :
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])
diff --git a/numpy/polynomial/tests/test_polynomial.py b/numpy/polynomial/tests/test_polynomial.py
index 8386aed10..936375a80 100644
--- a/numpy/polynomial/tests/test_polynomial.py
+++ b/numpy/polynomial/tests/test_polynomial.py
@@ -393,6 +393,8 @@ class TestPolynomialClass(TestCase) :
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])