Factored(R)

fr.spad line 1 [edit on github]

Factored creates a domain whose objects are kept in factored form as long as possible. Thus certain operations like multiplication and gcd are relatively easy to do. Others, like addition require somewhat more work, and unless the argument domain provides a factor function, the result may not be completely factored. Each object consists of a unit and a list of factors, where a factor has a member of R (the "base"), and exponent and a flag indicating what is known about the base. A flag may be one of "nil", "sqfr", "irred" or "prime", which respectively mean that nothing is known about the base, it is square-free, it is irreducible, or it is prime. The current restriction to integral domains allows simplification to be performed without worrying about multiplication order.

* : (%, %) -> %
from Magma
* : (%, R) -> %
from RightModule(R)
* : (R, %) -> %
from LeftModule(R)
* : (Integer, %) -> %
from AbelianGroup
* : (NonNegativeInteger, %) -> %
from AbelianMonoid
* : (PositiveInteger, %) -> %
from AbelianSemiGroup
+ : (%, %) -> %
from AbelianSemiGroup
- : % -> %
from AbelianGroup
- : (%, %) -> %
from AbelianGroup
0 : () -> %
from AbelianMonoid
1 : () -> %
from MagmaWithUnit
= : (%, %) -> Boolean
from BasicType
D : % -> % if R has DifferentialRing
from DifferentialRing
D : (%, List(Symbol)) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
D : (%, List(Symbol), List(NonNegativeInteger)) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
D : (%, Mapping(R, R)) -> %
from DifferentialExtension(R)
D : (%, Mapping(R, R), NonNegativeInteger) -> %
from DifferentialExtension(R)
D : (%, NonNegativeInteger) -> % if R has DifferentialRing
from DifferentialRing
D : (%, Symbol) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
D : (%, Symbol, NonNegativeInteger) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
^ : (%, NonNegativeInteger) -> %
from MagmaWithUnit
^ : (%, PositiveInteger) -> %
from Magma
annihilate? : (%, %) -> Boolean
from Rng
antiCommutator : (%, %) -> %
from NonAssociativeSemiRng
associates? : (%, %) -> Boolean
from EntireRing
associator : (%, %, %) -> %
from NonAssociativeRng
characteristic : () -> NonNegativeInteger
from NonAssociativeRing
coerce : % -> %
from Algebra(%)
coerce : R -> %
from Algebra(R)
coerce : Fraction(Integer) -> % if R has RetractableTo(Fraction(Integer))
from CoercibleFrom(Fraction(Integer))
coerce : Integer -> %
from NonAssociativeRing
coerce : % -> OutputForm
from CoercibleTo(OutputForm)
commutator : (%, %) -> %
from NonAssociativeRng
convert : % -> DoubleFloat if R has RealConstant
from ConvertibleTo(DoubleFloat)
convert : % -> Float if R has RealConstant
from ConvertibleTo(Float)
convert : % -> InputForm if R has ConvertibleTo(InputForm)
from ConvertibleTo(InputForm)
differentiate : % -> % if R has DifferentialRing
from DifferentialRing
differentiate : (%, List(Symbol)) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
differentiate : (%, List(Symbol), List(NonNegativeInteger)) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
differentiate : (%, Mapping(R, R)) -> %
from DifferentialExtension(R)
differentiate : (%, Mapping(R, R), NonNegativeInteger) -> %
from DifferentialExtension(R)
differentiate : (%, NonNegativeInteger) -> % if R has DifferentialRing
from DifferentialRing
differentiate : (%, Symbol) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
differentiate : (%, Symbol, NonNegativeInteger) -> % if R has PartialDifferentialRing(Symbol)
from PartialDifferentialRing(Symbol)
elt : (%, %) -> % if R has Eltable(%, %)
from Eltable(%, %)
elt : (%, R) -> % if R has Eltable(R, R)
from Eltable(R, %)
eval : (%, %, %) -> % if R has Evalable(%)
from InnerEvalable(%, %)
eval : (%, R, R) -> % if R has Evalable(R)
from InnerEvalable(R, R)
eval : (%, Equation(%)) -> % if R has Evalable(%)
from Evalable(%)
eval : (%, Equation(R)) -> % if R has Evalable(R)
from Evalable(R)
eval : (%, List(%), List(%)) -> % if R has Evalable(%)
from InnerEvalable(%, %)
eval : (%, List(R), List(R)) -> % if R has Evalable(R)
from InnerEvalable(R, R)
eval : (%, List(Equation(%))) -> % if R has Evalable(%)
from Evalable(%)
eval : (%, List(Equation(R))) -> % if R has Evalable(R)
from Evalable(R)
eval : (%, List(Symbol), List(%)) -> % if R has InnerEvalable(Symbol, %)
from InnerEvalable(Symbol, %)
eval : (%, List(Symbol), List(R)) -> % if R has InnerEvalable(Symbol, R)
from InnerEvalable(Symbol, R)
eval : (%, Symbol, %) -> % if R has InnerEvalable(Symbol, %)
from InnerEvalable(Symbol, %)
eval : (%, Symbol, R) -> % if R has InnerEvalable(Symbol, R)
from InnerEvalable(Symbol, R)
expand : % -> R

expand(f) multiplies the unit and factors together, yielding an "unfactored" object. Note: this is purposely not called coerce which would cause the interpreter to do this automatically.

exquo : (%, %) -> Union(%, "failed")
from EntireRing
factor : % -> Factored(%) if R has UniqueFactorizationDomain
from UniqueFactorizationDomain
factorList : % -> List(Record(flag : Union("nil", "sqfr", "irred", "prime"), factor : R, exponent : NonNegativeInteger))

factorList(u) returns the list of factors with flags (for use by factoring code).

factors : % -> List(Record(factor : R, exponent : NonNegativeInteger))

factors(u) returns a list of the factors in a form suitable for iteration. That is, it returns a list where each element is a record containing a base and exponent. The original object is the product of all the factors and the unit (which can be extracted by unit(u)).

flagFactor : (R, NonNegativeInteger, Union("nil", "sqfr", "irred", "prime")) -> %

flagFactor(base, exponent, flag) creates a factored object with a single factor whose base is asserted to be properly described by the information flag.

gcd : (%, %) -> % if R has GcdDomain
from GcdDomain
gcd : List(%) -> % if R has GcdDomain
from GcdDomain
gcdPolynomial : (SparseUnivariatePolynomial(%), SparseUnivariatePolynomial(%)) -> SparseUnivariatePolynomial(%) if R has GcdDomain
from GcdDomain
irreducibleFactor : (R, NonNegativeInteger) -> %

irreducibleFactor(base, exponent) creates a factored object with a single factor whose base is asserted to be irreducible (flag = "irred").

latex : % -> String
from SetCategory
lcm : (%, %) -> % if R has GcdDomain
from GcdDomain
lcm : List(%) -> % if R has GcdDomain
from GcdDomain
lcmCoef : (%, %) -> Record(llcm_res : %, coeff1 : %, coeff2 : %) if R has GcdDomain
from LeftOreRing
leftPower : (%, NonNegativeInteger) -> %
from MagmaWithUnit
leftPower : (%, PositiveInteger) -> %
from Magma
leftRecip : % -> Union(%, "failed")
from MagmaWithUnit
makeFR : (R, List(Record(flag : Union("nil", "sqfr", "irred", "prime"), factor : R, exponent : NonNegativeInteger))) -> %

makeFR(unit, listOfFactors) creates a factored object (for use by factoring code).

map : (Mapping(R, R), %) -> %

map(fn, u) maps the function fn across the factors of u and creates a new factored object. Note: this clears the information flags (sets them to "nil") because the effect of fn is clearly not known in general.

mergeFactors : (%, %) -> %

mergeFactors(u, v) is used when the factorizations of u and v are known to be disjoint, e.g. 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.

nilFactor : (R, NonNegativeInteger) -> %

nilFactor(base, exponent) creates a factored object with a single factor with no information about the kind of base (flag = "nil").

numberOfFactors : % -> NonNegativeInteger

numberOfFactors(u) returns the number of factors in u.

one? : % -> Boolean
from MagmaWithUnit
opposite? : (%, %) -> Boolean
from AbelianMonoid
plenaryPower : (%, PositiveInteger) -> %
from NonAssociativeAlgebra(R)
prime? : % -> Boolean if R has UniqueFactorizationDomain
from UniqueFactorizationDomain
primeFactor : (R, NonNegativeInteger) -> %

primeFactor(base, exponent) creates a factored object with a single factor whose base is asserted to be prime (flag = "prime").

rational : % -> Fraction(Integer) if R has IntegerNumberSystem

rational(u) assumes spadvaru is actually a rational number and does the conversion to rational number (see Fraction Integer).

rational? : % -> Boolean if R has IntegerNumberSystem

rational?(u) tests if u is actually a rational number (see Fraction Integer).

rationalIfCan : % -> Union(Fraction(Integer), "failed") if R has IntegerNumberSystem

rationalIfCan(u) returns a rational number if u really is one, and "failed" otherwise.

recip : % -> Union(%, "failed")
from MagmaWithUnit
retract : % -> R
from RetractableTo(R)
retract : % -> Fraction(Integer) if R has RetractableTo(Fraction(Integer))
from RetractableTo(Fraction(Integer))
retract : % -> Integer if R has RetractableTo(Integer)
from RetractableTo(Integer)
retractIfCan : % -> Union(R, "failed")
from RetractableTo(R)
retractIfCan : % -> Union(Fraction(Integer), "failed") if R has RetractableTo(Fraction(Integer))
from RetractableTo(Fraction(Integer))
retractIfCan : % -> Union(Integer, "failed") if R has RetractableTo(Integer)
from RetractableTo(Integer)
rightPower : (%, NonNegativeInteger) -> %
from MagmaWithUnit
rightPower : (%, PositiveInteger) -> %
from Magma
rightRecip : % -> Union(%, "failed")
from MagmaWithUnit
sample : () -> %
from AbelianMonoid
sqfrFactor : (R, NonNegativeInteger) -> %

sqfrFactor(base, exponent) creates a factored object with a single factor whose base is asserted to be square-free (flag = "sqfr").

squareFree : % -> Factored(%) if R has UniqueFactorizationDomain
from UniqueFactorizationDomain
squareFreePart : % -> % if R has UniqueFactorizationDomain
from UniqueFactorizationDomain
subtractIfCan : (%, %) -> Union(%, "failed")
from CancellationAbelianMonoid
unit : % -> R

unit(u) extracts the unit part of the factorization.

unit? : % -> Boolean
from EntireRing
unitCanonical : % -> %
from EntireRing
unitNormal : % -> Record(unit : %, canonical : %, associate : %)
from EntireRing
unitNormalize : % -> %

unitNormalize(u) normalizes the unit part of the factorization. For example, when working with factored integers, this operation will ensure that the bases are all positive integers.

zero? : % -> Boolean
from AbelianMonoid
~= : (%, %) -> Boolean
from BasicType

Eltable(R, %)

ConvertibleTo(Float)

NonAssociativeSemiRing

LeftModule(R)

Evalable(R)

ConvertibleTo(InputForm)

Rng

CoercibleFrom(Integer)

TwoSidedRecip

FullyRetractableTo(R)

SemiRing

EntireRing

unitsKnown

Algebra(R)

noZeroDivisors

RetractableTo(Fraction(Integer))

CoercibleFrom(R)

UniqueFactorizationDomain

InnerEvalable(%, %)

SemiGroup

Magma

RightModule(R)

GcdDomain

IntegralDomain

LeftModule(%)

NonAssociativeRing

PartialDifferentialRing(Symbol)

Module(R)

BiModule(%, %)

Algebra(%)

DifferentialRing

BiModule(R, R)

CommutativeRing

Eltable(%, %)

InnerEvalable(R, R)

NonAssociativeSemiRng

CancellationAbelianMonoid

RetractableTo(Integer)

CommutativeStar

AbelianMonoid

MagmaWithUnit

RightModule(%)

RealConstant

ConvertibleTo(DoubleFloat)

Module(%)

CoercibleTo(OutputForm)

DifferentialExtension(R)

FullyEvalableOver(R)

InnerEvalable(Symbol, R)

SemiRng

Monoid

NonAssociativeAlgebra(R)

LeftOreRing

NonAssociativeAlgebra(%)

BasicType

InnerEvalable(Symbol, %)

Ring

AbelianSemiGroup

SetCategory

CoercibleFrom(Fraction(Integer))

NonAssociativeRng

Evalable(%)

RetractableTo(R)

AbelianGroup