diff options
Diffstat (limited to 'numpy/polynomial/legendre.py')
-rw-r--r-- | numpy/polynomial/legendre.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index be8410b82..1c42f4881 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -136,10 +136,10 @@ def poly2leg(pol): >>> from numpy import polynomial as P >>> p = P.Polynomial(np.arange(4)) >>> p - Polynomial([ 0., 1., 2., 3.], [-1., 1.]) - >>> c = P.Legendre(P.poly2leg(p.coef)) + Polynomial([ 0., 1., 2., 3.], domain=[-1, 1], window=[-1, 1]) + >>> c = P.Legendre(P.legendre.poly2leg(p.coef)) >>> c - Legendre([ 1. , 3.25, 1. , 0.75], [-1., 1.]) + Legendre([ 1. , 3.25, 1. , 0.75], domain=[-1, 1], window=[-1, 1]) """ [pol] = pu.as_series([pol]) @@ -742,7 +742,7 @@ def legder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -758,7 +758,7 @@ def legder(c, m=1, scl=1, axis=0): der[1] = 3*c[2] der[0] = c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -822,7 +822,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): Note that the result of each integration is *multiplied* by `scl`. Why is this important to note? Say one is making a linear change of variable :math:`u = ax + b` in an integral relative to `x`. Then - .. math::`dx = du/a`, so one will need to set `scl` equal to + :math:`dx = du/a`, so one will need to set `scl` equal to :math:`1/a` - perhaps not what one would have first thought. Also note that, in general, the result of integrating a C-series needs @@ -867,7 +867,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -886,7 +886,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j - 1] -= t tmp[0] += k[i] - legval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1021,12 +1021,12 @@ def legval2d(x, y, c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ try: x, y = np.array((x, y), copy=0) - except: + except Exception: raise ValueError('x, y are incompatible') c = legval(x, c) @@ -1081,7 +1081,7 @@ def leggrid2d(x, y, c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ c = legval(x, c) @@ -1134,12 +1134,12 @@ def legval3d(x, y, z, c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ try: x, y, z = np.array((x, y, z), copy=0) - except: + except Exception: raise ValueError('x, y, z are incompatible') c = legval(x, c) @@ -1198,7 +1198,7 @@ def leggrid3d(x, y, z, c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ c = legval(x, c) @@ -1259,7 +1259,7 @@ def legvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = (v[i-1]*x*(2*i - 1) - v[i-2]*(i - 1))/i - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def legvander2d(x, y, deg): @@ -1309,7 +1309,7 @@ def legvander2d(x, y, deg): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] @@ -1373,7 +1373,7 @@ def legvander3d(x, y, z, deg): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] @@ -1611,7 +1611,7 @@ def legcompanion(c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ # c is a trimmed copy @@ -1712,7 +1712,7 @@ def leggauss(deg): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 The results have only been tested up to degree 100, higher degrees may be problematic. The weights are determined by using the fact that @@ -1777,7 +1777,7 @@ def legweight(x): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ w = x*0.0 + 1.0 |