/usr/share/axiom-20170501/src/algebra/CDEN.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 | )abbrev package CDEN CommonDenominator
++ Author: Manuel Bronstein
++ Date Created: 2 May 1988
++ Date Last Updated: 22 Nov 1989
++ Description:
++ CommonDenominator provides functions to compute the
++ common denominator of a finite linear aggregate of elements of
++ the quotient field of an integral domain.
CommonDenominator(R, Q, A) : SIG == CODE where
R : IntegralDomain
Q : QuotientFieldCategory R
A : FiniteLinearAggregate Q
SIG ==> with
commonDenominator : A -> R
++ commonDenominator([q1,...,qn]) returns a common denominator
++ d for q1,...,qn.
clearDenominator : A -> A
++ clearDenominator([q1,...,qn]) returns \spad{[p1,...,pn]} such that
++ \spad{qi = pi/d} where d is a common denominator for the qi's.
splitDenominator : A -> Record(num: A, den: R)
++ splitDenominator([q1,...,qn]) returns
++ \spad{[[p1,...,pn], d]} such that
++ \spad{qi = pi/d} and d is a common denominator for the qi's.
CODE ==> add
clearDenominator l ==
d := commonDenominator l
map(x+->numer(d*x)::Q, l)
splitDenominator l ==
d := commonDenominator l
[map(x+->numer(d*x)::Q, l), d]
if R has GcdDomain then
qlcm: (Q, Q) -> Q
qlcm(a, b) == lcm(numer a, numer b)::Q
commonDenominator l == numer reduce(qlcm, map(x+->denom(x)::Q, l), 1)
else
commonDenominator l == numer reduce("*", map(x+->denom(x)::Q, l), 1)
|