The function Ops.mvp()
passes unary and binary arithmetic
operators “+
”, “-
”, “*
” and
“^
” to the appropriate specialist function.
The most interesting operator is “*
”, which is passed to
mvp_times_mvp()
. I guess “+
” is quite
interesting too.
The caret “^
” denotes arithmetic exponentiation, as in
x^3==x*x*x
. As an experimental feature, this is (sort of)
vectorised: if n
is a vector, then a^n
returns the sum
of a
raised to the power of each element of n
. For example,
a^c(n1,n2,n3)
is a^n1 + a^n2 + a^n3
. Internally,
n
is tabulated in the interests of efficiency, so
a^c(0,2,5,5,5) = 1 + a^2 + 3a^5
is evaluated with only a
single fifth power. Similar functionality is implemented in the
freealg package.