/usr/share/axiom-20170501/src/algebra/INTSLPE.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 | )abbrev package INTSLPE IntegerSolveLinearPolynomialEquation
++ Author: Davenport
++ Date Created: 1991
++ Description:
++ This package provides the implementation for the
++ \spadfun{solveLinearPolynomialEquation}
++ operation over the integers. It uses a lifting technique
++ from the package GenExEuclid
IntegerSolveLinearPolynomialEquation() : SIG == CODE where
ZP ==> SparseUnivariatePolynomial Integer
SIG ==> with
solveLinearPolynomialEquation : (List ZP,ZP) -> Union(List ZP,"failed")
++ solveLinearPolynomialEquation([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 list of ai's exists.
CODE ==> add
oldlp:List ZP := []
slpePrime:Integer:=(2::Integer)
oldtable:Vector List ZP := empty()
solveLinearPolynomialEquation(lp,p) ==
if (oldlp ^= lp) then
-- we have to generate a new table
deg:= _+/[degree u for u in lp]
ans:Union(Vector List ZP,"failed"):="failed"
slpePrime:=2147483647::Integer -- 2**31 -1 : a prime
-- a good test case for this package is
-- ([x**31-1,x-2],2)
while (ans case "failed") repeat
ans:=tablePow(deg,slpePrime,lp)$GenExEuclid(Integer,ZP)
if (ans case "failed") then
slpePrime:= prevPrime(slpePrime)$IntegerPrimesPackage(Integer)
oldtable:=(ans:: Vector List ZP)
answer:=solveid(p,slpePrime,oldtable)
answer
|