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
dividend (VariableLike) – Dividend of the quotient.
divisor (VariableLike) – Divisor of the quotient.
- Returns
Quotient.
- Seealso
- Return type
VariableLike
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.