% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\FractionXmpTitle}{Fraction}
\newcommand{\FractionXmpNumber}{9.28}
%
% =====================================================================
\begin{page}{FractionXmpPage}{9.28 Fraction}
% =====================================================================
\beginscroll

%
%
%
%
%


%

The \spadtype{Fraction} domain implements quotients.
%-% \HDindex{fraction}{FractionXmpPage}{9.28}{Fraction}
The elements must belong to a domain of category \spadtype{IntegralDomain}:
multiplication must be commutative and the product of two non-zero
elements must not be zero.
This allows you to make fractions of most things you would think of,
but don't expect to create a fraction of two matrices!
The abbreviation for \spadtype{Fraction} is \spadtype{FRAC}.

\xtc{
Use \spadopFrom{/}{Fraction} to create a fraction.
}{
\spadpaste{a := 11/12 \bound{a}}
}
\xtc{
}{
\spadpaste{b := 23/24 \bound{b}}
}
\xtc{
The standard arithmetic operations are available.
}{
\spadpaste{3 - a*b^2 + a + b/a \free{a}\free{b}}
}
\xtc{
Extract the numerator and denominator by using
%-% \HDindex{numerator}{FractionXmpPage}{9.28}{Fraction}
\spadfunFrom{numer}{Fraction} and \spadfunFrom{denom}{Fraction},
%-% \HDindex{denominator}{FractionXmpPage}{9.28}{Fraction}
respectively.
}{
\spadpaste{numer(a) \free{a}}
}
\xtc{
}{
\spadpaste{denom(b) \free{b}}
}
Operations like \spadfunFrom{max}{Fraction}, \spadfunFrom{min}{Fraction},
\spadfunFrom{negative?}{Fraction}, \spadfunFrom{positive?}{Fraction} and
\spadfunFrom{zero?}{Fraction} are all available if they are provided for
the numerators and denominators.
See \downlink{`Integer'}{IntegerXmpPage}\ignore{Integer} for examples.

Don't expect a useful answer from \spadfunFrom{factor}{Fraction},
\spadfunFrom{gcd}{Fraction} or \spadfunFrom{lcm}{Fraction} if you apply
them to fractions.
\xtc{
}{
\spadpaste{r := (x^2 + 2*x + 1)/(x^2 - 2*x + 1) \bound{r}}
}
\xtc{
Since all non-zero fractions are invertible, these operations have trivial
definitions.
}{
\spadpaste{factor(r) \free{r}}
}
\xtc{
Use \spadfunFrom{map}{Fraction} to apply \spadfunFrom{factor}{Fraction} to
the numerator and denominator, which is probably what you mean.
}{
\spadpaste{map(factor,r) \free{r}}
}

\xtc{
Other forms of fractions are available.
%-% \HDindex{fraction!continued}{FractionXmpPage}{9.28}{Fraction}
Use \spadfun{continuedFraction} to create a continued fraction.
%-% \HDindex{continued fraction}{FractionXmpPage}{9.28}{Fraction}
}{
\spadpaste{continuedFraction(7/12)}
}
\xtc{
Use \spadfun{partialFraction} to create a partial fraction.
%-% \HDindex{fraction!partial}{FractionXmpPage}{9.28}{Fraction}
See \downlink{`ContinuedFraction'}{ContinuedFractionXmpPage}\ignore{ContinuedFraction} and \downlink{`PartialFraction'}{PartialFractionXmpPage}\ignore{PartialFraction} for
additional information and examples.
%-% \HDindex{partial fraction}{FractionXmpPage}{9.28}{Fraction}
}{
\spadpaste{partialFraction(7,12)}
}

\xtc{
Use conversion to create alternative views of fractions with objects
moved in and out of the numerator and denominator.
}{
\spadpaste{g := 2/3 + 4/5*\%i \bound{g}}
}
\xtc{
Conversion is discussed in detail in \downlink{``\ugTypesConvertTitle''}{ugTypesConvertPage} in Section \ugTypesConvertNumber\ignore{ugTypesConvert}.
}{
\spadpaste{g :: FRAC COMPLEX INT \free{g}}
}
\endscroll
\autobuttons
\end{page}
%
