chaospy.ediff1d¶
- chaospy.ediff1d(ary: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]], numpoly.baseclass.ndpoly], to_end: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]], numpoly.baseclass.ndpoly]] = None, to_begin: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]], numpoly.baseclass.ndpoly]] = None) numpoly.baseclass.ndpoly [source]¶
Difference between consecutive elements of an array.
- Args:
- ary:
If necessary, will be flattened before the differences are taken.
- to_end:
Polynomial(s) to append at the end of the returned differences.
- to_begin:
Polynomial(s) to prepend at the beginning of the returned differences.
- Return:
The differences. Loosely, this is
ary.flat[1:] - ary.flat[:-1]
.- Example:
>>> poly = numpoly.monomial(4) >>> poly polynomial([1, q0, q0**2, q0**3]) >>> numpoly.ediff1d(poly) polynomial([q0-1, q0**2-q0, q0**3-q0**2]) >>> q0, q1 = numpoly.variable(2) >>> numpoly.ediff1d(poly, to_begin=q0, to_end=[1, q1]) polynomial([q0, q0-1, q0**2-q0, q0**3-q0**2, 1, q1])