/usr/share/axiom-20170501/src/algebra/RETSOL.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 52 53 54 55 56 57 58 59 60 61 62 63 64 | )abbrev package RETSOL RetractSolvePackage
++ Author: Manuel Bronstein
++ Date Created: 31 October 1991
++ Date Last Updated: 31 October 1991
++ Description:
++ RetractSolvePackage is an interface to \spadtype{SystemSolvePackage}
++ that attempts to retract the coefficients of the equations before
++ solving.
RetractSolvePackage(Q, R) : SIG == CODE where
Q : IntegralDomain
R : Join(IntegralDomain, RetractableTo Q)
PQ ==> Polynomial Q
FQ ==> Fraction PQ
SY ==> Symbol
P ==> Polynomial R
F ==> Fraction P
EQ ==> Equation
SSP ==> SystemSolvePackage
SIG ==> with
solveRetract : (List P, List SY) -> List List EQ F
++ solveRetract(lp,lv) finds the solutions of the list lp of
++ rational functions with respect to the list of symbols lv.
++ The function tries to retract all the coefficients of the equations
++ to Q before solving if possible.
CODE ==> add
LEQQ2F : List EQ FQ -> List EQ F
FQ2F : FQ -> F
PQ2P : PQ -> P
QIfCan : List P -> Union(List FQ, "failed")
PQIfCan: P -> Union(FQ, "failed")
PQ2P p == map((q1:Q):R +-> q1::R, p)$PolynomialFunctions2(Q, R)
FQ2F f == PQ2P numer f / PQ2P denom f
LEQQ2F l == [equation(FQ2F lhs eq, FQ2F rhs eq) for eq in l]
solveRetract(lp, lv) ==
(u := QIfCan lp) case "failed" =>
solve([p::F for p in lp]$List(F), lv)$SSP(R)
[LEQQ2F l for l in solve(u::List(FQ), lv)$SSP(Q)]
QIfCan l ==
ans:List(FQ) := empty()
for p in l repeat
(u := PQIfCan p) case "failed" => return "failed"
ans := concat(u::FQ, ans)
ans
PQIfCan p ==
(u := mainVariable p) case "failed" =>
(r := retractIfCan(ground p)@Union(Q,"failed")) case Q => r::Q::PQ::FQ
"failed"
up := univariate(p, s := u::SY)
ans:FQ := 0
while up ^= 0 repeat
(v := PQIfCan leadingCoefficient up) case "failed" => return "failed"
ans := ans + monomial(1, s, degree up)$PQ * (v::FQ)
up := reductum up
ans
|