ediff1d

Contents

ediff1d#

class saiunit.math.ediff1d(x, to_end=None, to_begin=None, **kwargs)#

Return the differences between consecutive elements of the array.

Parameters:
  • x (Union[saiunit.Quantity, Array, ndarray, number, bool]) – Input array.

  • to_end (Union[saiunit.Quantity, Array, ndarray, number, bool, None]) – Number(s) to append at the end of the returned differences.

  • to_begin (Union[saiunit.Quantity, Array, ndarray, number, bool, None]) – Number(s) to prepend at the beginning of the returned differences.

Returns:

out – Quantity if x is a Quantity, else an array.

Return type:

Union[saiunit.Quantity, Array]

Examples

>>> import saiunit as u
>>> a = [1, 2, 4, 7] * u.meter
>>> u.math.ediff1d(a)