scipp.divide#

scipp.divide(dividend, divisor)#

Element-wise true division.

This function corresponds to the __truediv__ dunder method, i.e. dividend / divisor. The result always contains fractional parts even when the inputs are integers:

Parameters
Returns

Union[Variable, DataArray, Dataset] – Quotient.

Seealso

scipp.floor_divide()

Examples:

>>> sc.divide(sc.arange('x', -2, 3), sc.scalar(2)).values
array([-1. , -0.5,  0. ,  0.5,  1. ])
>>> sc.divide(sc.arange('x', -2.0, 3.0), sc.scalar(2.0)).values
array([-1. , -0.5,  0. ,  0.5,  1. ])

Of equivalently in operator notation

>>> (sc.arange('x', -2.0, 3.0) / sc.scalar(2.0)).values
array([-1. , -0.5,  0. ,  0.5,  1. ])

See the guide on computation for general concepts and broadcasting behavior.