Ops.freealg.RdArithmetic operators for manipulation of freealg objects such as addition, multiplication, powers, etc
# S3 method for class 'freealg'
Ops(e1, e2)
free_negative(S)
free_power_scalar(S,n)
free_power_free(e1, e2)
free_eq_free(e1,e2)
free_plus_numeric(S,x)
free_plus_free(e1,e2)
lowlevel_simplify(words,coeffs)
lowlevel_free_prod(words1,coeffs1,words2,coeffs2)
lowlevel_free_sum(words1,coeffs1,words2,coeffs2)
lowlevel_free_power(words,coeffs,n)
lowlevel_diffn(words,coeffs,r)
lowlevel_subs(words1, coeffs1, words2, coeffs2, r)
inv(S)Objects of class freealg
Integer, possibly non-positive
Integer vector indicating variables to differentiate with respect to
Scalar value
A list of words, that is, a list of integer vectors representing the variables in each term
Numeric vector representing the coefficients of each word
The function Ops.freealg() passes binary arithmetic operators
(“+”, “-”, “*”,
“^”, and “==”) to the appropriate
specialist function.
Integer powers are implemented. The caret [e.g., a^n with
integer n] denotes arithmetic exponentiation, as in
x^3==x*x*x. As an experimental feature, this is (sort of)
vectorised: if v is a vector of integers, then a^v
returns the sum of a raised to the power of each element of
v. 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 mvp package.
Negative powers, as in a^n with \(n<0\) are implemented: if
a has an inverse, then a^n == inv(a)^(-n); so
a^(n+m)=(a^n)*(a^m) for n,m any integers, positive or
negative.
If x and a are freealg objects, then x^a
implements group-theoretic conjugation. If a has an inverse,
then x^a == inv(a)*x*a. The notation is motivated by the
identities x^(ab)=(x^a)^b and (x*y)^a=(x^a)*(y^a).
The only comparison operators are equality and inequality; x==y
is defined as is.zero(x-y).
Functions lowlevel_foo() are low-level functions that interface
directly with the C routines in the src/ directory and
are not intended for the end-user.
Function inv() is defined only for freealg objects with a
single term. If x has a single term we have
inv(x)*x=x*inv(x)=1. There is no corresponding division in the
package because a/b may be either a*inv(b) or
inv(b)*a.
rfalg()
#> free algebra element algebraically equal to
#> + 10a + 2baaa + 10cab + 6ccb
as.freealg("1+x+xy+yx") # variables are non-commutative
#> free algebra element algebraically equal to
#> + 1 + x + xy + yx
as.freealg("x") * as.freealg("X") # upper-case letters are lower-case inverses
#> free algebra element algebraically equal to
#> + 1
constant(as.freealg("x+y+X+Y")^6) # OEIS sequence A035610
#> [1] 232
inv(as.freealg("2aaabAAAAx"))
#> free algebra element algebraically equal to
#> + 0.5XaaaaBAAA
as.freealg("a")^(1:7)
#> free algebra element algebraically equal to
#> + a + aa + aaa + aaaa + aaaaa + aaaaaa + aaaaaaa
x <- rfalg()
y <- rfalg()
a <- as.freealg("a")
b <- as.freealg("b")
(x*y)^a == x^a * y^a
#> [1] TRUE
x^(a*b) == (x^a)^b
#> [1] TRUE