code: def test_series():
      x = symbols("x")
      R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), "Dx")
      p = HolonomicFunction(Dx**2 + 2 * x * Dx, x, 0, [0, 1]).series(
          n=10
      )
      q = (
          x
          - x**3 / 3
          + x**5 / 10
          - x**7 / 42
          + x**9 / 216
          + O(x**10)
      )
      assert p == q
      p = HolonomicFunction(Dx - 1, x).composition(
          x**2, 0, [1]
      )  # e^(x**2)
      q = HolonomicFunction(Dx**2 + 1, x, 0, [1, 0])  # cos(x)
      r = (p * q).series(n=10)  # expansion of cos(x) * exp(x**2)
      s = (
          1
          + x**2 / 2
          + x**4 / 24
          - 31 * x**6 / 720
          - 179 * x**8 / 8064
          + O(x**10)
      )
      assert r == s
      t = HolonomicFunction(
          (1 + x) * Dx**2 + Dx, x, 0, [0, 1]
      )  # log(1 + x)
      r = (p * t + q).series(n=10)
      s = (
          1
          + x
          - x**2
          + 4 * x**3 / 3
          - 17 * x**4 / 24
          + 31 * x**5 / 30
          - 481 * x**6 / 720
          + 71 * x**7 / 105
          - 20159 * x**8 / 40320
          + 379 * x**9 / 840
          + O(x**10)
      )
      assert r == s
      p = HolonomicFunction(
          (6 + 6 * x - 3 * x**2)
          - (10 * x - 3 * x**2 - 3 * x**3) * Dx
          + (4 - 6 * x**3 + 2 * x**4) * Dx**2,
          x,
          0,
          [0, 1],
      ).series(n=7)
      q = (
          x
          + x**3 / 6
          - 3 * x**4 / 16
          + x**5 / 20
          - 23 * x**6 / 960
          + O(x**7)
      )
      assert p == q
      p = HolonomicFunction(
          (6 + 6 * x - 3 * x**2)
          - (10 * x - 3 * x**2 - 3 * x**3) * Dx
          + (4 - 6 * x**3 + 2 * x**4) * Dx**2,
          x,
          0,
          [1, 0],
      ).series(n=7)
      q = (
          1
          - 3 * x**2 / 4
          - x**3 / 4
          - 5 * x**4 / 32
          - 3 * x**5 / 40
          - 17 * x**6 / 384
          + O(x**7)
      )
      assert p == q
      p = expr_to_holonomic(erf(x) + x).series(n=10)
      C_3 = symbols("C_3")
      q = (erf(x) + x).series(n=10)
      assert p.subs(C_3, -2 / (3 * sqrt(pi))) == q
      assert expr_to_holonomic(sqrt(x**3 + x)).series(n=10) == sqrt(
          x**3 + x
      ).series(n=10)
      assert (
          expr_to_holonomic(
              (2 * x - 3 * x**2) ** Rational(1, 3)
          ).series()
          == ((2 * x - 3 * x**2) ** Rational(1, 3)).series()
      )
      assert (
          expr_to_holonomic(sqrt(x**2 - x)).series()
          == (sqrt(x**2 - x)).series()
      )
      assert expr_to_holonomic(
          cos(x) ** 2 / x**2, y0={-2: [1, 0, -1]}
      ).series(n=10) == (cos(x) ** 2 / x**2).series(n=10)
      assert (
          expr_to_holonomic(cos(x) ** 2 / x**2, x0=1)
          .series(n=10)
          .together()
          == (cos(x) ** 2 / x**2).series(n=10, x0=1).together()
      )
      assert expr_to_holonomic(
          cos(x - 1) ** 2 / (x - 1) ** 2, x0=1, y0={-2: [1, 0, -1]}
      ).series(n=10) == (cos(x - 1) ** 2 / (x - 1) ** 2).series(
          x0=1, n=10
      )
  
imports: from sympy.holonomic import DifferentialOperator, HolonomicFunction, DifferentialOperators, from_hyper, from_meijerg, expr_to_holonomic
  from sympy.holonomic.recurrence import RecurrenceOperators, HolonomicSequence
  from sympy.core import EulerGamma
  from sympy.core.numbers import I, Rational, pi
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.exponential import exp, log
  from sympy.functions.elementary.hyperbolic import asinh, cosh
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.trigonometric import cos, sin
  from sympy.functions.special.bessel import besselj
  from sympy.functions.special.beta_functions import beta
  from sympy.functions.special.error_functions import Ci, Si, erf, erfc
  from sympy.functions.special.gamma_functions import gamma
  from sympy.functions.special.hyper import hyper, meijerg
  from sympy.printing.str import sstr
  from sympy.series.order import O
  from sympy.simplify.hyperexpand import hyperexpand
  from sympy.polys.domains.integerring import ZZ
  from sympy.polys.domains.rationalfield import QQ
  from sympy.polys.domains.realfield import RR
label_desc: Use image node_id 11 for calling a global function with example usage: test_series() without return types