Next: Question 5: Now Up: Some Maple Questions and Previous: Question 3: Can

Question 4: I generated a Taylor series using the series command and now I want to evaluate it at several values. But I can't seem to get rid of the O(..) term.

Answer: You need to use the convert function. Currently you have a series data structure and you want a polynomial (a sum of products data structure). You could issue the command convert(series, polynom) to remove the order term.


> S:=series(1/(1-3*x),x,10);
                     2       3       4        5        6         7
   S := 1 + 3 x + 9 x  + 27 x  + 81 x  + 243 x  + 729 x  + 2187 x


                8         9      10
        + 6561 x + 19683 x  + O(x  )

> p:=convert(S,polynom);
                      2       3       4        5        6         7
   p :=  1 + 3 x + 9 x  + 27 x  + 81 x  + 243 x  + 729 x  + 2178 x

                8          9
        + 6561 x  + 19683 x

> subs(x=2,p);
                                    12093235
This is also effective for Laurent series, although the result is not neccessarily a polynomial.
An alternative way to remove the order term is shown below. The result is still a series data structure but it now represents an exact series. Exact series and polynomials appear exactly the same. Substitutions and evaluation can be done on an exact series just as if it were a polynomial. Due to the nature of its data structure this form may be preferable for some applications.

> p2:=subs(O(1)=0,S);
                         2       3       4        5        6         7         
      p2 := 1 + 3 x + 9 x  + 27 x  + 81 x  + 243 x  + 729 x  + 2187 x  

                     8          9
             + 6561 x  + 19683 x

> subs(x=2,p2);
                                    12093235

Related help pages include: `convert/polynom`, subs, order, series[structure].


gagin@thsun1.jinr.ru