/usr/share/axiom-20170501/src/algebra/ACF.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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | )abbrev category ACF AlgebraicallyClosedField
++ Author: Manuel Bronstein
++ Date Created: 22 Mar 1988
++ Date Last Updated: 27 November 1991
++ Description:
++ Model for algebraically closed fields.
AlgebraicallyClosedField() : Category == SIG where
SIG ==> Join(Field,RadicalCategory) with
rootOf : Polynomial $ -> $
++rootOf(p) returns y such that \spad{p(y) = 0}.
++ Error: if p has more than one variable y.
++
++X a:Polynomial(Integer):=-3*x^3+2*x+13
++X rootOf(a)
rootOf : SparseUnivariatePolynomial $ -> $
++rootOf(p) returns y such that \spad{p(y) = 0}.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X rootOf(a)
rootOf : (SparseUnivariatePolynomial $, Symbol) -> $
++rootOf(p, y) returns y such that \spad{p(y) = 0}.
++ The object returned displays as \spad{'y}.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X rootOf(a,x)
rootsOf : Polynomial $ -> List $
++rootsOf(p) returns \spad{[y1,...,yn]} such that \spad{p(yi) = 0}.
++ Note that the returned symbols y1,...,yn are bound in the
++ interpreter to respective root values.
++ Error: if p has more than one variable y.
++
++X a:Polynomial(Integer):=-3*x^3+2*x+13
++X rootsOf(a)
rootsOf : SparseUnivariatePolynomial $ -> List $
++rootsOf(p) returns \spad{[y1,...,yn]} such that \spad{p(yi) = 0}.
++ Note that the returned symbols y1,...,yn are bound in the interpreter
++ to respective root values.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X rootsOf(a)
rootsOf : (SparseUnivariatePolynomial $, Symbol) -> List $
++rootsOf(p, y) returns \spad{[y1,...,yn]} such that \spad{p(yi) = 0};
++ The returned roots display as \spad{'y1},...,\spad{'yn}.
++ Note that the returned symbols y1,...,yn are bound in the interpreter
++ to respective root values.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X rootsOf(a,x)
zeroOf : Polynomial $ -> $
++zeroOf(p) returns y such that \spad{p(y) = 0}.
++ If possible, y is expressed in terms of radicals.
++ Otherwise it is an implicit algebraic quantity.
++ Error: if p has more than one variable y.
++
++X a:Polynomial(Integer):=-3*x^2+2*x-13
++X zeroOf(a)
zeroOf : SparseUnivariatePolynomial $ -> $
++zeroOf(p) returns y such that \spad{p(y) = 0};
++ if possible, y is expressed in terms of radicals.
++ Otherwise it is an implicit algebraic quantity.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X zeroOf(a)
zeroOf : (SparseUnivariatePolynomial $, Symbol) -> $
++zeroOf(p, y) returns y such that \spad{p(y) = 0};
++ if possible, y is expressed in terms of radicals.
++ Otherwise it is an implicit algebraic quantity which
++ displays as \spad{'y}.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X zeroOf(a,x)
zerosOf : Polynomial $ -> List $
++zerosOf(p) returns \spad{[y1,...,yn]} such that \spad{p(yi) = 0}.
++ The yi's are expressed in radicals if possible.
++ Otherwise they are implicit algebraic quantities.
++ The returned symbols y1,...,yn are bound in the interpreter
++ to respective root values.
++ Error: if p has more than one variable y.
++
++X a:Polynomial(Integer):=-3*x^2+2*x-13
++X zerosOf(a)
zerosOf : SparseUnivariatePolynomial $ -> List $
++zerosOf(p) returns \spad{[y1,...,yn]} such that \spad{p(yi) = 0}.
++ The yi's are expressed in radicals if possible, and otherwise
++ as implicit algebraic quantities.
++ The returned symbols y1,...,yn are bound in the interpreter
++ to respective root values.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X zerosOf(a)
zerosOf : (SparseUnivariatePolynomial $, Symbol) -> List $
++zerosOf(p, y) returns \spad{[y1,...,yn]} such that \spad{p(yi) = 0}.
++ The yi's are expressed in radicals if possible, and otherwise
++ as implicit algebraic quantities
++ which display as \spad{'yi}.
++ The returned symbols y1,...,yn are bound in the interpreter
++ to respective root values.
++
++X a:SparseUnivariatePolynomial(Integer):=-3*x^3+2*x+13
++X zerosOf(a,x)
add
SUP ==> SparseUnivariatePolynomial $
assign : (Symbol, $) -> $
allroots: (SUP, Symbol, (SUP, Symbol) -> $) -> List $
binomialRoots: (SUP, Symbol, (SUP, Symbol) -> $) -> List $
zeroOf(p:SUP) == assign(x := new(), zeroOf(p, x))
rootOf(p:SUP) == assign(x := new(), rootOf(p, x))
zerosOf(p:SUP) == zerosOf(p, new())
rootsOf(p:SUP) == rootsOf(p, new())
rootsOf(p:SUP, y:Symbol) == allroots(p, y, rootOf)
zerosOf(p:SUP, y:Symbol) == allroots(p, y, zeroOf)
assign(x, f) == (assignSymbol(x, f, $)$Lisp; f)
zeroOf(p:Polynomial $) ==
empty?(l := variables p) => error "zeroOf: constant polynomial"
zeroOf(univariate p, first l)
rootOf(p:Polynomial $) ==
empty?(l := variables p) => error "rootOf: constant polynomial"
rootOf(univariate p, first l)
zerosOf(p:Polynomial $) ==
empty?(l := variables p) => error "zerosOf: constant polynomial"
zerosOf(univariate p, first l)
rootsOf(p:Polynomial $) ==
empty?(l := variables p) => error "rootsOf: constant polynomial"
rootsOf(univariate p, first l)
zeroOf(p:SUP, y:Symbol) ==
zero?(d := degree p) => error "zeroOf: constant polynomial"
zero? coefficient(p, 0) => 0
a := leadingCoefficient p
d = 2 =>
b := coefficient(p, 1)
(sqrt(b**2 - 4 * a * coefficient(p, 0)) - b) / (2 * a)
(r := retractIfCan(reductum p)@Union($,"failed")) case "failed" =>
rootOf(p, y)
nthRoot(- (r::$ / a), d)
binomialRoots(p, y, fn) ==
alpha := assign(x := new(y)$Symbol, fn(p, x))
((n := degree p) = 1) => [ alpha ]
cyclo := cyclotomic(n,monomial(1,1)$SUP)_
$NumberTheoreticPolynomialFunctions(SUP)
beta := assign(x := new(y)$Symbol, fn(cyclo, x))
[alpha*beta**i for i in 0..(n-1)::NonNegativeInteger]
import PolynomialDecomposition(SUP,$)
allroots(p, y, fn) ==
zero? p => error "allroots: polynomial must be nonzero"
zero? coefficient(p,0) =>
concat(0, allroots(p quo monomial(1,1), y, fn))
zero?(p1:=reductum p) => empty()
zero? reductum p1 => binomialRoots(p, y, fn)
decompList := decompose(p)
# decompList > 1 =>
h := last decompList
g := leftFactor(p,h) :: SUP
groots := allroots(g, y, fn)
"append"/[allroots(h-r::SUP, y, fn) for r in groots]
ans := nil()$List($)
while not ground? p repeat
alpha := assign(x := new(y)$Symbol, fn(p, x))
q := monomial(1, 1)$SUP - alpha::SUP
if not zero?(p alpha) then
p := p quo q
ans := concat(alpha, ans)
else while zero?(p alpha) repeat
p := (p exquo q)::SUP
ans := concat(alpha, ans)
reverse_! ans
|