docs: def V_horiz_conical(D, L, a, h, headonly=False):
      r'''Calculates volume of a tank with conical ends, according to [1]_.
  
      .. math::
          V_f = A_fL + \frac{2aR^2}{3}K, \;\;0 \le h < R\\
  
      .. math::
          V_f = A_fL + \frac{2aR^2}{3}\pi/2,\;\; h = R\\
  
      .. math::
          V_f = A_fL + \frac{2aR^2}{3}(\pi-K), \;\; R< h \le 2R
  
      .. math::
          K = \cos^{-1} M + M^3\cosh^{-1} \frac{1}{M} - 2M\sqrt{1 - M^2}
  
      .. math::
          M = \left|\frac{R-h}{R}\right|
  
      .. math::
          Af = R^2\cos^{-1}\frac{R-h}{R} - (R-h)\sqrt{2Rh - h^2}
  
      Parameters
      ----------
      D : float
          Diameter of the main cylindrical section, [m]
      L : float
          Length of the main cylindrical section, [m]
      a : float
          Distance the cone head extends on one side, [m]
      h : float
          Height, as measured up to where the fluid ends, [m]
      headonly : bool, optional
          Function returns only the volume of a single head side if True
  
      Returns
      -------
      V : float
          Volume [m^3]
  
      Examples
      --------
      Matching example from [1]_, with inputs in inches and volume in gallons.
  
      >>> V_horiz_conical(D=108., L=156., a=42., h=36)/231
      2041.1923581273443
  
      References
      ----------
      .. [1] Jones, D. "Calculating Tank Volume." Text. Accessed December 22, 2015.
         http://www.webcalc.com.br/blog/Tank_Volume.PDF'''
      R = D/2.
      Af = R*R*acos((R-h)/R) - (R-h)*(2*R*h - h*h)**0.5
      M = abs((R-h)/R)
      if h == R:
          Vf = a*R*R/3.*pi
      else:
          K = acos(M) + M*M*M*acosh(1./M) - 2.*M*(1.-M*M)**0.5
          if 0. <= h < R:
              Vf = 2.*a*R*R/3*K
          elif R < h <= 2*R:
              Vf = 2.*a*R*R/3*(pi - K)
      if headonly:
          Vf = 0.5*Vf
      else:
          Vf += Af*L
      return Vf