code: def test_hotelling4():
      # Hotelling T^2 should just be like taking product with sphere.
      x = np.linspace(0.1, 10, 100)
      for dim in range(7):
          search = rft.IntrinsicVolumes([0] * (dim) + [1])
          for k in range(5, 10):
              p = rft.spherical_search(k)
              for dfd in [np.inf, 40, 50]:
                  f = rft.FStat(dfd=dfd, dfn=1)(x, search=p * search)
                  t = 2 * rft.TStat(dfd=dfd)(
                      np.sqrt(x), search=p * search
                  )
                  h2 = 2 * rft.Hotelling(k=k, dfd=dfd).density(x, dim)
                  h = 2 * rft.Hotelling(k=k, dfd=dfd)(x, search=search)
  
                  assert_almost_equal(h, t)
                  assert_almost_equal(h, f)
                  assert_almost_equal(h, h2)
      search = rft.IntrinsicVolumes([3, 4, 5])
      for k in range(5, 10):
          p = rft.spherical_search(k)
          for dfd in [np.inf, 40, 50]:
              f = rft.FStat(dfd=dfd, dfn=1)(x, search=p * search)
              h = 2 * rft.Hotelling(k=k, dfd=dfd)(x, search=search)
  
              h2 = 0
              for i in range(search.mu.shape[0]):
                  h2 += (
                      2
                      * rft.Hotelling(k=k, dfd=dfd).density(x, i)
                      * search.mu[i]
                  )
              assert_almost_equal(h, f)
              assert_almost_equal(h, h2)
  
imports: import numpy
  import scipy.stats
  from scipy.special import gammaln, hermitenorm
  import pytest
  from numpy.testing import assert_almost_equal
  from ..None import rft
label_desc: Use image node_id 21 for calling a global function with example usage: test_hotelling4() without return types