On 02/28/2012 06:24 PM, Serge D. Mechveliani wrote:
For f := (x^2 - 1) :: UP(x,INT)
factor f
yields
(12) (x - 1)(x + 1)
Type: Factored(UnivariatePolynomial(x,Integer)),
and prime?(f) $UP(x,INT)
That's funny. HyperDoc (and the code) says that factor only exists if
the coefficient domain has PolynomialFactorizationExplicit. One can
easily check that *no* domain in FriCAS exports this category
unconditionally. Strange that FriCAS finds a factorization routine at all.
That the compiler cannot factor is then no surprise, but how to find out
what the interpreter actually did?
Aha!
(1) -> )set message selection on
(1) -> factor f
Function Selection for factor
Arguments: UP(x,INT)
[1] signature: UP(x,INT) -> FR(UP(x,INT))
implemented: slot (Factored (UnivariatePolynomial x
(Integer)))(UnivariatePolynomial x (Integer)) from
MULTFACT(SAOS,NNI,INT,UP(x,INT))
[2] signature: SUP(UP(x,INT)) -> FR(SUP(UP(x,INT)))
implemented: slot (Factored (SparseUnivariatePolynomial
(UnivariatePolynomial x (Integer))))(SparseUnivariatePolynomial
(UnivariatePolynomial x (Integer))) from MULTFACT(SAOS,NNI,INT,UP(x,INT))
(1) (x - 1)(x + 1)
Type:
Factored(UnivariatePolynomial(x,Integer))
Looking at MULTFACT reveals that this only applies to very special
situation.
https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/multfact.spad.pamphlet#L465
(copy attached)
It's quite interesting how much special code is hidden in the
interpreter so that a function of this package can be called. :-(
Lot's of work ahead.
Ralf
==============================================================
MultivariateFactorize(OV,E,R,P) : C == T
where
R : Join(EuclideanDomain, CharacteristicZero)
-- with factor on R[x]
OV : OrderedSet
E : OrderedAbelianMonoidSup
P : PolynomialCategory(R,E,OV)
Z ==> Integer
MParFact ==> Record(irr:P,pow:Z)
USP ==> SparseUnivariatePolynomial P
SUParFact ==> Record(irr:USP,pow:Z)
SUPFinalFact ==> Record(contp:R,factors:List SUParFact)
MFinalFact ==> Record(contp:R,factors:List MParFact)
-- contp = content,
-- factors = List of irreducible factors with exponent
L ==> List
C == with
factor : P -> Factored P
++ factor(p) factors the multivariate polynomial p over its
coefficient
++ domain
factor : USP -> Factored USP
++ factor(p) factors the multivariate polynomial p over its
coefficient
++ domain where p is represented as a univariate polynomial with
++ multivariate coefficients
T == add
factor(p:P) : Factored P ==
R is Fraction Integer =>
factor(p)$MRationalFactorize(E,OV,Integer,P)
R is Fraction Complex Integer =>
factor(p)$MRationalFactorize(E,OV,Complex Integer,P)
R is Fraction Polynomial Integer and OV has convert: % -> Symbol =>
factor(p)$MPolyCatRationalFunctionFactorizer(E,OV,Integer,P)
factor(p,factor$GenUFactorize(R))$InnerMultFact(OV,E,R,P)
factor(up:USP) : Factored USP ==
factor(up,factor$GenUFactorize(R))$InnerMultFact(OV,E,R,P)
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.