code: def rtide(Pot,R,z,phi=0.,t=0.,M=None):
      
      Pot= flatten(Pot)
      if M is None:
          #Make sure an object mass is given
          raise PotentialError("Mass parameter M= needs to be set to compute tidal radius")
      r= nu.sqrt(R**2.+z**2.)
      omegac2=-evaluaterforces(Pot,R,z,phi=phi,t=t,use_physical=False)/r
      d2phidr2= evaluater2derivs(Pot,R,z,phi=phi,t=t,use_physical=False)
      return (M/(omegac2-d2phidr2))**(1./3.)
docs: NAME:
          
          rtide
              
      PURPOSE:
          
          Calculate the tidal radius for object of mass M assuming a circular orbit as
  
          .. math::
  
             r_t^3 = \\frac{GM_s}{\\Omega^2-\\mathrm{d}^2\\Phi/\\mathrm{d}r^2}
  
          where :math:`M_s` is the cluster mass, :math:`\\Omega` is the circular frequency, and :math:`\Phi` is the gravitational potential. For non-spherical potentials, we evaluate :math:`\\Omega^2 = (1/r)(\\mathrm{d}\\Phi/\\mathrm{d}r)` and evaluate the derivatives at the given position of the cluster.
  
      INPUT:
          
          Pot - Potential instance or list of such instances
  
          R - Galactocentric radius (can be Quantity)
              
          z - height (can be Quantity)
              
          phi - azimuth (optional; can be Quantity)
              
          t - time (optional; can be Quantity)
          
          M - (default = None) Mass of object (can be Quantity)
              
      OUTPUT:
          
          Tidal Radius
          
      HISTORY:
          
          2018-03-21 - Written - Webb (UofT)