/usr/share/axiom-20170501/src/algebra/FRUTIL.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | )abbrev package FRUTIL FactoredFunctionUtilities
++ Description:
++ \spadtype{FactoredFunctionUtilities} implements some utility
++ functions for manipulating factored objects.
FactoredFunctionUtilities(R) : SIG == CODE where
R : IntegralDomain
FR ==> Factored R
SIG ==> with
refine : (FR, R-> FR) -> FR
++ refine(u,fn) is used to apply the function \userfun{fn} to
++ each factor of \spadvar{u} and then build a new factored
++ object from the results. For example, if \spadvar{u} were
++ created by calling \spad{nilFactor(10,2)} then
++ \spad{refine(u,factor)} would create a factored object equal
++ to that created by \spad{factor(100)} or
++ \spad{primeFactor(2,2) * primeFactor(5,2)}.
mergeFactors : (FR,FR) -> FR
++ mergeFactors(u,v) is used when the factorizations of \spadvar{u}
++ and \spadvar{v} are known to be disjoint, for example, resulting
++ from a content/primitive part split. Essentially, it creates a new
++ factored object by multiplying the units together and appending
++ the lists of factors.
CODE ==> add
fg: FR
func: R -> FR
fUnion ==> Union("nil", "sqfr", "irred", "prime")
FF ==> Record(flg: fUnion, fctr: R, xpnt: Integer)
mergeFactors(f,g) ==
makeFR(unit(f)*unit(g),append(factorList f,factorList g))
refine(f, func) ==
u := unit(f)
l: List FF := empty()
for item in factorList f repeat
fitem := func item.fctr
u := u*unit(fitem) ** (item.xpnt :: NonNegativeInteger)
if item.xpnt = 1 then
l := concat(factorList fitem,l)
else l := concat([[v.flg,v.fctr,v.xpnt*item.xpnt]
for v in factorList fitem],l)
makeFR(u,l)
|