Add two operands together using NumPy style broadcasting rules.
Numeric.math.add(first, right = 0)Combines operands with NumPy style broadcast.
- Parameters:
first: First operand as a scalar, vector, or matrixright: Second operand as a scalar, vector, or matrix
- Returns: Sums matching the broadcast shape of the operands
- NumPy: Equivalent to
np.add.
import Numeric from '@neabyte/numerix'
const sum = Numeric.math.add(2, 3)
console.log(sum)
// 5import Numeric from '@neabyte/numerix'
const sums = Numeric.math.add([1, 2], 10)
console.log(sums)
// [11,12]import Numeric from '@neabyte/numerix'
const sums = Numeric.math.add([1, 2], [10, 20])
console.log(sums)
// [11,22]import Numeric from '@neabyte/numerix'
const sums = Numeric.math.add([[1, 2], [3, 4]], [10, 20])
console.log(sums)
// [[11,22],[13,24]]