% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\LLLReductionXmpTitle}{LLLReduction}
\newcommand{\LLLReductionXmpNumber}{9.52}
%
% =====================================================================
\begin{page}{LLLReductionXmpPage}{9.52 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}
%
