ExpressionSpace¶
fspace.spad line 1 [edit on github]
An expression space is a set which is closed under certain operators.
- belong?: BasicOperator -> Boolean
belong?(op)
tests if % acceptsop
as applicable to its elements.
- box: % -> %
box(f)
returnsf
with a ‘box’ around it that preventsf
from being evaluated when operators are applied to it. For example,log(1)
returns 0, butlog(box 1)
returns the formal kernel log(1).
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- coerce: Kernel % -> %
from CoercibleFrom Kernel %
- definingPolynomial: % -> % if % has Ring
definingPolynomial(x)
returns an expressionp
such thatp(x) = 0
.
- distribute: % -> %
distribute(f)
expands all the kernels inf
that are formally enclosed by a box or paren expression.
- distribute: (%, %) -> %
distribute(f, g)
expands all the kernels inf
that containg
in their arguments and that are formally enclosed by a box or a paren expression.
- elt: (BasicOperator, %) -> %
elt(op, x)
orop
(x
) applies the unary operatorop
tox
.
- elt: (BasicOperator, %, %) -> %
elt(op, x, y)
orop
(x
,y
) applies the binary operatorop
tox
andy
.
- elt: (BasicOperator, %, %, %) -> %
elt(op, x, y, z)
orop
(x
,y
,z
) applies the ternary operatorop
tox
,y
andz
.
- elt: (BasicOperator, %, %, %, %) -> %
elt(op, x, y, z, t)
orop
(x
,y
,z
,t
) applies the 4-ary operatorop
tox
,y
,z
andt
.
- elt: (BasicOperator, %, %, %, %, %) -> %
elt(op, x, y, z, t, s)
applies the 5-ary operatorop
tox
,y
,z
,t
ands
- elt: (BasicOperator, %, %, %, %, %, %) -> %
elt(op, x, y, z, t, s, r)
applies the 6-ary operatorop
tox
,y
,z
,t
,s
andr
- elt: (BasicOperator, %, %, %, %, %, %, %) -> %
elt(op, x, y, z, t, s, r, q)
applies the 7-ary operatorop
tox
,y
,z
,t
,s
,r
andq
- elt: (BasicOperator, %, %, %, %, %, %, %, %) -> %
elt(op, x, y, z, t, s, r, q, p)
applies the 8-ary operatorop
tox
,y
,z
,t
,s
,r
,q
andp
- elt: (BasicOperator, %, %, %, %, %, %, %, %, %) -> %
elt(op, x, y, z, t, s, r, q, p, o)
applies the 9-ary operatorop
tox
,y
,z
,t
,s
,r
,q
,p
ando
- elt: (BasicOperator, List %) -> %
elt(op, [x1, ..., xn])
orop
([x1
, …,xn
]) applies then
-ary operatorop
tox1
, …,xn
.
- eval: (%, %, %) -> %
from InnerEvalable(%, %)
- eval: (%, BasicOperator, % -> %) -> %
eval(x, s, f)
replaces everys(a)
inx
byf(a)
for anya
.
- eval: (%, BasicOperator, List % -> %) -> %
eval(x, s, f)
replaces everys(a1, .., am)
inx
byf(a1, .., am)
for anya1
, …,am
.- eval: (%, Equation %) -> %
from Evalable %
- eval: (%, Kernel %, %) -> %
from InnerEvalable(Kernel %, %)
- eval: (%, List %, List %) -> %
from InnerEvalable(%, %)
- eval: (%, List BasicOperator, List(% -> %)) -> %
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces everysi(a)
inx
byfi(a)
for anya
.
- eval: (%, List BasicOperator, List(List % -> %)) -> %
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces everysi(a1, ..., an)
inx
byfi(a1, ..., an)
for anya1
, …,an
.- eval: (%, List Equation %) -> %
from Evalable %
- eval: (%, List Kernel %, List %) -> %
from InnerEvalable(Kernel %, %)
- eval: (%, List Symbol, List(% -> %)) -> %
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces everysi(a)
inx
byfi(a)
for anya
.
- eval: (%, List Symbol, List(List % -> %)) -> %
eval(x, [s1, ..., sm], [f1, ..., fm])
replaces everysi(a1, ..., an)
inx
byfi(a1, ..., an)
for anya1
, …,an
.
- eval: (%, Symbol, % -> %) -> %
eval(x, s, f)
replaces everys(a)
inx
byf(a)
for anya
.
- eval: (%, Symbol, List % -> %) -> %
eval(x, s, f)
replaces everys(a1, .., am)
inx
byf(a1, .., am)
for anya1
, …,am
.
- even?: % -> Boolean if % has RetractableTo Integer
even? x
istrue
ifx
is an even integer.
- freeOf?: (%, %) -> Boolean
freeOf?(x, y)
tests ifx
does not contain any occurrence ofy
, wherey
is a single kernel.
- freeOf?: (%, Symbol) -> Boolean
freeOf?(x, s)
tests ifx
does not contain any operator whose name iss
.
- height: % -> NonNegativeInteger
height(f)
returns the highest nesting level appearing inf
. Constants have height 0. Symbols have height 1. For any operator op and expressionsf1
, …,fn
,op(f1, ..., fn)
has height equal to1 + max(height(f1), ..., height(fn))
.
- is?: (%, BasicOperator) -> Boolean
is?(x, op)
tests ifx
is a kernel and if its operator is op.
- kernel: (BasicOperator, %) -> %
kernel(op, x)
constructsop
(x
) without evaluating it.
- kernel: (BasicOperator, List %) -> %
kernel(op, [f1, ..., fn])
constructsop(f1, ..., fn)
without evaluating it.
- kernels: % -> List Kernel %
kernels(f)
returns the list of all the top-level kernels appearing inf
, but not the ones appearing in the arguments of the top-level kernels.
- kernels: List % -> List Kernel %
kernels([f1,...,fn])
returns the list of all the top-level kernels appearing inf1
, …,fn
but not the ones appearing in the arguments of the top-level kernels.
- latex: % -> String
from SetCategory
- mainKernel: % -> Union(Kernel %, failed)
mainKernel(f)
returns a kernel off
with maximum nesting level, or “failed” iff
has no kernels (i.e.f
is a constant).
- map: (% -> %, Kernel %) -> %
map(f, k)
returnsop(f(x1), ..., f(xn))
wherek = op(x1, ..., xn)
.
- minPoly: Kernel % -> SparseUnivariatePolynomial % if % has Ring
minPoly(k)
returnsp
such thatp(k) = 0
.
- odd?: % -> Boolean if % has RetractableTo Integer
odd? x
istrue
ifx
is an odd integer.
- operator: BasicOperator -> BasicOperator
operator(op)
returns a copy ofop
with the domain-dependent properties appropriate for %.
- operators: % -> List BasicOperator
operators(f)
returns all the basic operators appearing inf
, no matter what their levels are.
- paren: % -> %
paren(f)
returns (f
). This preventsf
from being evaluated when operators are applied to it. For example,log(1)
returns 0, butlog(paren 1)
returns the formal kernel log((1)).
- retract: % -> Kernel %
from RetractableTo Kernel %
- retractIfCan: % -> Union(Kernel %, failed)
from RetractableTo Kernel %
- smaller?: (%, %) -> Boolean
from Comparable
- subst: (%, Equation %) -> %
subst(f, k = g)
replaces the kernelk
byg
formally inf
.
- subst: (%, List Equation %) -> %
subst(f, [k1 = g1, ..., kn = gn])
replaces the kernelsk1
, …,kn
byg1
, …,gn
formally inf
.
- subst: (%, List Kernel %, List %) -> %
subst(f, [k1..., kn], [g1, ..., gn])
replaces the kernelsk1
, …,kn
byg1
, …,gn
formally inf
.
- tower: % -> List Kernel %
tower(f)
returns all the kernels appearing inf
, no matter what their levels are.
- tower: List % -> List Kernel %
tower([f1,...,fn])
returns all the kernels appearing inf1
, …,fn
no matter what their levels are.
Evalable %
InnerEvalable(%, %)
InnerEvalable(Kernel %, %)