/usr/share/axiom-20170501/src/algebra/RCFIELD.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 | )abbrev category RCFIELD RealClosedField
++ Author: Renaud Rioboo
++ Date Created: may 1993
++ Date Last Updated: January 2004
++ Description:
++ \axiomType{RealClosedField} provides common access
++ functions for all real closed fields.
++ provides computations with generic real roots of polynomials
RealClosedField() : Category == SIG where
E ==> OutputForm
SUP ==> SparseUnivariatePolynomial
OFIELD ==> Join(OrderedRing,Field)
PME ==> SUP($)
N ==> NonNegativeInteger
PI ==> PositiveInteger
RN ==> Fraction(Integer)
Z ==> Integer
POLY ==> Polynomial
PACK ==> SparseUnivariatePolynomialFunctions2
CZ ==> CharacteristicZero
OR ==> OrderedRing
CR ==> CommutativeRing
F ==> Field
FRT ==> FullyRetractableTo(Fraction(Integer))
AI ==> Algebra(Integer)
AFI ==> Algebra(Fraction(Integer))
RC ==> RadicalCategory
SIG ==> Join(CZ,OR,CR,F,FRT,AI,AFI,RC) with
mainForm : $ -> Union(E,"failed")
++ \axiom{mainForm(x)} is the main algebraic quantity name of
++ \axiom{x}
mainDefiningPolynomial : $ -> Union(PME,"failed")
++ \axiom{mainDefiningPolynomial(x)} is the defining
++ polynomial for the main algebraic quantity of \axiom{x}
mainValue : $ -> Union(PME,"failed")
++ \axiom{mainValue(x)} is the expression of \axiom{x} in terms
++ of \axiom{SparseUnivariatePolynomial($)}
rootOf : (PME,PI,E) -> Union($,"failed")
++ \axiom{rootOf(pol,n,name)} creates the nth root for the order
++ of \axiom{pol} and names it \axiom{name}
rootOf : (PME,PI) -> Union($,"failed")
++ \axiom{rootOf(pol,n)} creates the nth root for the order
++ of \axiom{pol} and gives it unique name
allRootsOf : PME -> List $
++ \axiom{allRootsOf(pol)} creates all the roots
++ of \axiom{pol} naming each uniquely
allRootsOf : (SUP(RN)) -> List $
++ \axiom{allRootsOf(pol)} creates all the roots
++ of \axiom{pol} naming each uniquely
allRootsOf : (SUP(Z)) -> List $
++ \axiom{allRootsOf(pol)} creates all the roots
++ of \axiom{pol} naming each uniquely
allRootsOf : (POLY($)) -> List $
++ \axiom{allRootsOf(pol)} creates all the roots
++ of \axiom{pol} naming each uniquely
allRootsOf : (POLY(RN)) -> List $
++ \axiom{allRootsOf(pol)} creates all the roots
++ of \axiom{pol} naming each uniquely
allRootsOf : (POLY(Z)) -> List $
++ \axiom{allRootsOf(pol)} creates all the roots
++ of \axiom{pol} naming each uniquely
sqrt : ($,N) -> $
++ \axiom{sqrt(x,n)} is \axiom{x ** (1/n)}
sqrt : $ -> $
++ \axiom{sqrt(x)} is \axiom{x ** (1/2)}
sqrt : RN -> $
++ \axiom{sqrt(x)} is \axiom{x ** (1/2)}
sqrt : Z -> $
++ \axiom{sqrt(x)} is \axiom{x ** (1/2)}
rename! : ($,E) -> $
++ \axiom{rename!(x,name)} changes the way \axiom{x} is printed
rename : ($,E) -> $
++ \axiom{rename(x,name)} gives a new number that prints as name
approximate: ($,$) -> RN
++ \axiom{approximate(n,p)} gives an approximation of \axiom{n}
++ that has precision \axiom{p}
add
sqrt(a:$):$ == sqrt(a,2)
sqrt(a:RN):$ == sqrt(a::$,2)
sqrt(a:Z):$ == sqrt(a::$,2)
characteristic() == 0
rootOf(pol,n,o) ==
r := rootOf(pol,n)
r case "failed" => "failed"
rename!(r,o)
rootOf(pol,n) ==
liste:List($):= allRootsOf(pol)
# liste > n => "failed"
liste.n
sqrt(x,n) ==
n = 0 => 1
n = 1 => x
zero?(x) => 0
one?(x) => 1
if odd?(n)
then
r := rootOf(monomial(1,n) - (x :: PME), 1)
else
r := rootOf(monomial(1,n) - (x :: PME), 2)
r case "failed" => error "no roots"
n = 2 => rename(r,root(x::E)$E)
rename(r,root(x :: E, n :: E)$E)
(x : $) ** (rn : RN) == sqrt(x**numer(rn),denom(rn)::N)
nthRoot(x, n) ==
zero?(n) => x
negative?(n) => inv(sqrt(x,(-n) :: N))
sqrt(x,n :: N)
allRootsOf(p:SUP(RN)) == allRootsOf(map(z +-> z::$ ,p)$PACK(RN,$))
allRootsOf(p:SUP(Z)) == allRootsOf(map(z +-> z::$ ,p)$PACK(Z,$))
allRootsOf(p:POLY($)) == allRootsOf(univariate(p))
allRootsOf(p:POLY(RN)) == allRootsOf(univariate(p))
allRootsOf(p:POLY(Z)) == allRootsOf(univariate(p))
|