Function: Ser Section: conversions C-Name: gtoser Prototype: GDnDP Help: Ser(s,{v='x},{d=seriesprecision}): convert s into a power series with variable v and precision d, starting with the constant coefficient. Doc: transforms the object $s$ into a power series with main variable $v$ ($x$ by default) and precision (number of significant terms) equal to $d$ (= the default \kbd{seriesprecision} by default). If $s$ is a scalar, this gives a constant power series in $v$ with precision \kbd{d}. If $s$ is a polynomial, the polynomial is truncated to $d$ terms if needed \bprog ? Ser(1, 'y, 5) %1 = 1 + O(y^5) ? Ser(x^2,, 5) %2 = x^2 + O(x^7) ? T = polcyclo(100) %3 = x^40 - x^30 + x^20 - x^10 + 1 ? Ser(T, 'x, 11) %4 = 1 - x^10 + O(x^11) @eprog\noindent The function is more or less equivalent with multiplication by $1 + O(v^d)$ in theses cases, only faster. If $s$ is a vector, on the other hand, the coefficients of the vector are understood to be the coefficients of the power series starting from the constant term (as in \tet{Polrev}$(x)$), and the precision $d$ is ignored: in other words, in this case, we convert \typ{VEC} / \typ{COL} to the power series whose significant terms are exactly given by the vector entries. Finally, if $s$ is already a power series in $v$, we return it verbatim, ignoring $d$ again. If $d$ significant terms are desired in the last two cases, convert/truncate to \typ{POL} first. \bprog ? v = [1,2,3]; Ser(v, t, 7) %5 = 1 + 2*t + 3*t^2 + O(t^3) \\ 3 terms: 7 is ignored! ? Ser(Polrev(v,t), t, 7) %6 = 1 + 2*t + 3*t^2 + O(t^7) ? s = 1+x+O(x^2); Ser(s, x, 7) %7 = 1 + x + O(x^2) \\ 2 terms: 7 ignored ? Ser(truncate(s), x, 7) %8 = 1 + x + O(x^7) @eprog\noindent The warning given for \kbd{Pol} also applies here: this is not a substitution function.