> <\body> Power series are implemented within the class |mmx::series> from |algebramix/series.hpp>. <\cpp-code> #include \numerix/rational.hpp\ #include \algebramix/series.hpp\ \; series\rational\ z (rational (1), 1); // variable z series\rational\ f = 1 / (1 - z); mmout \\ f[10] \\ "\\n"; Series are implemented in a lazy way, which means that the precision has not to be specified in advance. Computations are actually done when a coefficient is actually needed. The precision used for printing the power series can be set to in the following way: <\cpp-code> series\C,V\::set_output_order (n); Instead of printing an approximation of the series, it is possible to display the formula it has been built from, as follows: <\cpp-code> series\C,V\::set_formula_output (true); Withing equality test the precision to be taken into account can be set to via: <\cpp-code> series\C,V\::set_cancel_order (n); The name of the variable to be printed can be set to with the following command: <\cpp-code> series\C,V\::set_variable_name ("z"); Naive algorithms for power series are implemented in |algebramix/series_naive.hpp>. For instance the product implemented therein has a quadratic cost. Over numerical types, elementary functions are available from |algebramix/series_elementary.hpp>. The relaxed product for power series is implemented in |algebramix/series_relaxed.hpp>. <\cpp-code> #include \numerix/rational.hpp\ #include \algebramix/series.hpp\ #include \algebramix/series_relaxed.hpp\ \; #define V series_relaxed\series_naive\ series\rational,V\ z (rational (1), 1); // variable z series\rational,V\ f = 1 / (1 - z); mmout \\ z[10] \\ "\\n"; The relaxed product has a softly linear cost. A series is said to be recursive if it satisfies an equation > that allows to compute the -th coefficient of as the -th coefficient of > with the only knowledge of the first coefficients of , whenever is larger than an integer called the . For example =z*f>+1, with =1> can be implemented as follows: <\cpp-code> template\typename C, typename V\ struct example_series_rep : recursive_series_rep\C,V\ \ \ example_series_rep () {} \ \ syntactic expression (const syntactic& z) const { \ \ \ \ return apply ("example", z); } \ \ series\C,V\ initialize () { \ \ \ \ series\C,V\ f= this-\me (); \ \ \ \ this-\initial (0)= C(1); \ \ \ \ return lshiftz (square (f), 1) + C(1); } \; template\typename C, typename V\ example_series () { \ \ series_rep\C,V\* rep= new example_series_rep\C,V\ (); \ \ return recursive (series\C,V\ (rep)); } On this example, the fact that the -th coefficient of =z*f+1> depends only on the first coefficients of is due to the multiplication by . This multiplication must be done using the left shift function, defined by returns . Otherwise when seeking a new coefficient of , the recursive series mechanism would call recursively and fall into an infinite loop. Many commonly used series are recursive series. For example, a regular series root > of a polynomial >, that is |)>=0> and P|\ x>|)>\0>, is a recursive series. The file |algebramix/series.hpp> contains a template function\ <\cpp-code> template\typename C, typename V, typename L\ inline series\C,V\ polynomial_regular_root_init (const polynomial\L\& P, const C& init) which computes the unique regular root of whose zeroth term is . This lifting of the solution from its first coefficient is done by transforming the implicit equation |)>=0> into a recursive equation > and by applying the recursive series mechanism. A variant of this function for polynomials given as evaluation programs (or straight-line program) can be found in |algebramix/series_carry_naive.hpp>. Implicit series are implemented in |algebramix/series_implicit.hpp>. Vectorial and matricial auxiliary functions are available from |algebramix/series_vector.hpp> and |algebramix/series_matrix.hpp> respectively. They are useful for computing recursive vectors of series, which is the generalization of recursive series. Commonly used recursive vectors of series include in particular solutions of invertible linear systems, regular roots of multivariate polynomials. Linear system resolution over series can be found in the file |algebramix/series_carry_linear_algebra.hpp>. interface> <\session|mathemagix|default> <\input> <|input> use "algebramix"; type_mode? := true; <\unfolded-io> <|unfolded-io> z == series (0 :\ Rational, 1 :\ Rational) <|unfolded-io> |)>>: > <\unfolded-io> <|unfolded-io> f == log (1 - z) <|unfolded-io> *z-*z-*z-*z-*z-*z-*z-*z+O|)>>: > <\unfolded-io> <|unfolded-io> f[20] <|unfolded-io> >: . If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.> <\initial> <\collection>