Square every element in nested numeric inputs.
Numeric.math.square(value)Applies the square across nested numeric inputs.
- Parameters:
value: Scalar, vector, or matrix input values
- Returns: Squares matching the input nesting shape
- NumPy: Equivalent to
np.square.
import Numeric from '@neabyte/numerix'
const value = Numeric.math.square(5)
console.log(value)
// 25import Numeric from '@neabyte/numerix'
const values = Numeric.math.square([2, 3])
console.log(values)
// [4,9]import Numeric from '@neabyte/numerix'
const values = Numeric.math.square([[1, 2], [3, 4]])
console.log(values)
// [[1,4],[9,16]]import Numeric from '@neabyte/numerix'
const value = Numeric.math.square(-5)
console.log(value)
// 25