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 (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

  • to_end (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Number(s) to append at the end of the returned differences.

  • to_begin (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Number(s) to prepend at the beginning of the returned differences.

Returns:

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

Return type:

saiunit.Quantity | Array

Examples

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