% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\LLLReductionXmpTitle}{LLLReduction}
\newcommand{\LLLReductionXmpNumber}{9.43}
%
% =====================================================================
\begin{page}{LLLReductionXmpPage}{9.43 LLLReduction}
% =====================================================================
\beginscroll
The package \spadtype{LLLReduction} implements LLL reduction.  We
show how to use it to find equation satisfied by imaginary part of fifth
primitive root of \spad{1}.

\xtc{Before use we must set appropriate floating point precision.
}{
\spadpaste{digits(24) \bound{prec}}
}

\xtc{Compute numeric value of the root.
}{
\spadpaste{ii := imag(exp(2.0*\%i*\%pi/5)) \free{prec} \bound{ii}}
}

\xtc{Prepare list of powers.
}{
\spadpaste{lf := [ii^i for i in 0..4] \free{ii} \bound{lf}}
}

\xtc{Use LLL reduction.
}{
\spadpaste{rel := find_relation(lf, 20)$LLLReduction \free{lf} \bound{rel}}
}

\xtc{Convert to polynomial.
}{
\spadpaste{pol := reduce(_+, [ci*x^i for ci in rel for i in 0..4]) \free{rel} \bound{pol}}
}

\xtc{Test it.
}{
\spadpaste{eval(pol, x = ii) \free{pol, ii}}
}
\endscroll
\autobuttons
\end{page}
%
