Formal Power Series in Maxima

An Informal presentation
Bertrand Teguia Tabuguia
February 2021

1 Introduction

Would you like to know how the computer finds the power series formula of f(z):=exp(z)+cos(z) like a mathematician? What if I tell you that it computes a differential equation for f, converts that differential equation into a recurrence equation and solves that recurrence equation for the power series coefficients? Of course, some other steps should also be considered, but I will not bother you with many details. Let's present how this works for f(z):=exp(z)+cos(z).
First, I load my package FPS (Formal Power Series) which contains all the necessary functions.
 (%i1) batchload ( FPS ) $$\mbox{}\\Version 1.0 \mbox{}\\Copyright (c) May 2020, Bertrand Teguia Tabuguia \mbox{}\\https://www.bertrandteguia.com \mbox{}\\bteguia@ mathematik.uni-kassel.de \mbox{}\\University of Kassel, Germany$ Yeah! I completed this package last year with my Ph.D. thesis which is the main reference for the mathematical background behind the algorithms implemented. Nevertheless, the code got better and better since June 2020 when I started the Maple version of the package. By the way, I made a demonstration in the Maple Conference 2020. Now, I would say it is "almost-surely" (I don't know the measure) "perfect". For deep understanding, I recommend (mathematicians) to read my Ph.D. thesis or the papers (1) Teguia Tabuguia, Bertrand. A variant of van Hoeij's algorithm to compute hypergeometric term solutions of holonomic recurrence equations. (2) Teguia Tabuguia, Bertrand and Koepf, Wolfram. Symbolic computation of hypergeometric type power series That will appear soon... Let us come back to our example. First, we compute a differential equation.  (%i2) f : exp ( z ) + cos ( z )$
 (%i3) DE : HolonomicDE ( f , F ( z ) ) ;

$\tag{%o3} \frac{{{d}^{3}}}{d {{z}^{3}}} \operatorname{F}(z)-\frac{{{d}^{2}}}{d {{z}^{2}}} \operatorname{F}(z)+\frac{d}{d z} \operatorname{F}(z)-\operatorname{F}(z)=0$

Then we convert it into a recurrence equation.
 (%i4) DEtoRE ( DE , F ( z ) , a [ n ] ) ;

$\tag{%o4} \left( n+1\right) \, \left( n+2\right) \, \left( n+3\right) \, {a_{n+3}}-\left( n+1\right) \, \left( n+2\right) \, {a_{n+2}}+\left( n+1\right) \, {a_{n+1}}-{a_n}=0$

This can also be done directly as follow.
 (%i5) RE : FindRE ( f , z , a [ n ] ) ;

$\tag{%o5} \left( n+1\right) \, \left( n+2\right) \, \left( n+3\right) \, {a_{n+3}}-\left( n+1\right) \, \left( n+2\right) \, {a_{n+2}}+\left( n+1\right) \, {a_{n+1}}-{a_n}=0$

The next step is to solve that recurrence equation. Here we use a new algorithm from my Ph.D.: mfoldHyper, to compute what we call m-fold hypergeometric term (sometimes called Liouvillian sequences) solutions.
 (%i6) mfoldHyper ( RE , a [ n ] ) ;

$\tag{%o6} [[1\operatorname{,}\{\frac{1}{n\operatorname{!}}\}]\operatorname{,}[2\operatorname{,}\{\frac{{{\left( -1\right) }^{n}}}{\left( 2 n\right) \operatorname{!}}\}]]$

Talking about mfoldHyper may need another presentation... In this presentation, I only use it.
You may have recognized the coefficients of the series of exp(z) and cos(z). Finally we get the representation
 (%i7) FPS ( f , z , n ) ;

$\tag{%o7} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 n}}}{\left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{z}^{n}}}{n\operatorname{!}}\right.}$

Isn't this amazing?! And by this process, FPS is able to do more! Even Laurent-Puiseux series are handled, I mean series with positive, negative and fractional powers.
I will only present examples for expansions in the positive neighborhood of 0 since the general case is deduced easily from it.
 (%i8) FPS ( log ( 1 + sqrt ( z ) + z + z ^ ( 3 / 2 ) ) , z , n ) ;

$\tag{%o8} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{n+1}}}{n+1}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{\frac{n+1}{2}}}}{n+1}\right.}$

 (%i9) FPS ( sin ( z ) / z ^ 5 + sqrt ( 1 + z ) + 1 / sqrt ( 1 + z ) , z , n ) ;

$\tag{%o9} \left( \sum_{n=0}^{\infty }{\left. -\frac{{{\left( -1\right) }^{n}}\, \left( 2 n-1\right) \operatorname{!} \left( \left( 2 n+1\right) \operatorname{!}-3 \left( 2 n\right) \operatorname{!}\right) \, {{z}^{n}}}{{{4}^{n}}\, {{n\operatorname{!}}^{2}}\, \left( \left( 2 n-1\right) \operatorname{!}-\left( 2 n\right) \operatorname{!}\right) }\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 \left( n-2\right) }}}{\left( 2 n+1\right) \operatorname{!}}\right.}$

Could this be done before? This (symbolic) approach was introduced in 1992 by Wolfram Koepf, but since m-fold hypergeometric terms could not be computed before, the algorithm was reduced to some particular cases, and the result was still amazing at that time. With the results of Marko Petkovsek and Mark van Hoeij, some improvements could be done around the 2000s. Currently the only Computer Algebra System (CAS) that uses a cutting-edge implementation of Koepf's approach on its release version is Maple; Mathematica also has an implementation but van Hoej's algorithm seems to not be used. But guess what? None of the above computations can be obtained in Maple (see my pdf file: Formal Power Series in Maple). This is normal because the coefficients cannot be detected directly by the Maple implementation. Regarding Maxima, all these computations are new and I am happy to contribute in making it among the top CASs for computing power series. Therefore there is no need to compare my implementation with the built-in Maxima command 'powerseries'. Let's move on and present more examples.

2 Hypergeometric type power series

You can find a definition of this subtitle in paper (2) mentioned above.
 (%i10) FPS ( asin ( z ) ^ 2 , z , n ) ;

$\tag{%o10} \sum_{n=0}^{\infty }{\left. \frac{{{4}^{n}}\, {{n\operatorname{!}}^{2}}\, {{z}^{2 \left( n+1\right) }}}{\left( n+1\right) \, \left( 2 n+1\right) \operatorname{!}}\right.}$

 (%i11) FPS ( atan ( z ^ 2 ) , z , n ) ;

$\tag{%o11} \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 \left( 2 n+1\right) }}}{2 n+1}\right.}$

 (%i12) FPS ( exp ( asinh ( z ) ) , z , n ) ;

$\tag{%o12} \frac{\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, \left( 2 n\right) \operatorname{!} {{z}^{2 \left( n+1\right) }}}{\left( n+1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}}{2}+z+1$

 (%i13) FPS ( integrate ( erf ( t ) , t , 0 , z ) , z , n ) ;

$\tag{%o13} -\frac{\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 n}}}{\left( 2 n-1\right) n\operatorname{!}}\right.}}{\sqrt{\ensuremath{\pi} }}$

 (%i14) FPS ( exp ( z ) − 2 · exp ( − z / 2 ) · cos ( sqrt ( 3 ) · z / 2 + %pi / 3 ) , z , n ) ;

$\tag{%o14} 3 \sum_{n=0}^{\infty }{\left. \frac{{{z}^{3 n+1}}}{{{\left( \frac{2}{3}\right) }_n}\, {{\left( \frac{4}{3}\right) }_n}\, {{27}^{n}} n\operatorname{!}}\right.}$

Note that (x)_{n+1} (I hope you know LaTeX, index notation) = x(x+1)...(x+n). This is what we call raised factorial or Pochhammer symbol.
 (%i15) FPS ( z · atan ( z ) − log ( 1 + z ^ 2 ) / 2 , z , n ) ;

$\tag{%o15} \frac{\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 \left( n+1\right) }}}{\left( n+1\right) \, \left( 2 n+1\right) }\right.}}{2}$

 (%i16) declare ( k , constant ) $I may need to find how to avoid such a specification for the user in Maxima...  (%i17) FPS ( z ^ 2 / ( 1 − z ) ^ k , z , n ) ; $\tag{%o17} \sum_{n=0}^{\infty }{\left. \frac{{{(k)}_n}\, {{z}^{n+2}}}{n\operatorname{!}}\right.}$  (%i18) FPS ( z ^ 3 · ( cos ( k · z ) + sin ( k · z ) ) , z , n ) ; $\tag{%o18} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left| k\right| }^{2 n}}\, {{\left( -1\right) }^{n}}\, {{z}^{2 n+3}}}{\left( 2 n\right) \operatorname{!}}\right.}\right) +k\, \sum_{n=0}^{\infty }{\left. \frac{{{\left| k\right| }^{2 n}}\, {{\left( -1\right) }^{n}}\, {{z}^{2 \left( n+2\right) }}}{\left( 2 n+1\right) \operatorname{!}}\right.}$  (%i19) FPS ( exp ( z ) · cos ( z ) , z , n ) ; $\tag{%o19} \left( \sum_{n=0}^{\infty }{\left. -\frac{{{\left( -1\right) }^{n}}\, {{4}^{n}}\, {{z}^{4 n+3}}}{{{\left( \frac{1}{4}\right) }_n}\, {{\left( \frac{3}{4}\right) }_n}\, \left( 2 n+1\right) \, \left( 4 n+1\right) \, \left( 4 n+3\right) \, {{64}^{n}}\, \left( 2 n\right) \operatorname{!}}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{4}^{n}}\, {{z}^{4 n+1}}}{{{\left( \frac{1}{4}\right) }_n}\, {{\left( \frac{3}{4}\right) }_n}\, \left( 4 n+1\right) \, {{64}^{n}}\, \left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{4}^{n}}\, {{z}^{4 n}}}{{{\left( \frac{1}{4}\right) }_n}\, {{\left( \frac{3}{4}\right) }_n}\, {{64}^{n}}\, \left( 2 n\right) \operatorname{!}}\right.}$  (%i20) FPS ( sin ( z ) + z · cos ( z ) , z , n ) ; $\tag{%o20} \sum_{n=0}^{\infty }{\left. \frac{2 \left( n+1\right) \, {{\left( -1\right) }^{n}}\, {{z}^{2 n+1}}}{\left( 2 n+1\right) \, \left( 2 n\right) \operatorname{!}}\right.}$  (%i21) FPS ( ( − 1 / 2 · x + 1 / 6 · x ^ 3 ) · atan ( x ) + ( − 1 / 4 · x ^ 2 + 1 / 12 ) · log ( x ^ 2 + 1 ) + 5 / 12 · x ^ 2 + 1 / 4 , x , n ) ; $\tag{%o21} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{x}^{2 \left( n+2\right) }}}{4 \left( n+1\right) \, \left( n+2\right) \, \left( 2 n+1\right) \, \left( 2 n+3\right) }\right.}\right) +\frac{1}{4}$  (%i22) declare ( q1 , constant , q2 , constant )$
 (%i23) FPS ( 1 / ( q1 − z ^ 2 ) / ( q2 − z ^ 3 ) , z , n ) ;

$\tag{%o23} \left( \sum_{n=0}^{\infty }{\left. -\frac{\mathit{q1}\, {{\mathit{q2}}^{-n-1}}\, {{z}^{3 n+2}}}{{{\mathit{q2}}^{2}}-{{\mathit{q1}}^{3}}}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. -\frac{{{z}^{3 n+1}}}{\left( {{\mathit{q2}}^{2}}-{{\mathit{q1}}^{3}}\right) \, {{\mathit{q2}}^{n}}}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. \frac{{{z}^{2 n+1}}}{\left( {{\mathit{q2}}^{2}}-{{\mathit{q1}}^{3}}\right) \, {{\mathit{q1}}^{n}}}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. -\frac{{{\mathit{q1}}^{2}}\, {{\mathit{q2}}^{-n-1}}\, {{z}^{3 n}}}{{{\mathit{q2}}^{2}}-{{\mathit{q1}}^{3}}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{\mathit{q2}\, {{\mathit{q1}}^{-n-1}}\, {{z}^{2 n}}}{{{\mathit{q2}}^{2}}-{{\mathit{q1}}^{3}}}\right.}$

 (%i24) FPS ( tan ( 3 · atan ( z ^ 2 ) ) , z , n ) ;

$\tag{%o24} \left( \sum_{n=0}^{\infty }{\left. 8 {{3}^{n-1}}\, {{z}^{4 n+2}}\right.}\right) +\frac{{{z}^{2}}}{3}$

 (%i25) FPS ( ( sin ( z ) + cos ( z ) ) ^ 3 , z , n ) ;

$\tag{%o25} \left( \sum_{n=0}^{\infty }{\left. \frac{3 \left( {{\left( -1\right) }^{n}}+{{\left( -9\right) }^{n}}\right) \, {{z}^{2 n+1}}}{2 \left( 2 n+1\right) \, \left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{\left( 3 {{\left( -1\right) }^{n}}-{{\left( -9\right) }^{n}}\right) \, {{z}^{2 n}}}{2 \left( 2 n\right) \operatorname{!}}\right.}$

 (%i26) FPS ( atan ( z ) + asin ( z ) , z , n ) ;

$\tag{%o26} \sum_{n=0}^{\infty }{\left. \frac{\left( \left( 2 n\right) \operatorname{!}+{{\left( -1\right) }^{n}}\, {{4}^{n}}\, {{n\operatorname{!}}^{2}}\right) \, {{z}^{2 n+1}}}{\left( 2 n+1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}$

 (%i27) FPS ( cos ( z ) ^ 3 + log ( 1 + z ^ 2 ) , z , n ) ;

$\tag{%o27} \left( \sum_{n=0}^{\infty }{\left. \frac{\left( 4 {{\left( -1\right) }^{n}}\, \left( 2 \left( n+1\right) \right) \operatorname{!}+n\, {{\left( -9\right) }^{n+1}}+{{\left( -9\right) }^{n+1}}-3 n\, {{\left( -1\right) }^{n}}-3 {{\left( -1\right) }^{n}}\right) \, {{z}^{2 \left( n+1\right) }}}{4 \left( n+1\right) \, \left( 2 \left( n+1\right) \right) \operatorname{!}}\right.}\right) +1$

 (%i28) FPS ( log ( 1 + z + z ^ 2 + z ^ 3 ) + sqrt ( 1 + z ^ 3 ) , z , n ) ;

$\tag{%o28} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 \left( n+1\right) }}}{n+1}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{n+1}}}{n+1}\right.}\right) +\sum_{n=0}^{\infty }{\left. -\frac{{{\left( -1\right) }^{n}}\, \left( 2 n\right) \operatorname{!} {{z}^{3 n}}}{\left( 2 n-1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}$

 (%i29) FPS ( exp ( z ^ 2 ) + sinh ( z ) + atan ( z ^ 2 ) , z , n ) ;

$\tag{%o29} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{4 n+2}}}{2 n+1}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. \frac{{{z}^{2 n+1}}}{\left( 2 n+1\right) \, \left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{z}^{2 n}}}{n\operatorname{!}}\right.}$

 (%i30) FPS ( atan ( z / ( 1 + z ^ 2 ) ) , z , n ) ;

$\tag{%o30} \sum_{n=0}^{\infty }{\left. \frac{\left( \frac{\sqrt{5}\, {{\left( \sqrt{5}+3\right) }^{n}}\, {{\left( -1\right) }^{n}}}{{{2}^{n}}}+\frac{{{\left( \sqrt{5}+3\right) }^{n}}\, {{\left( -1\right) }^{n}}}{{{2}^{n}}}-\frac{{{\left( \sqrt{5}-3\right) }^{n}}\, \sqrt{5}}{{{2}^{n}}}+\frac{{{\left( \sqrt{5}-3\right) }^{n}}}{{{2}^{n}}}\right) \, {{z}^{2 n+1}}}{2 \left( 2 n+1\right) }\right.}$

 (%i31) Nmax : 11 $This variable is used to change the maximal order of the differential equation to be computed. In the following case, a differential equation of order 11 is needed.  (%i32) FPS ( ( exp ( z ) − sin ( z ) ) ^ 3 , z , n ) ; $\tag{%o32} \left( \sum_{n=0}^{\infty }{\left. \frac{3 \left( {{\left( -9\right) }^{n+1}}+{{\left( -1\right) }^{n}}\right) \, {{z}^{2 \left( n+1\right) +1}}}{8 \left( n+1\right) \, \left( 2 n+1\right) \, \left( 2 n+3\right) \, \left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. -\frac{\left( 3 {{5}^{\frac{n}{2}}} \cos{\left( \operatorname{atan}(2) n\right) }+6 {{5}^{\frac{n}{2}}} \sin{\left( \operatorname{atan}\left( \frac{1}{2}\right) n\right) }-2 {{3}^{n}}-3\right) \, {{z}^{n}}}{2 n\operatorname{!}}\right.}$ I set the default value of Nmax to 10. Note that such example may increase the CPU time use in the computations. 2.1 Detecting identities One of the main reason to have a direct approach is because it can simplify inputs to polynomials and constants in particular. Therefore it helps to discover identities.  (%i33) FPS ( asin ( z ) + acos ( z ) , z , n ) ; $\tag{%o33} \frac{\ensuremath{\pi} }{2}$ Note that no prior knowledge is used, the result is obtained by means of symbolic computations only.  (%i34) FPS ( cos ( 4 · acos ( z ) ) , z , n ) ; $\tag{%o34} 8 {{z}^{4}}-8 {{z}^{2}}+1$  (%i35) FPS ( sin ( 2 · asin ( z ) ) + cos ( 3 · acos ( z ) ) , z , n ) ; $\tag{%o35} \left( \sum_{n=0}^{\infty }{\left. -\frac{2 \left( 2 n\right) \operatorname{!} {{z}^{2 n+1}}}{\left( 2 n-1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}\right) +4 {{z}^{3}}-3 z$  (%i36) FPS ( cos ( 2 · z ) − cos ( z ) ^ 2 + sin ( z ) ^ 2 , z , n ) ; $\tag{%o36} 0$  (%i37) f : atan ( ( z + z ^ 2 ) / ( 1 − z ^ 3 ) ) ; $\tag{%o37} \operatorname{atan}\left( \frac{{{z}^{2}}+z}{1-{{z}^{3}}}\right)$  (%i38) FPS ( f , z , n ) ; $\tag{%o38} \left( \sum_{n=0}^{\infty }{\left. \frac{\sin{\left( \frac{\ensuremath{\pi} \left( n+1\right) }{2}\right) } {{z}^{2 \left( n+1\right) }}}{n+1}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{\sin{\left( \frac{\ensuremath{\pi} \left( n+1\right) }{2}\right) } {{z}^{n+1}}}{n+1}\right.}$ In this previous example, the solution of the underlying recurrence equation contains complex numbers which reduce to real numbers when they are written in their algebraic representations.  (%i39) g : atan ( z ) + atan ( z ^ 2 ) ; $\tag{%o39} \operatorname{atan}\left( {{z}^{2}}\right) +\operatorname{atan}(z)$  (%i40) FPS ( g , z , n ) ; $\tag{%o40} \left( \sum_{n=0}^{\infty }{\left. \frac{\sin{\left( \frac{\ensuremath{\pi} \left( n+1\right) }{2}\right) } {{z}^{2 \left( n+1\right) }}}{n+1}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{\sin{\left( \frac{\ensuremath{\pi} \left( n+1\right) }{2}\right) } {{z}^{n+1}}}{n+1}\right.}$  (%i41) FPS ( f − g , z , n ) ; $\tag{%o41} 0$  (%i42) declare ( y , constant )$
 (%i43) FPS ( atan ( ( z + y ) / ( 1 − z · y ) ) , z , n ) ;

$\tag{%o43} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{2 n+1}}}{2 n+1}\right.}\right) +\operatorname{atan}(y)$

 (%i44) f : sqrt ( ( 1 − sqrt ( 1 − z ) ) / z ) ;

$\tag{%o44} \frac{\sqrt{1-\sqrt{1-z}}}{\sqrt{z}}$

 (%i45) FPS ( f , z , n ) ;

$\tag{%o45} \frac{\sum_{n=0}^{\infty }{\left. \frac{{{\left( \frac{1}{4}\right) }_n}\, {{\left( \frac{3}{4}\right) }_n}\, {{4}^{n}}\, {{z}^{n}}}{\left( 2 n+1\right) \operatorname{!}}\right.}}{\sqrt{2}}$

 (%i46) g : ( sqrt ( 1 + sqrt ( z ) ) − sqrt ( 1 − sqrt ( z ) ) ) / ( sqrt ( 2 · z ) ) ;

$\tag{%o46} \frac{\sqrt{\sqrt{z}+1}-\sqrt{1-\sqrt{z}}}{\sqrt{2}\, \sqrt{z}}$

 (%i47) FPS ( g , z , n ) ;

$\tag{%o47} \frac{\sum_{n=0}^{\infty }{\left. \frac{{{\left( \frac{1}{4}\right) }_n}\, {{\left( \frac{3}{4}\right) }_n}\, {{4}^{n}}\, {{z}^{n}}}{\left( 2 n+1\right) \operatorname{!}}\right.}}{\sqrt{2}}$

 (%i48) FPS ( f − g , z , n ) ;

$\tag{%o48} 0$

Isn't this nice?!

2.2 Some Puiseux series (series with fractional powers)

 (%i49) FPS ( asin ( z ^ ( 1 / 3 ) ) , z , n ) ;

$\tag{%o49} \sum_{n=0}^{\infty }{\left. \frac{\left( 2 n\right) \operatorname{!} {{z}^{\frac{2 n+1}{3}}}}{\left( 2 n+1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}$

 (%i50) FPS ( log ( 1 + z ^ ( 1 / 5 ) ) , z , n ) ;

$\tag{%o50} \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{\frac{n+1}{5}}}}{n+1}\right.}$

 (%i51) FPS ( 1 / ( 1 − z ^ ( 1 / 7 ) ) , z , n ) ;

$\tag{%o51} \sum_{n=0}^{\infty }{\left. {{z}^{\frac{n}{7}}}\right.}$

 (%i52) FPS ( cos ( sqrt ( z ) ) + sin ( z ^ ( 3 / 4 ) ) , z , n ) ;

$\tag{%o52} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{\frac{6 n+3}{4}}}}{\left( 2 n+1\right) \, \left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{n}}}{\left( 2 n\right) \operatorname{!}}\right.}$

 (%i53) FPS ( atan ( sqrt ( z ) ) + asinh ( z ^ ( 1 / 3 ) ) , z , n ) ;

$\tag{%o53} \left( \sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{\frac{6 n+3}{6}}}}{2 n+1}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, \left( 2 n\right) \operatorname{!} {{z}^{\frac{4 n+2}{6}}}}{\left( 2 n+1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}$

 (%i54) FPS ( sqrt ( sqrt ( 8 · z ^ 3 + 1 ) − 1 ) + sqrt ( 13 · z ^ 4 + 7 ) , z , n ) ;

$\tag{%o54} \left( \sum_{n=0}^{\infty }{\left. \frac{2 {{\left( \frac{1}{4}\right) }_n}\, {{\left( \frac{3}{4}\right) }_n}\, {{\left( -8\right) }^{n}}\, {{4}^{n}}\, {{z}^{\frac{6 n+3}{2}}}}{\left( 2 n+1\right) \, \left( 2 n\right) \operatorname{!}}\right.}\right) +\sum_{n=0}^{\infty }{\left. -\frac{{{7}^{\frac{1}{2}-n}}\, {{\left( -13\right) }^{n}}\, \left( 2 n\right) \operatorname{!} {{z}^{4 n}}}{\left( 2 n-1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}$

The sum of these two latter series can be written as a sum of four series as shown below.
 (%i55) FPS ( asin ( z ^ ( 1 / 3 ) ) + log ( 1 + z ^ ( 1 / 5 ) ) , z , n ) ;

$\tag{%o55} \left( \sum_{n=0}^{\infty }{\left. \frac{\left( 2 n\right) \operatorname{!} {{z}^{\frac{10 n+5}{15}}}}{\left( 2 n+1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. \frac{3 {{\left( -1\right) }^{n}}\, {{z}^{\frac{3 n+2}{15}}}}{3 n+2}\right.}\right) +\left( \sum_{n=0}^{\infty }{\left. -\frac{3 {{\left( -1\right) }^{n}}\, {{z}^{\frac{3 n+1}{15}}}}{3 n+1}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{3 {{\left( -1\right) }^{n}}\, {{z}^{\frac{n+1}{15}}}}{n+1}\right.}$

One can also recover the basic representation by using 'map(lambda([f],FPS(f,z,n)),.)'. The above result is related to a linear system solved in the algorithm. When there are many possible representations, the algorithm selects a particular one.
 (%i56) map ( lambda ( [ f ] , FPS ( f , z , n ) ) , asin ( z ^ ( 1 / 3 ) ) + log ( 1 + z ^ ( 1 / 5 ) ) ) ;

$\tag{%o56} \left( \sum_{n=0}^{\infty }{\left. \frac{\left( 2 n\right) \operatorname{!} {{z}^{\frac{2 n+1}{3}}}}{\left( 2 n+1\right) \, {{4}^{n}}\, {{n\operatorname{!}}^{2}}}\right.}\right) +\sum_{n=0}^{\infty }{\left. \frac{{{\left( -1\right) }^{n}}\, {{z}^{\frac{n+1}{5}}}}{n+1}\right.}$

I can provide many more examples, but let's stop here and see other kind of representations.

2.3 Series related to hypergeometric type series

Some formulas do not fit into the category of hypergeometric type series. However we can still connect their representations with hypergeometric type series. This is the situation for products and reciprocals of hypergeometric type series. The outputs are given as a recursive formula, by application of the Cauchy product rule or both.
Our first example is the generating function of the Bernoulli numbers.
 (%i57) FPS ( 1 / ( exp ( z ) − 1 ) , z , n ) ;

$\tag{%o57} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_n}=\sum_{k=1}^{n}{\left. -\frac{{A_{n-k}}}{k\operatorname{!}}\right.}\operatorname{,}{A_0}=1]$

 (%i58) FPS ( exp ( z ) · log ( 1 + z ) , z , n ) ;

$\tag{%o58} \sum_{n=0}^{\infty }{\left. \left( \sum_{k=0}^{n}{\left. \frac{{{\left( -1\right) }^{n-k}}}{k\operatorname{!} \left( n-k+1\right) }\right.}\right) \, {{z}^{n+1}}\right.}$

 (%i59) FPS ( log ( 1 + z ) / exp ( z ) , z , n ) ;

$\tag{%o59} \sum_{n=0}^{\infty }{\left. {{\left( -1\right) }^{n}}\, \left( \sum_{k=0}^{n}{\left. \frac{1}{k\operatorname{!} \left( n-k+1\right) }\right.}\right) \, {{z}^{n+1}}\right.}$

 (%i60) FPS ( tan ( z ) , z , n ) ;

$\tag{%o60} [\sum_{n=0}^{\infty }{\left. \left( \sum_{k=0}^{n}{\left. \frac{{A_k}\, {{\left( -1\right) }^{n-k}}}{\left( 2 n-2 k+1\right) \operatorname{!}}\right.}\right) \, {{z}^{2 n+1}}\right.}\operatorname{,}{A_k}=\sum_{j=1}^{k}{\left. -\frac{{A_{k-j}}\, {{\left( -1\right) }^{j}}}{\left( 2 j\right) \operatorname{!}}\right.}\operatorname{,}{A_0}=1]$

 (%i61) FPS ( 1 / atan ( z ) , z , n ) ;

$\tag{%o61} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{2 n-1}}\right.}\operatorname{,}{A_n}=\sum_{k=1}^{n}{\left. -\frac{{{\left( -1\right) }^{k}}\, {A_{n-k}}}{2 k+1}\right.}\operatorname{,}{A_0}=1]$

 (%i62) FPS ( atan ( z ) · sin ( z ) , z , n ) ;

$\tag{%o62} \sum_{n=0}^{\infty }{\left. {{\left( -1\right) }^{n}}\, \left( \sum_{k=0}^{n}{\left. \frac{1}{\left( 2 k+1\right) \, \left( 2 n-2 k+1\right) \operatorname{!}}\right.}\right) \, {{z}^{2 n+2}}\right.}$

 (%i63) FPS ( atan ( z ) ^ 2 , z , n ) ;

$\tag{%o63} \sum_{n=0}^{\infty }{\left. {{\left( -1\right) }^{n}}\, \left( \sum_{k=0}^{n}{\left. \frac{1}{\left( 2 k+1\right) \, \left( 2 n-2 k+1\right) }\right.}\right) \, {{z}^{2 n+2}}\right.}$

2.4 Recursive representations from recurrence equations

In certain cases the algorithm finds a recurrence equation but does not find a representation related to hypergeometric type series. In this case it uses the recurrence equation obtained to write a recursive formula for the coefficients.
 (%i64) FPS ( exp ( z + z ^ 2 ) , z , n ) ;

$\tag{%o64} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_{n+2}}=\frac{{A_{n+1}}+2 {A_n}}{n+2}\operatorname{,}n\operatorname{> =}0\operatorname{,}[{A_0}=1\operatorname{,}{A_1}=1]]$

 (%i65) FPS ( sin ( 1 + z + z ^ 2 ) , z , n ) ;

$\tag{%o65} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_{n+5}}=\frac{-2 \left( n+2\right) \, \left( n+4\right) \, {A_{n+4}}-{A_{n+3}}-6 {A_{n+2}}-12 {A_{n+1}}-8 {A_n}}{\left( n+4\right) \, \left( n+5\right) }\operatorname{,}n\operatorname{> =}0\operatorname{,}[{A_0}=\sin{(1)}\operatorname{,}{A_1}=\cos{(1)}\operatorname{,}{A_2}=-\frac{\sin{(1)}-2 \cos{(1)}}{2}\operatorname{,}{A_3}=-\frac{6 \sin{(1)}+\cos{(1)}}{6}\operatorname{,}{A_4}=-\frac{11 \sin{(1)}+12 \cos{(1)}}{24}]]$

 (%i66) FPS ( atan ( z ) · exp ( z ) , z , n ) ;

$\tag{%o66} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_{n+4}}=\frac{2 \left( n+3\right) \, {A_{n+3}}-\left( {{\left( n+2\right) }^{2}}+n+3\right) \, {A_{n+2}}+2 \left( n+2\right) \, {A_{n+1}}-{A_n}}{\left( n+3\right) \, \left( n+4\right) }\operatorname{,}n\operatorname{> =}0\operatorname{,}[{A_0}=0\operatorname{,}{A_1}=1\operatorname{,}{A_2}=1\operatorname{,}{A_3}=\frac{1}{6}]]$

Observe that this can be used to compute truncated series. My package contains the function 'Taylor' with the same syntax as the internal Maxima 'taylor' to compute Taylor polynomials.
 (%i67) Taylor ( sin ( z ) , z , 0 , 7 ) ;

$\tag{%o67} -\frac{{{z}^{7}}}{5040}+\frac{{{z}^{5}}}{120}-\frac{{{z}^{3}}}{6}+z$

It is easy to see that for larger order expansions this approach has a better efficiency than what is internally implemented. Let us consider truncated series of arctan(z)^2.
 (%i68) Taylor ( atan ( z ) ^ 2 , z , 0 , 10 ) ;

$\tag{%o68} \frac{563 {{z}^{10}}}{1575}-\frac{44 {{z}^{8}}}{105}+\frac{23 {{z}^{6}}}{45}-\frac{2 {{z}^{4}}}{3}+{{z}^{2}}$

 (%i69) taylor ( atan ( z ) ^ 2 , z , 0 , 10 ) ;

$\tag{%o69)/T} {{z}^{2}}-\frac{2 {{z}^{4}}}{3}+\frac{23 {{z}^{6}}}{45}-\frac{44 {{z}^{8}}}{105}+\frac{563 {{z}^{10}}}{1575}+\operatorname{...}$

 (%i70) showtime : true $$Evaluation took 0.0000 seconds (0.0000 elapsed) using 0 bytes.$  (%i71) Taylor ( atan ( z ) ^ 2 , z , 0 , 1000 )$

$Evaluation took 0.5000 seconds (0.4960 elapsed) using 385.396 MB.$

 (%i72) taylor ( atan ( z ) ^ 2 , z , 0 , 1000 ) $$Evaluation took 7.2810 seconds (7.2760 elapsed) using 1248.234 MB.$  (%i73) showtime : false$
Really interesting, right?

3 Non-holonomic power series

I will only present three examples for this section. This are series that do not satisfy linear differential equations. The outputs are given as recursive formulas from computed algebraic ordinary differential equations. The most important aspect of this approach is that it can prove difficult identities.
 (%i74) FPS ( log ( 1 + sin ( z ) ) , z , n ) ;

$\tag{%o74} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_{n+4}}=\frac{-\left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, \left( k+2\right) \, {A_{k+2}}\, \left( n-k+2\right) \, {A_{n-k+2}}\right.}\right) -\left( n+2\right) \, \left( n+3\right) \, {A_{n+3}}+\left( n+2\right) \, {A_{n+2}}}{\left( n+2\right) \, \left( n+3\right) \, \left( n+4\right) }\operatorname{,}n\operatorname{> =}0\operatorname{,}[{A_0}=0\operatorname{,}{A_1}=1\operatorname{,}{A_2}=-\frac{1}{2}\operatorname{,}{A_3}=\frac{1}{6}]]$

 (%i75) f : ( 1 + tan ( z ) ) / ( 1 − tan ( z ) ) ;

$\tag{%o75} \frac{\tan{(z)}+1}{1-\tan{(z)}}$

 (%i76) FPS ( f , z , n ) ;

$\tag{%o76} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_{n+3}}=\frac{2 \left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, {A_{k+1}}\, {A_{n-k+1}}\right.}\right) +2 \left( n+2\right) \, {A_{n+2}}+4 {A_{n+1}}}{\left( n+2\right) \, \left( n+3\right) }\operatorname{,}n\operatorname{> =}0\operatorname{,}[{A_0}=1\operatorname{,}{A_1}=2\operatorname{,}{A_2}=2]]$

 (%i77) g : exp ( 2 · atanh ( sin ( 2 · z ) / ( 1 + cos ( 2 · z ) ) ) ) ;

$\tag{%o77} {{\% e}^{2 \operatorname{atanh}\left( \frac{\sin{\left( 2 z\right) }}{\cos{\left( 2 z\right) }+1}\right) }}$

 (%i78) FPS ( g , z , n ) ;

$\tag{%o78} [\sum_{n=0}^{\infty }{\left. {A_n}\, {{z}^{n}}\right.}\operatorname{,}{A_{n+4}}=\frac{3 \left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, \left( k+2\right) \, {A_{k+2}}\, \left( n-k+2\right) \, {A_{n-k+2}}\right.}\right) -\left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, \left( k+2\right) \, \left( k+3\right) \, {A_{k+3}}\, {A_{n-k+1}}\right.}\right) -4 \left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, {A_{k+1}}\, {A_{n-k+1}}\right.}\right) +6 \left( n+2\right) \, \left( n+3\right) \, {A_{n+3}}+8 \left( n+2\right) \, {A_{n+2}}-24 {A_{n+1}}}{\left( n+2\right) \, \left( n+3\right) \, \left( n+4\right) }\left( 3 \left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, \left( k+2\right) \, {A_{k+2}}\, \left( n-k+2\right) \, {A_{n-k+2}}\right.}\right) -\left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, \left( k+2\right) \, \left( k+3\right) \, {A_{k+3}}\, {A_{n-k+1}}\right.}\right) -4 \left( \sum_{k=1}^{n}{\left. \left( k+1\right) \, {A_{k+1}}\, {A_{n-k+1}}\right.}\right) +6 \left( n+2\right) \, \left( n+3\right) \, {A_{n+3}}+8 \left( n+2\right) \, {A_{n+2}}-24 {A_{n+1}}\right) /\left( \left( n+2\right) \, \left( n+3\right) \, \left( n+4\right) \right) \operatorname{,}n\operatorname{> =}0\operatorname{,}[{A_0}=1\operatorname{,}{A_1}=2\operatorname{,}{A_2}=2\operatorname{,}{A_3}=\frac{8}{3}]]$

Yeah, this approach does not always yield nice outputs. Although we get a different representation for the two latter expressions (this does not happen with my Maple package), the algorithm is able to prove that they are identical.
 (%i79) FPS ( f − g , z , n ) ;

$\tag{%o79} 0$

4 Conclusion

As I said, I just presented a few examples. I hope you enjoyed seeing those. My Maxima package will soon be available on the Github repository of maxima-packages. Feel free to use it and contact me if you have any question.

Created with wxMaxima.