MCPcopy Create free account
hub / github.com/numpy/numpy / _zseries_der

Function _zseries_der

numpy/polynomial/chebyshev.py:277–306  ·  view source on GitHub ↗

Differentiate a z-series. The derivative is with respect to x, not z. This is achieved using the chain rule and the value of dx/dz given in the module notes. Parameters ---------- zs : z-series The z-series to differentiate. Returns ------- derivative : z-s

(zs)

Source from the content-addressed store, hash-verified

275
276
277def _zseries_der(zs):
278 """Differentiate a z-series.
279
280 The derivative is with respect to x, not z. This is achieved using the
281 chain rule and the value of dx/dz given in the module notes.
282
283 Parameters
284 ----------
285 zs : z-series
286 The z-series to differentiate.
287
288 Returns
289 -------
290 derivative : z-series
291 The derivative
292
293 Notes
294 -----
295 The zseries for x (ns) has been multiplied by two in order to avoid
296 using floats that are incompatible with Decimal and likely other
297 specialized scalar types. This scaling has been compensated by
298 multiplying the value of zs by two also so that the two cancels in the
299 division.
300
301 """
302 n = len(zs)//2
303 ns = np.array([-1, 0, 1], dtype=zs.dtype)
304 zs *= np.arange(-n, n+1)*2
305 d, r = _zseries_div(zs, ns)
306 return d
307
308
309def _zseries_int(zs):

Callers

nothing calls this directly

Calls 1

_zseries_divFunction · 0.85

Tested by

no test coverage detected