def Lagrangian(frame, *body):
 if (not isinstance(frame, ReferenceFrame)):
  raise TypeError('Please supply a valid ReferenceFrame')
 for e in body:
  if (not isinstance(e, (RigidBody, Particle))):
   raise TypeError('*body must have only Particle or RigidBody')
 return (kinetic_energy(frame, *body) - potential_energy(*body))

def Lagrangian ( frame , * body ) : if ( not isinstance ( frame , ReferenceFrame ) ) : raise TypeError ( 'Please supply a valid ReferenceFrame' ) for e in body : if ( not isinstance ( e , ( RigidBody , Particle ) ) ) : raise TypeError ( '*body must have only Particle or RigidBody' ) return ( kinetic_energy ( frame , * body ) - potential_energy ( * body ) )
lagrangian of a multibody system .