Element-wise square or power-2 operations on numeric or complex vectors
(or objects which can be coerced to them).
Usage
# S3 method for default
square(x)
Value
Vector or array of elements from x elevated to the power-2.
Arguments
x
numeric or complex vectors or objects which can be coerced to such,
or other objects for which methods have been written.
Author
Chloe Serre-Combe, Amelie Vernay
Details
square(x) is equivalent to x^2 where ^ is the default power function,
i.e. \(x^2\).
From base::Arithmetic: if applied to arrays the result will be an array if
this is sensible
(for example it will not if the recycling rule has been invoked).