code: def test_expand():
      assert expand_func(besselj(S.Half, z).rewrite(jn)) == sqrt(
          2
      ) * sin(z) / (sqrt(pi) * sqrt(z))
      assert expand_func(bessely(S.Half, z).rewrite(yn)) == -sqrt(
          2
      ) * cos(z) / (sqrt(pi) * sqrt(z))
  
      # XXX: teach sin/cos to work around arguments like
      # x*exp_polar(I*pi*n/2).  Then change besselsimp -> expand_func
      assert besselsimp(besselj(S.Half, z)) == sqrt(2) * sin(z) / (
          sqrt(pi) * sqrt(z)
      )
      assert besselsimp(besselj(Rational(-1, 2), z)) == sqrt(2) * cos(
          z
      ) / (sqrt(pi) * sqrt(z))
      assert besselsimp(besselj(Rational(5, 2), z)) == -sqrt(2) * (
          z**2 * sin(z) + 3 * z * cos(z) - 3 * sin(z)
      ) / (sqrt(pi) * z ** Rational(5, 2))
      assert besselsimp(besselj(Rational(-5, 2), z)) == -sqrt(2) * (
          z**2 * cos(z) - 3 * z * sin(z) - 3 * cos(z)
      ) / (sqrt(pi) * z ** Rational(5, 2))
  
      assert besselsimp(bessely(S.Half, z)) == -(sqrt(2) * cos(z)) / (
          sqrt(pi) * sqrt(z)
      )
      assert besselsimp(bessely(Rational(-1, 2), z)) == sqrt(2) * sin(
          z
      ) / (sqrt(pi) * sqrt(z))
      assert besselsimp(bessely(Rational(5, 2), z)) == sqrt(2) * (
          z**2 * cos(z) - 3 * z * sin(z) - 3 * cos(z)
      ) / (sqrt(pi) * z ** Rational(5, 2))
      assert besselsimp(bessely(Rational(-5, 2), z)) == -sqrt(2) * (
          z**2 * sin(z) + 3 * z * cos(z) - 3 * sin(z)
      ) / (sqrt(pi) * z ** Rational(5, 2))
  
      assert besselsimp(besseli(S.Half, z)) == sqrt(2) * sinh(z) / (
          sqrt(pi) * sqrt(z)
      )
      assert besselsimp(besseli(Rational(-1, 2), z)) == sqrt(2) * cosh(
          z
      ) / (sqrt(pi) * sqrt(z))
      assert besselsimp(besseli(Rational(5, 2), z)) == sqrt(2) * (
          z**2 * sinh(z) - 3 * z * cosh(z) + 3 * sinh(z)
      ) / (sqrt(pi) * z ** Rational(5, 2))
      assert besselsimp(besseli(Rational(-5, 2), z)) == sqrt(2) * (
          z**2 * cosh(z) - 3 * z * sinh(z) + 3 * cosh(z)
      ) / (sqrt(pi) * z ** Rational(5, 2))
  
      assert (
          besselsimp(besselk(S.Half, z))
          == besselsimp(besselk(Rational(-1, 2), z))
          == sqrt(pi) * exp(-z) / (sqrt(2) * sqrt(z))
      )
      assert (
          besselsimp(besselk(Rational(5, 2), z))
          == besselsimp(besselk(Rational(-5, 2), z))
          == sqrt(2)
          * sqrt(pi)
          * (z**2 + 3 * z + 3)
          * exp(-z)
          / (2 * z ** Rational(5, 2))
      )
  
      n = Symbol("n", integer=True, positive=True)
  
      assert (
          expand_func(besseli(n + 2, z))
          == besseli(n, z)
          + (-2 * n - 2)
          * (-2 * n * besseli(n, z) / z + besseli(n - 1, z))
          / z
      )
      assert (
          expand_func(besselj(n + 2, z))
          == -besselj(n, z)
          + (2 * n + 2)
          * (2 * n * besselj(n, z) / z - besselj(n - 1, z))
          / z
      )
      assert (
          expand_func(besselk(n + 2, z))
          == besselk(n, z)
          + (2 * n + 2)
          * (2 * n * besselk(n, z) / z + besselk(n - 1, z))
          / z
      )
      assert (
          expand_func(bessely(n + 2, z))
          == -bessely(n, z)
          + (2 * n + 2)
          * (2 * n * bessely(n, z) / z - bessely(n - 1, z))
          / z
      )
  
      assert expand_func(besseli(n + S.Half, z).rewrite(jn)) == (
          sqrt(2)
          * sqrt(z)
          * exp(-I * pi * (n + S.Half) / 2)
          * exp_polar(I * pi / 4)
          * jn(n, z * exp_polar(I * pi / 2))
          / sqrt(pi)
      )
      assert expand_func(besselj(n + S.Half, z).rewrite(jn)) == sqrt(
          2
      ) * sqrt(z) * jn(n, z) / sqrt(pi)
  
      r = Symbol("r", real=True)
      p = Symbol("p", positive=True)
      i = Symbol("i", integer=True)
  
      for besselx in [besselj, bessely, besseli, besselk]:
          assert besselx(i, p).is_extended_real is True
          assert besselx(i, x).is_extended_real is None
          assert besselx(x, z).is_extended_real is None
  
      for besselx in [besselj, besseli]:
          assert besselx(i, r).is_extended_real is True
      for besselx in [bessely, besselk]:
          assert besselx(i, r).is_extended_real is None
  
      for besselx in [besselj, bessely, besseli, besselk]:
          assert expand_func(besselx(oo, x)) == besselx(
              oo, x, evaluate=False
          )
          assert expand_func(besselx(-oo, x)) == besselx(
              -oo, x, evaluate=False
          )
  
imports: from itertools import product
  from sympy.concrete.summations import Sum
  from sympy.core.function import diff, expand_func
  from sympy.core.numbers import I, Rational, oo, pi
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.functions.elementary.complexes import conjugate, polar_lift
  from sympy.functions.elementary.exponential import exp, exp_polar, log
  from sympy.functions.elementary.hyperbolic import cosh, sinh
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.trigonometric import cos, sin
  from sympy.functions.special.bessel import besseli, besselj, besselk, bessely, hankel1, hankel2, hn1, hn2, jn, jn_zeros, yn
  from sympy.functions.special.gamma_functions import gamma, uppergamma
  from sympy.functions.special.hyper import hyper
  from sympy.integrals.integrals import Integral
  from sympy.series.order import O
  from sympy.series.series import series
  from sympy.functions.special.bessel import airyai, airybi, airyaiprime, airybiprime, marcumq
  from sympy.core.random import random_complex_number, verify_numerically, test_derivative_numerically, _randint
  from sympy.simplify import besselsimp
  from sympy.testing.pytest import raises, slow
  from sympy.abc import z, n, k, x
label_desc: Use image node_id 13 for calling a global function with example usage: test_expand() without return types