diff options
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r-- | numpy/polynomial/hermite.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index a03fe722c..ae1143d28 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -706,7 +706,7 @@ def hermder(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 @@ -718,7 +718,7 @@ def hermder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = (2*j)*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -782,7 +782,7 @@ def hermint(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 @@ -825,7 +825,7 @@ def hermint(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) @@ -840,7 +840,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(2*(j + 1)) tmp[0] += k[i] - hermval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -983,12 +983,12 @@ def hermval2d(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 = hermval(x, c) @@ -1043,7 +1043,7 @@ def hermgrid2d(x, y, c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ c = hermval(x, c) @@ -1096,12 +1096,12 @@ def hermval3d(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 = hermval(x, c) @@ -1160,7 +1160,7 @@ def hermgrid3d(x, y, z, c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ c = hermval(x, c) @@ -1229,7 +1229,7 @@ def hermvander(x, deg): v[1] = x2 for i in range(2, ideg + 1): v[i] = (v[i-1]*x2 - v[i-2]*(2*(i - 1))) - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def hermvander2d(x, y, deg): @@ -1279,7 +1279,7 @@ def hermvander2d(x, y, deg): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] @@ -1343,7 +1343,7 @@ def hermvander3d(x, y, z, deg): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] @@ -1584,7 +1584,7 @@ def hermcompanion(c): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ # c is a trimmed copy @@ -1732,7 +1732,7 @@ def hermgauss(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 @@ -1796,7 +1796,7 @@ def hermweight(x): Notes ----- - .. versionadded::1.7.0 + .. versionadded:: 1.7.0 """ w = np.exp(-x**2) |