% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved. % !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk. \newcommand{\FactoredFunctionsTwoXmpTitle}{FactoredFunctions2} \newcommand{\FactoredFunctionsTwoXmpNumber}{9.23} % % ===================================================================== \begin{page}{FactoredFunctionsTwoXmpPage}{9.23 FactoredFunctions2} % ===================================================================== \beginscroll %% %% fr2.htex %% %% FactoredFunctions2 %% The \spadtype{FactoredFunctions2} package implements one operation, \spadfunFrom{map}{FactoredFunctions2}, for applying an operation to every base in a factored object and to the unit. \xtc{ }{ \spadpaste{double(x) == x + x \bound{double}} } \xtc{ }{ \spadpaste{f := factor(720) \bound{f}} } \xtc{ Actually, the \spadfunFrom{map}{FactoredFunctions2} operation used in this example comes from \spadtype{Factored} itself, since \userfun{double} takes an integer argument and returns an integer result. }{ \spadpaste{map(double,f) \free{f}\free{double}} } \xtc{ If we want to use an operation that returns an object that has a type different from the operation's argument, the \spadfunFrom{map}{FactoredFunctions2} in \spadtype{Factored} cannot be used and we use the one in \spadtype{FactoredFunctions2}. }{ \spadpaste{makePoly(b) == x + b \bound{makePoly}} } \xtc{ In fact, the ``2'' in the name of the package means that we might be using factored objects of two different types. }{ \spadpaste{g := map(makePoly,f) \free{f}\free{makePoly}\bound{g}} } It is important to note that both versions of \spadfunFrom{map}{FactoredFunctions2} destroy any information known about the bases (the fact that they are prime, for instance). \xtc{ The flags for each base are set to ``nil'' in the object returned by \spadfunFrom{map}{FactoredFunctions2}. }{ \spadpaste{nthFlag(g,1) \free{g}} } For more information about factored objects and their use, see \downlink{`Factored'}{FactoredXmpPage}\ignore{Factored} and \downlink{``\ugProblemGaloisTitle''}{ugProblemGaloisPage} in Section \ugProblemGaloisNumber\ignore{ugProblemGalois}. \endscroll \autobuttons \end{page} %