sqr
A function that squares its argument.
Syntax

sqr(x)

x
is a number, vector, or matrix

Description

If
x
is a number,sqr(x)
is the square ofx
, equal tox⋅x = x^2
. 
If
v
is a vector,sqr(v)
is the dot product ofv
and itself, that is,v⋅v = (vv) = norm(v)^2
. 
If
A
is a square matrix,sqr(A)
is the square ofA
, that is,A⋅A = A^2
.
Notes
Typically, you write x^2
to square a number or matrix x
. However, if you need the squaring operation as a function, sqr
is more convenient to write than x ↦ x^2
.
Examples
sqr(5)
25
sqr(❨3, 0, −2❩)
13
sqr(❨❨2, 1❩, ❨i, 3❩❩)
⎛4 + i 5 ⎞ ⎝ 5⋅i 9 + i⎠
SequenceVector(20) @ sqr
(1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400)
SequenceVector(10) @ prime @ sqr
(4, 9, 25, 49, 121, 169, 289, 361, 529, 841)