This file is indexed.

/usr/share/axiom-20170501/src/algebra/NLINSOL.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
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
)abbrev package NLINSOL NonLinearSolvePackage
++ Author: Manuel Bronstein
++ Date Created: 31 October 1991
++ Date Last Updated: 26 June 1992
++ Description:
++ NonLinearSolvePackage is an interface to \spadtype{SystemSolvePackage}
++ that attempts to retract the coefficients of the equations before
++ solving. The solutions are given in the algebraic closure of R whenever
++ possible.

NonLinearSolvePackage(R) : SIG == CODE where
  R : IntegralDomain

  Z   ==> Integer
  Q   ==> Fraction Z
  SY  ==> Symbol
  P   ==> Polynomial R
  F   ==> Fraction P
  EQ  ==> Equation F
  SSP ==> SystemSolvePackage
  SOL ==> RetractSolvePackage

  SIG ==> with

    solveInField : (List P, List SY) -> List List EQ
      ++ solveInField(lp,lv) finds the solutions of the list lp of
      ++ rational functions with respect to the list of symbols lv.

    solveInField : List P -> List List EQ
      ++ solveInField(lp) finds the solution of the list lp of rational
      ++ functions with respect to all the symbols appearing in lp.

    solve : (List P, List SY) -> List List EQ
      ++ solve(lp,lv) finds the solutions in the algebraic closure of R
      ++ of the list lp of
      ++ rational functions with respect to the list of symbols lv.

    solve : List P -> List List EQ
      ++ solve(lp) finds the solution in the algebraic closure of R
      ++ of the list lp of rational
      ++ functions with respect to all the symbols appearing in lp.

  CODE ==> add

    solveInField l == solveInField(l, "setUnion"/[variables p for p in l])

    if R has AlgebraicallyClosedField then
      import RationalFunction(R)

      expandSol: List EQ -> List List EQ
      RIfCan   : F -> Union(R, "failed")
      addRoot  : (EQ, List List EQ) -> List List EQ
      allRoots : List P -> List List EQ
      evalSol  : (List EQ, List EQ) -> List EQ

      solve l        == solve(l, "setUnion"/[variables p for p in l])

      solve(lp, lv)  == concat([expandSol sol for sol in solveInField(lp, lv)])

      addRoot(eq, l) == [concat(eq, sol) for sol in l]

      evalSol(ls, l) == [equation(lhs eq, eval(rhs eq, l)) for eq in ls]

      -- converts [p1(a1),...,pn(an)] to
      -- [[a1=v1,...,an=vn]] where vi ranges over all the zeros of pi
      allRoots l ==
        empty? l => [empty()$List(EQ)]
        z := allRoots rest l
        s := mainVariable(p := first l)::SY::P::F
        concat [addRoot(equation(s, a::P::F), z) for a in zerosOf univariate p]

      expandSol l ==
        lassign := lsubs := empty()$List(EQ)
        luniv := empty()$List(P)
        for eq in l repeat
          if retractIfCan(lhs eq)@Union(SY, "failed") case SY then
            if RIfCan(rhs eq) case R then lassign := concat(eq, lassign)
                                     else lsubs := concat(eq, lsubs)
          else
            if ((u := retractIfCan(lhs eq)@Union(P, "failed")) case P) and
               ((# variables(u::P)) = 1) and ((r := RIfCan rhs eq) case R) then
                 luniv := concat(u::P - r::R::P, luniv)
            else return [l]
        empty? luniv => [l]
        [concat(z, concat(evalSol(lsubs,z), lassign)) for z in allRoots luniv]

      RIfCan f ==
        ((n := retractIfCan(numer f)@Union(R,"failed")) case R) and
          ((d:= retractIfCan(denom f)@Union(R,"failed")) case R) => n::R / d::R
        "failed"

    else

      solve l       == solveInField l

      solve(lp, lv) == solveInField(lp, lv)

     -- 'else if' is doubtful with this compiler; all 3 conditions are explicit
    if (not(R is Q)) and (R has RetractableTo Q) then

      solveInField(lp, lv) == solveRetract(lp, lv)$SOL(Q, R)

    if (not(R is Z)) and (not(R has RetractableTo Q)) and
      (R has RetractableTo Z) then

        solveInField(lp, lv) == solveRetract(lp, lv)$SOL(Z, R)

    if (not(R is Z)) and (not(R has RetractableTo Q)) and
      (not(R has RetractableTo Z)) then

        solveInField(lp, lv) == solve([p::F for p in lp]$List(F), lv)$SSP(R)