Collect terms in x with given factor k.
spad
)abbrev package COLL Collect
I==>Integer
E==>Expression I
K==>Kernel E
Q==>PolynomialCategoryQuotientFunctions( _
IndexedExponents K, K, I, SparseMultivariatePolynomial(I,K), E)
Collect(): with
collect:(E,E) -> List E
== add
collect1(x:E,k:K):E ==
n1:=univariate(x,k)$Q
n2:=(leadingMonomial numer n1)/(denom n1)
n3:=multivariate(n2,k)$Q
collect2(x:E,k:E,s1:List Equation E):List E ==
x2:=eval(collect1(eval(x,s1),kernel '%k),[kernel '%k],[k])
x2=0 => []
concat(x2,collect2(x-x2,k,s1))
collect(x,k) ==
s1:=solve(equation(coerce('%k),k),variables(k)(1))$TransSolvePackage(I)
collect2(x,k,s1)
spad
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3893914476593947683-25px001.spad
using old system compiler.
COLL abbreviates package Collect
------------------------------------------------------------------------
initializing NRLIB COLL for Collect
compiling into NRLIB COLL
compiling local collect1 : (Expression Integer,Kernel Expression Integer) -> Expression Integer
Time: 0.05 SEC.
compiling local collect2 : (Expression Integer,Expression Integer,List Equation Expression Integer) -> List Expression Integer
Time: 0.03 SEC.
compiling exported collect : (Expression Integer,Expression Integer) -> List Expression Integer
Time: 0.02 SEC.
(time taken in buildFunctor: 0)
;;; *** |Collect| REDEFINED
;;; *** |Collect| REDEFINED
Time: 0.01 SEC.
Cumulative Statistics for Constructor Collect
Time: 0.11 seconds
finalizing NRLIB COLL
Processing Collect for Browser database:
--->-->Collect(constructor): Not documented!!!!
--->-->Collect((collect ((List (Expression (Integer))) (Expression (Integer)) (Expression (Integer))))): Not documented!!!!
--->-->Collect(): Missing Description
; compiling file "/var/aw/var/LatexWiki/COLL.NRLIB/COLL.lsp" (written 24 SEP 2014 02:27:48 PM):
; /var/aw/var/LatexWiki/COLL.NRLIB/COLL.fasl written
; compilation finished in 0:00:00.022
------------------------------------------------------------------------
Collect is now explicitly exposed in frame initial
Collect will be automatically loaded when needed from
/var/aw/var/LatexWiki/COLL.NRLIB/COLL
fricas
ex:=(r[2]-r[1]+1)^3
Type: Polynomial(Integer)
fricas
t:=collect(ex,r[2]-r[1])
Type: List(Expression(Integer))
fricas
reduce(+,[i::OutputForm for i in t])=(r[2]::OutputForm-r[1]::OutputForm)^3
Type: Equation(OutputForm
?)
fricas
test(reduce(+,t) = ex)
Type: Boolean