/usr/share/axiom-20170501/src/algebra/RNS.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 | )abbrev category RNS RealNumberSystem
++ Author: Michael Monagan and Stephen M. Watt
++ Date Created: January 1988
++ Description:
++ The real number system category is intended as a model for the real
++ numbers. The real numbers form an ordered normed field. Note that
++ we have purposely not included \spadtype{DifferentialRing} or
++ the elementary functions (see \spadtype{TranscendentalFunctionCategory})
++ in the definition.
RealNumberSystem() : Category == SIG where
F ==> Field
OR ==> OrderedRing
RC ==> RealConstant
RI ==> RetractableTo(Integer)
RFI ==> RetractableTo(Fraction(Integer))
RAC ==> RadicalCategory
CPF ==> ConvertibleTo(Pattern(Float))
PM ==> PatternMatchable(Float)
CZ ==> CharacteristicZero
SIG ==> Join(F,OR,RC,RI,RFI,RAC,CPF,PM,CZ) with
norm : % -> %
++ norm x returns the same as absolute value.
ceiling : % -> %
++ ceiling x returns the small integer \spad{>= x}.
floor : % -> %
++ floor x returns the largest integer \spad{<= x}.
wholePart : % -> Integer
++ wholePart x returns the integer part of x.
fractionPart : % -> %
++ fractionPart x returns the fractional part of x.
truncate : % -> %
++ truncate x returns the integer between x and 0 closest to x.
round : % -> %
++ round x computes the integer closest to x.
abs : % -> %
++ abs x returns the absolute value of x.
add
characteristic() == 0
fractionPart x == x - truncate x
truncate x == (negative? x => -floor(-x); floor x)
round x == (negative? x => truncate(x-1/2::%); truncate(x+1/2::%))
norm x == abs x
coerce(x:Fraction Integer):% == numer(x)::% / denom(x)::%
convert(x:%):Pattern(Float) == convert(x)@Float :: Pattern(Float)
floor x ==
x1 := (wholePart x) :: %
x = x1 => x
x < 0 => (x1 - 1)
x1
ceiling x ==
x1 := (wholePart x)::%
x = x1 => x
x >= 0 => (x1 + 1)
x1
patternMatch(x, p, l) ==
generic? p => addMatch(p, x, l)
constant? p =>
(r := retractIfCan(p)@Union(Float, "failed")) case Float =>
convert(x)@Float = r::Float => l
failed()
failed()
failed()
|