subtract#

bamengine.ops.subtract(a, b, out=None)[source]#

Subtract two arrays or array and scalar.

Parameters:
  • a (array) – First array.

  • b (array or float) – Second array or scalar to subtract from first.

  • out (array, optional) – Output array.

Returns:

Result of subtraction (a - b).

Return type:

array

Examples

>>> import bamengine.ops as ops
>>> inventory = np.array([10.0, 5.0, 0.0])
>>> sold = np.array([2.0, 3.0, 0.0])
>>> remaining = ops.subtract(inventory, sold)
>>> # remaining: [8.0, 2.0, 0.0]