fspace.spad line 1 [edit on github]
An expression space is a set which is closed under certain operators.
belong?(op)
tests if % accepts op
as applicable to its elements.
box(f)
returns f
with a 'box' around it that prevents f
from being evaluated when operators are applied to it. For example, log(1)
returns 0, but log(box 1)
returns the formal kernel log(1).
definingPolynomial(x)
returns an expression p
such that p(x) = 0
.
distribute(f)
expands all the kernels in f
that are formally enclosed by a box or paren expression.
distribute(f, g)
expands all the kernels in f
that contain g
in their arguments and that are formally enclosed by a box or a paren expression.
elt(op, x)
or op
(x
) applies the unary operator op
to x
.
elt(op, x, y)
or op
(x
, y
) applies the binary operator op
to x
and y
.
elt(op, x, y, z)
or op
(x
, y
, z
) applies the ternary operator op
to x
, y
and z
.
elt(op, x, y, z, t)
or op
(x
, y
, z
, t
) applies the 4-ary operator op
to x
, y
, z
and t
.
elt(op, x, y, z, t, s)
applies the 5-ary operator op
to x
, y
, z
, t
and s
elt(op, x, y, z, t, s, r)
applies the 6-ary operator op
to x
, y
, z
, t
, s
and r
elt(op, x, y, z, t, s, r, q)
applies the 7-ary operator op
to x
, y
, z
, t
, s
, r
and q
elt(op, x, y, z, t, s, r, q, p)
applies the 8-ary operator op
to x
, y
, z
, t
, s
, r
, q
and p
elt(op, x, y, z, t, s, r, q, p, o)
applies the 9-ary operator op
to x
, y
, z
, t
, s
, r
, q
, p
and o
elt(op, [x1, ..., xn])
or op
([x1
, ..., xn
]) applies the n
-ary operator op
to x1
, ..., xn
.
eval(x, s, f)
replaces every s(a)
in x
by f(a)
for any a
.
eval(x, s, f)
replaces every s(a1, .., am)
in x
by f(a1, .., am)
for any a1
, ..., am
.
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces every
in si
(a)x
by
for any fi
(a)a
.
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces every
in si
(a1, ..., an)x
by
for any fi
(a1, ..., an)a1
, ..., an
.
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces every
in si
(a)x
by
for any fi
(a)a
.
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces every
in si
(a1, ..., an)x
by
for any fi
(a1, ..., an)a1
, ..., an
.
eval(x, s, f)
replaces every s(a)
in x
by f(a)
for any a
.
eval(x, s, f)
replaces every s(a1, .., am)
in x
by f(a1, .., am)
for any a1
, ..., am
.
even? x
is true
if x
is an even integer.
freeOf?(x, y)
tests if x
does not contain any occurrence of y
, where y
is a single kernel.
freeOf?(x, s)
tests if x
does not contain any operator whose name is s
.
height(f)
returns the highest nesting level appearing in f
. Constants have height 0. Symbols have height 1. For any operator op and expressions f1
, ..., fn
, op(f1, ..., fn)
has height equal to 1 + max(height(f1), ..., height(fn))
.
is?(x, op)
tests if x
is a kernel and if its operator is op.
is?(x, s)
tests if x
is a kernel and if the name of its operator is s
.
kernel(op, x)
constructs op
(x
) without evaluating it.
kernel(op, [f1, ..., fn])
constructs op(f1, ..., fn)
without evaluating it.
kernels(f)
returns the list of all the top-level kernels appearing in f
, but not the ones appearing in the arguments of the top-level kernels.
kernels([f1,...,fn])
returns the list of all the top-level kernels appearing in f1
, ..., fn
but not the ones appearing in the arguments of the top-level kernels.
mainKernel(f)
returns a kernel of f
with maximum nesting level, or "failed" if f
has no kernels (i.e. f
is a constant).
map(f, k)
returns op(f(x1), ..., f(xn))
where k = op(x1, ..., xn)
.
minPoly(k)
returns p
such that p(k) = 0
.
odd? x
is true
if x
is an odd integer.
operator(op)
returns a copy of op
with the domain-dependent properties appropriate for %.
operators(f)
returns all the basic operators appearing in f
, no matter what their levels are.
paren(f)
returns (f
). This prevents f
from being evaluated when operators are applied to it. For example, log(1)
returns 0, but log(paren 1)
returns the formal kernel log((1)).
subst(f, k = g)
replaces the kernel k
by g
formally in f
.
subst(f, [k1..., kn], [g1, ..., gn])
replaces the kernels k1
, ..., kn
by g1
, ..., gn
formally in f
.
subst(f, [k1 = g1, ..., kn = gn])
replaces the kernels k1
, ..., kn
by g1
, ..., gn
formally in f
.
tower(f)
returns all the kernels appearing in f
, no matter what their levels are.
tower([f1,...,fn])
returns all the kernels appearing in f1
, ..., fn
no matter what their levels are.
Evalable(%)
InnerEvalable(K, %)
InnerEvalable(%, %)