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)
| 275 | |
| 276 | |
| 277 | def _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 | |
| 309 | def _zseries_int(zs): |
nothing calls this directly
no test coverage detected