Calculates the magnitude (length) of the array as a vector. Uses the formula: √(x₁² + x₂² + ... + xₙ²)
The magnitude of the array as a number
Performs element-wise subtraction between this array and another numeric array. Both arrays must have equal length.
The numeric array to subtract from this array
A new array with the results of element-wise subtraction
Performs element-wise addition between this array and another numeric array. Both arrays must have equal length.
The numeric array to add to this array
A new array with the results of element-wise addition
Returns a random element from the array.
Calculates the squared magnitude of the array as a vector (faster than magnitude). Uses the formula: x₁² + x₂² + ... + xₙ²
The squared magnitude of the array as a number
Extends the Array prototype with additional mathematical operations with vectors.