dotDivide

x ./ y

dotDivide(x, y)

Try it yourself:

See also:

dotDivide(): Element-Wise Division

dotDivide() divides matching entries of arrays or matrices. For example, dotDivide([10, 20], [2, 4]) returns [5, 5]. It is useful for normalization, ratios, and scaling each measurement independently.

Shape and zero checks

Inputs normally need compatible shapes, and every divisor entry must be nonzero. Inspect dimensions using size(); use equal() or filtering logic to identify zero entries before calculating. A single invalid denominator can invalidate a whole result.

dotDivide differs from divide(), whose matrix rules are mathematical division rather than entry-by-entry processing. The matching companion is dotMultiply(); applying it with the divisor can verify a result. Use map() when each entry needs additional custom handling.

Interpretation

Element-wise ratios retain the matrix shape, so label axes and units carefully. A ratio can be dimensionless, but it can also carry a derived unit when numerator and denominator differ.

All functions