/usr/share/axiom-20170501/src/algebra/LPEFRAC.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 50 51 | )abbrev package LPEFRAC LinearPolynomialEquationByFractions
++ Author: James Davenport
++ Description:
++ Given a PolynomialFactorizationExplicit ring, this package
++ provides a defaulting rule for the \spad{solveLinearPolynomialEquation}
++ operation, by moving into the field of fractions, and solving it there
++ via the \spad{multiEuclidean} operation.
LinearPolynomialEquationByFractions(R) : SIG == CODE where
R : PolynomialFactorizationExplicit
SIG ==> with
solveLinearPolynomialEquationByFractions: ( _
List SparseUnivariatePolynomial R, _
SparseUnivariatePolynomial R) -> _
Union(List SparseUnivariatePolynomial R, "failed")
++ solveLinearPolynomialEquationByFractions([f1, ..., fn], g)
++ (where the fi are relatively prime to each other)
++ returns a list of ai such that
++ \spad{g/prod fi = sum ai/fi}
++ or returns "failed" if no such exists.
CODE ==> add
SupR ==> SparseUnivariatePolynomial R
F ==> Fraction R
SupF ==> SparseUnivariatePolynomial F
import UnivariatePolynomialCategoryFunctions2(R,SupR,F,SupF)
lp : List SupR
pp: SupR
pF: SupF
pullback : SupF -> Union(SupR,"failed")
pullback(pF) ==
pF = 0 => 0
c:=retractIfCan leadingCoefficient pF
c case "failed" => "failed"
r:=pullback reductum pF
r case "failed" => "failed"
monomial(c,degree pF) + r
solveLinearPolynomialEquationByFractions(lp,pp) ==
lpF:List SupF:=[map((x:R):F +-> x@R::F,u) for u in lp]
pF:SupF:=map((x:R):F +-> x::F,pp)
ans:= solveLinearPolynomialEquation(lpF,pF)$F
ans case "failed" => "failed"
[(vv:= pullback v;
vv case "failed" => return "failed";
vv)
for v in ans]
|