ó
¡¼™\c           @   sã   d  d l  m Z m Z m Z m Z m Z m Z m Z m Z	 m
 Z
 d  d l m Z m Z m Z m Z d  d l m Z m Z d  d l m Z m Z d  d l m Z d d g Z d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 „  Z d S(   iÿÿÿÿ(	   t   difft   expandt   sint   cost   sympifyt   eyet   symbolst   ImmutableMatrixt
   MatrixBase(   t   trigsimpt   solvet   Symbolt   Dummy(   t   string_typest   range(   t   Vectort   _check_vector(   t	   translatet   CoordinateSymt   ReferenceFramec           B   sA   e  Z d  Z d „  Z e d „  ƒ Z d „  Z d „  Z d „  Z RS(   s¦  
    A coordinate symbol/base scalar associated wrt a Reference Frame.

    Ideally, users should not instantiate this class. Instances of
    this class must only be accessed through the corresponding frame
    as 'frame[index]'.

    CoordinateSyms having the same frame and index parameters are equal
    (even though they may be instantiated separately).

    Parameters
    ==========

    name : string
        The display name of the CoordinateSym

    frame : ReferenceFrame
        The reference frame this base scalar belongs to

    index : 0, 1 or 2
        The index of the dimension denoted by this coordinate variable

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame, CoordinateSym
    >>> A = ReferenceFrame('A')
    >>> A[1]
    A_y
    >>> type(A[0])
    <class 'sympy.physics.vector.frame.CoordinateSym'>
    >>> a_y = CoordinateSym('a_y', A, 1)
    >>> a_y == A[1]
    True

    c         C   s~   i  } t  t |  ƒ j | |  ƒ t  t |  ƒ j |  | |  } t | ƒ | t d d ƒ k rk t d ƒ ‚ n  | | f | _ | S(   Ni    i   s   Invalid index specified(   t   superR   t	   _sanitizet   __xnew__t   _check_frameR   t
   ValueErrort   _id(   t   clst   namet   framet   indext   assumptionst   obj(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __new__1   s    
c         C   s   |  j  d S(   Ni    (   R   (   t   self(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR   =   s    c         C   s,   t  | t ƒ r( | j |  j k r( t Sn  t S(   N(   t
   isinstanceR   R   t   Truet   False(   R!   t   other(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __eq__A   s    c         C   s   |  | k S(   N(    (   R!   R%   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __ne__I   s    c         C   s*   t  |  j d j ƒ  |  j d f ƒ j ƒ  S(   Ni    i   (   t   tupleR   t   __hash__(   R!   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR)   L   s    (	   t   __name__t
   __module__t   __doc__R    t   propertyR   R&   R'   R)   (    (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR      s   $			c           B   sæ   e  Z d  Z d Z d d d d „ Z d „  Z d „  Z d „  Z e Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d d „ Z d d d d d „ Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d „  Z RS(   s÷  A reference frame in classical mechanics.

    ReferenceFrame is a class used to represent a reference frame in classical
    mechanics. It has a standard basis of three unit vectors in the frame's
    x, y, and z directions.

    It also can have a rotation relative to a parent frame; this rotation is
    defined by a direction cosine matrix relating this frame's basis vectors to
    the parent frame's basis vectors.  It can also have an angular velocity
    vector, defined in another frame.

    i    c         C   sl  t  | t ƒ s t d ƒ ‚ n  | d  k	 r‚t  | t t f ƒ sN t d ƒ ‚ n  t | ƒ d k ro t d ƒ ‚ n  x, | D]$ } t  | t ƒ sv t d ƒ ‚ qv qv W| d | d d | d | d	 d | d | d
 d g |  _ | j	 ƒ  d | d | j	 ƒ  d | d	 | j	 ƒ  d | d
 g |  _
 d | j	 ƒ  | d f d | j	 ƒ  | d	 f d | j	 ƒ  | d
 f g |  _ | |  _ n | d | d | d g |  _ | j	 ƒ  d | j	 ƒ  d | j	 ƒ  d g |  _
 d | j	 ƒ  d | j	 ƒ  d | j	 ƒ  g |  _ d d d g |  _ | d  k	 ržt  | t t f ƒ sBt d ƒ ‚ n  t | ƒ d k rct d ƒ ‚ n  x, | D]$ } t  | t ƒ sjt d ƒ ‚ qjqjW| |  _ n  | |  _ i  |  _ i  |  _ i  |  _ i  |  _ i  |  _ |  j |  j |  j g |  _ d |  _ t t d	 d d g ƒ |  f g ƒ |  _ t t d d	 d g ƒ |  f g ƒ |  _ t t d d d	 g ƒ |  f g ƒ |  _ | d  k	 rðt  | t t f ƒ st d ƒ ‚ n  t | ƒ d k r¾t d ƒ ‚ n  xJ | D]$ } t  | t ƒ sÅt d ƒ ‚ qÅqÅWn | d | d | d g } t | d |  d ƒ t | d	 |  d	 ƒ t | d
 |  d
 ƒ f |  _ t j d	 7_ t j |  _ d  S(!   s0  ReferenceFrame initialization method.

        A ReferenceFrame has a set of orthonormal basis vectors, along with
        orientations relative to other ReferenceFrames and angular velocities
        relative to other ReferenceFrames.

        Parameters
        ==========

        indices : list (of strings)
            If custom indices are desired for console, pretty, and LaTeX
            printing, supply three as a list. The basis vectors can then be
            accessed with the get_item method.
        latexs : list (of strings)
            If custom names are desired for LaTeX printing of each basis
            vector, supply the names here in a list.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, vlatex
        >>> N = ReferenceFrame('N')
        >>> N.x
        N.x
        >>> O = ReferenceFrame('O', indices=('1', '2', '3'))
        >>> O.x
        O['1']
        >>> O['1']
        O['1']
        >>> P = ReferenceFrame('P', latexs=('A1', 'A2', 'A3'))
        >>> vlatex(P.x)
        'A1'

        s   Need to supply a valid names   Supply the indices as a listi   s   Supply 3 indicess   Indices must be stringss   ['i    s   ']i   i   u   _s   \mathbf{\hat{%s}_{%s}}s   .xs   .ys   .zu   _xu   _yu   _zs   \mathbf{\hat{%s}_x}s   \mathbf{\hat{%s}_y}s   \mathbf{\hat{%s}_z}t   xt   yt   zs   Latex entries must be stringss)   Supply the variable names as a list/tuples   Supply 3 variable namess   Variable names must be stringst   _xt   _yt   _zN(   R"   R   t	   TypeErrort   NoneR(   t   listt   lenR   t   str_vecst   lowert   pretty_vecst
   latex_vecst   indicesR   t	   _var_dictt	   _dcm_dictt
   _dcm_cachet   _ang_vel_dictt   _ang_acc_dictt   _dlistt   _curR   t   MatrixR1   R2   R3   R   t   varlistR   t   _countR   (   R!   R   R<   t   latexst	   variablest   i(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __init___   s€    $							'''c         C   s“   t  | t ƒ s5 | d k  r& |  j | St d ƒ ‚ n  |  j d | k rO |  j S|  j d | k ri |  j S|  j d | k rƒ |  j St d ƒ ‚ d S(   sÃ   
        Returns basis vector for the provided index, if the index is a string.

        If the index is a number, returns the coordinate variable correspon-
        -ding to that index.
        i   s   Invalid index providedi    i   i   s   Not a defined indexN(   R"   R   RE   R   R<   R.   R/   R0   (   R!   t   ind(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __getitem__Ï   s    c         C   s   t  |  j |  j |  j g ƒ S(   N(   t   iterR.   R/   R0   (   R!   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __iter__ä   s    c         C   s   |  j  S(   s   Returns the name of the frame. (   R   (   R!   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   __str__ç   s    c         C   sG  |  g g } g  g } x¦ | | k r½ | } xŒ t  | ƒ D]~ \ } } | d j | j ƒ  } xX t  | ƒ D]J \ } }	 | j |	 ƒ sh | |	 g }
 | j |
 ƒ s² | j |
 ƒ q² qh qh Wq8 Wq Wx: t  | ƒ D], \ } } | d | k rË | j | ƒ qË qË W| j d t ƒ t | ƒ d k r%| d St d |  j	 d | j	 ƒ ‚ d S(   s3   Creates a list from self to other using _dcm_dict. iÿÿÿÿt   keyi    s!   No Connecting Path found between s    and N(
   t	   enumerateRB   t   keyst   __contains__t   appendt   removet   sortR7   R   R   (   R!   R%   t   numt   outlistt   oldlistRI   t   vt   templistt   i2t   v2t   littletemplist(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt
   _dict_listí   s&    	c   	      C   sµ   d d l  m } |  j | ƒ } | j | j ƒ } | | j } t t | d ƒ d t ƒ} t t | d ƒ d t ƒ} t t | d ƒ d t ƒ} t	 t
 | | | g ƒ |  f g ƒ S(   s4   Angular velocity from time differentiating the DCM. iÿÿÿÿ(   t   dynamicsymbolsi   t	   recursivei   i   (   t   sympy.physics.vector.functionsR`   t   dcmR    t   _tt   TR	   R   R#   R   RD   (	   R!   t
   otherframeR`   t   dcm2difft   diffedt	   angvelmatt   w1t   w2t   w3(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   _w_diff_dcm  s    c         C   sÕ   t  | ƒ | t j f |  j k r6 |  j | t j f S|  j | ƒ t | j ƒ } i  } x\ t |  ƒ D]N \ } } t j rž t | | d d ƒ| |  j | <qe | | | |  j | <qe W| |  j | t j f <| Sd S(   s4  
        Returns a dictionary which expresses the coordinate variables
        of this frame in terms of the variables of otherframe.

        If Vector.simp is True, returns a simplified version of the mapped
        values. Else, returns them without simplification.

        Simplification of the expressions may take time.

        Parameters
        ==========

        otherframe : ReferenceFrame
            The other frame to map the variables to

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, dynamicsymbols
        >>> A = ReferenceFrame('A')
        >>> q = dynamicsymbols('q')
        >>> B = A.orientnew('B', 'Axis', [q, A.z])
        >>> A.variable_map(B)
        {A_x: B_x*cos(q(t)) - B_y*sin(q(t)), A_y: B_x*sin(q(t)) + B_y*cos(q(t)), A_z: B_z}

        t   methodt   fuN(	   R   R   t   simpR=   Rc   RD   RE   RQ   R	   (   R!   Rf   t   vars_matrixt   mappingRI   R.   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   variable_map  s    
	$c         C   s>   t  | ƒ | |  j k r$ |  j | S|  j | ƒ j | ƒ Sd S(   s  Returns the angular acceleration Vector of the ReferenceFrame.

        Effectively returns the Vector:
        ^N alpha ^B
        which represent the angular acceleration of B in N, where B is self, and
        N is otherframe.

        Parameters
        ==========

        otherframe : ReferenceFrame
            The ReferenceFrame which the angular acceleration is returned in.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> N = ReferenceFrame('N')
        >>> A = ReferenceFrame('A')
        >>> V = 10 * N.x
        >>> A.set_ang_acc(N, V)
        >>> A.ang_acc_in(N)
        10*N.x

        N(   R   RA   t
   ang_vel_int   dt(   R!   Rf   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt
   ang_acc_in:  s    
c         C   sj   t  | ƒ |  j | d ƒ } t d ƒ } x; t t | ƒ d ƒ D]# } | | | j | | d 7} q? W| S(   s‘  Returns the angular velocity Vector of the ReferenceFrame.

        Effectively returns the Vector:
        ^N omega ^B
        which represent the angular velocity of B in N, where B is self, and
        N is otherframe.

        Parameters
        ==========

        otherframe : ReferenceFrame
            The ReferenceFrame which the angular velocity is returned in.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> N = ReferenceFrame('N')
        >>> A = ReferenceFrame('A')
        >>> V = 10 * N.x
        >>> A.set_ang_vel(N, V)
        >>> A.ang_vel_in(N)
        10*N.x

        i   i    (   R   R_   R   R   R7   R@   (   R!   Rf   t   flistt   outvecRI   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyRt   [  s    
!c         C   s¡   t  | ƒ | |  j k r$ |  j | S|  j | d ƒ } t d ƒ } x; t t | ƒ d ƒ D]# } | | | j | | d } qY W| |  j | <| j | j |  <| S(   sÝ  The direction cosine matrix between frames.

        This gives the DCM between this frame and the otherframe.
        The format is N.xyz = N.dcm(B) * B.xyz
        A SymPy Matrix is returned.

        Parameters
        ==========

        otherframe : ReferenceFrame
            The otherframe which the DCM is generated to.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> from sympy import symbols
        >>> q1 = symbols('q1')
        >>> N = ReferenceFrame('N')
        >>> A = N.orientnew('A', 'Axis', [q1, N.x])
        >>> N.dcm(A)
        Matrix([
        [1,       0,        0],
        [0, cos(q1), -sin(q1)],
        [0, sin(q1),  cos(q1)]])

        i    i   i   (   R   R?   R_   R   R   R7   R>   Re   (   R!   Rf   Rw   t   outdcmRI   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyRc   }  s    
!t    c   )      C   sÍ  d d l  m } t | ƒ | d k rG t | t ƒ s’ t d ƒ ‚ q’ nK t | ƒ } x< t | ƒ D]. \ } } t | t ƒ s` t	 | ƒ | | <q` q` Wd „  } d, }	 t
 t | ƒ d d ƒ } | j ƒ  } | |	 k rà t d ƒ ‚ n  g  }
 | d k r-| d k st d ƒ ‚ n  t | t t f ƒ t | ƒ d k @sAt d ƒ ‚ n  | d } | d } t | ƒ } | j | ƒ d k s…t d ƒ ‚ n  | j | ƒ j ƒ  } | j d d } t d ƒ | | j t | ƒ t d | d | d g | d d | d g | d | d d g g ƒ t | ƒ | | j }
 nÓ| d k r| d k sTt d ƒ ‚ n  t | t t f ƒ t | ƒ d  k @sˆt d! ƒ ‚ n  | \ } } } } t | d | d | d | d d | | | | d | | | | g d | | | | | d | d | d | d d | | | | g d | | | | d | | | | | d | d | d | d g g ƒ }
 n| d" k r0t | ƒ d t | ƒ @k o´d k n sÈt d# ƒ ‚ n  t | d ƒ } t | d ƒ } t | d ƒ } | | | d ƒ | | | d ƒ | | | d ƒ }
 nÐ | d$ k rßt | ƒ d t | ƒ @k ocd k n swt d% ƒ ‚ n  t | d ƒ } t | d ƒ } t | d ƒ } | | | d ƒ | | | d ƒ | | | d ƒ }
 n! | d k rô| }
 n t d& ƒ ‚ |  j j ƒ  } g  } g  } x: | D]2 } | |  j k rG| | g 7} n  | | g 7} q"Wx | D] } | j |  =q_Wx | D] } | j |  =qzWi  |  _ |  j d <|  j j  i |
 j | 6ƒ | j j  i |
 |  6ƒ i  |  _ |  j j  i |
 j | 6ƒ | j j  i |
 |  6ƒ | d k r	| j! } | \ } } } } t" | | ƒ } t" | | ƒ } t" | | ƒ } t" | | ƒ } d | | | | | | | | } d | | | | | | | | } d | | | | | | | | } t t | | | g ƒ |  f g ƒ }  nˆ| d k rK| d j" | j! ƒ }! |! | d j | ƒ j ƒ  }  nF| d k ri|  j# | ƒ }  n(yÿ d d' l$ m% }" d d( l  m& }# | \ } } } t' d) d* t( ƒ\ }$ }% }& |# |$ |% |& g | | | g | | ƒ }' g  |' D] } t) | ƒ ^ qä}' t* |' |$ |% |& g ƒ }( t) |( |$ ƒ }$ t) |( |% ƒ }% t) |( |& ƒ }& |$ |  j+ |% |  j, |& |  j- }  Wn& |" t. f k
 r|  j# | ƒ }  n X|  j/ j  i |  | 6ƒ | j/ j  i |  |  6ƒ i  |  _0 d+ S(-   s|
  Defines the orientation of this frame relative to a parent frame.

        Parameters
        ==========

        parent : ReferenceFrame
            The frame that this ReferenceFrame will have its orientation matrix
            defined in relation to.
        rot_type : str
            The type of orientation matrix that is being created. Supported
            types are 'Body', 'Space', 'Quaternion', 'Axis', and 'DCM'.
            See examples for correct usage.
        amounts : list OR value
            The quantities that the orientation matrix will be defined by.
            In case of rot_type='DCM', value must be a
            sympy.matrices.MatrixBase object (or subclasses of it).
        rot_order : str or int
            If applicable, the order of a series of rotations.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> from sympy import symbols, eye, ImmutableMatrix
        >>> q0, q1, q2, q3 = symbols('q0 q1 q2 q3')
        >>> N = ReferenceFrame('N')
        >>> B = ReferenceFrame('B')

        Now we have a choice of how to implement the orientation. First is
        Body. Body orientation takes this reference frame through three
        successive simple rotations. Acceptable rotation orders are of length
        3, expressed in XYZ or 123, and cannot have a rotation about about an
        axis twice in a row.

        >>> B.orient(N, 'Body', [q1, q2, q3], 123)
        >>> B.orient(N, 'Body', [q1, q2, 0], 'ZXZ')
        >>> B.orient(N, 'Body', [0, 0, 0], 'XYX')

        Next is Space. Space is like Body, but the rotations are applied in the
        opposite order.

        >>> B.orient(N, 'Space', [q1, q2, q3], '312')

        Next is Quaternion. This orients the new ReferenceFrame with
        Quaternions, defined as a finite rotation about lambda, a unit vector,
        by some amount theta.
        This orientation is described by four parameters:
        q0 = cos(theta/2)
        q1 = lambda_x sin(theta/2)
        q2 = lambda_y sin(theta/2)
        q3 = lambda_z sin(theta/2)
        Quaternion does not take in a rotation order.

        >>> B.orient(N, 'Quaternion', [q0, q1, q2, q3])

        Next is Axis. This is a rotation about an arbitrary, non-time-varying
        axis by some angle. The axis is supplied as a Vector. This is how
        simple rotations are defined.

        >>> B.orient(N, 'Axis', [q1, N.x + 2 * N.y])

        Last is DCM (Direction Cosine Matrix). This is a rotation matrix
        given manually.

        >>> B.orient(N, 'DCM', eye(3))
        >>> B.orient(N, 'DCM', ImmutableMatrix([[0, 1, 0], [0, 0, -1], [-1, 0, 0]]))

        iÿÿÿÿ(   R`   t   DCMs+   Amounts must be a sympy Matrix type object.c         S   sý   |  d k rS t  d d d g d t | ƒ t | ƒ g d t | ƒ t | ƒ g g ƒ S|  d k r¦ t  t | ƒ d t | ƒ g d d d g t | ƒ d t | ƒ g g ƒ S|  d k rù t  t | ƒ t | ƒ d g t | ƒ t | ƒ d g d d d g g ƒ Sd S(   s(   DCM for simple axis 1,2,or 3 rotations. i   i    i   i   N(   RD   R   R   (   t   axist   angle(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   _rotý  s     t   123t   231t   312t   132t   213t   321t   121t   131t   212t   232t   313t   323Rz   t   XYZxyzt   123123s*   The supplied order is not an approved typet   AXISs(   Axis orientation takes no rotation orderi   s'   Amounts are a list or tuple of length 2i    i   s   Axis cannot be time-varyingi   t
   QUATERNIONs.   Quaternion orientation takes no rotation orderi   s'   Amounts are a list or tuple of length 4t   BODYs*   Body orientation takes 3 values & 3 orderst   SPACEs+   Space orientation takes 3 values & 3 orderss#   That is not an implemented rotation(   t   CoercionFailed(   t   kinematic_equationss
   u1, u2, u3R   N(   R   R€   R   R‚   Rƒ   R„   R…   R†   R‡   Rˆ   R‰   RŠ   Rz   (1   Rb   R`   R   R"   R   R4   R6   RQ   R   R   R   t   strt   upperR(   R7   R   Ru   R   t   expresst	   normalizet   argsR   Re   R   RD   R   t   intt   NotImplementedErrorR?   RR   R>   RB   t   updateRd   R    Rm   t   sympy.polys.polyerrorsR‘   R’   R   R   R   R
   R.   R/   R0   t   AssertionErrorR@   R=   ()   R!   t   parentt   rot_typet   amountst	   rot_orderR`   RI   RZ   R~   t   approved_orderst   parent_orientt   thetaR|   t   q0t   q1t   q2t   q3t   a1t   a2t   a3t   framest   dcm_dict_delt   dcm_cache_delR   t   tt   q0dt   q1dt   q2dt   q3dRj   Rk   Rl   t   wvect   thetadR‘   R’   t   u1t   u2t   u3R[   t   td(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   orient¨  sÜ    F
	 %

‚%.2/;,8,8			&&&' 'c   	      C   s;   |  j  | d | d | d | ƒ} | j |  | | | ƒ | S(   sÀ  Creates a new ReferenceFrame oriented with respect to this Frame.

        See ReferenceFrame.orient() for acceptable rotation types, amounts,
        and orders. Parent is going to be self.

        Parameters
        ==========

        newname : str
            The name for the new ReferenceFrame
        rot_type : str
            The type of orientation matrix that is being created.
        amounts : list OR value
            The quantities that the orientation matrix will be defined by.
        rot_order : str
            If applicable, the order of a series of rotations.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> from sympy import symbols
        >>> q0, q1, q2, q3 = symbols('q0 q1 q2 q3')
        >>> N = ReferenceFrame('N')

        Now we have a choice of how to implement the orientation. First is
        Body. Body orientation takes this reference frame through three
        successive simple rotations. Acceptable rotation orders are of length
        3, expressed in XYZ or 123, and cannot have a rotation about about an
        axis twice in a row.

        >>> A = N.orientnew('A', 'Body', [q1, q2, q3], '123')
        >>> A = N.orientnew('A', 'Body', [q1, q2, 0], 'ZXZ')
        >>> A = N.orientnew('A', 'Body', [0, 0, 0], 'XYX')

        Next is Space. Space is like Body, but the rotations are applied in the
        opposite order.

        >>> A = N.orientnew('A', 'Space', [q1, q2, q3], '312')

        Next is Quaternion. This orients the new ReferenceFrame with
        Quaternions, defined as a finite rotation about lambda, a unit vector,
        by some amount theta.
        This orientation is described by four parameters:
        q0 = cos(theta/2)
        q1 = lambda_x sin(theta/2)
        q2 = lambda_y sin(theta/2)
        q3 = lambda_z sin(theta/2)
        Quaternion does not take in a rotation order.

        >>> A = N.orientnew('A', 'Quaternion', [q0, q1, q2, q3])

        Last is Axis. This is a rotation about an arbitrary, non-time-varying
        axis by some angle. The axis is supplied as a Vector. This is how
        simple rotations are defined.

        >>> A = N.orientnew('A', 'Axis', [q1, N.x])

        RH   R<   RG   (   t	   __class__R¹   (	   R!   t   newnameRž   RŸ   R    RH   R<   RG   t   newframe(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt	   orientnew}  s    >c         C   sd   | d k r t  d ƒ } n  t | ƒ } t | ƒ |  j j i | | 6ƒ | j j i | |  6ƒ d S(   s5  Define the angular acceleration Vector in a ReferenceFrame.

        Defines the angular acceleration of this ReferenceFrame, in another.
        Angular acceleration can be defined with respect to multiple different
        ReferenceFrames. Care must be taken to not create loops which are
        inconsistent.

        Parameters
        ==========

        otherframe : ReferenceFrame
            A ReferenceFrame to define the angular acceleration in
        value : Vector
            The Vector representing angular acceleration

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> N = ReferenceFrame('N')
        >>> A = ReferenceFrame('A')
        >>> V = 10 * N.x
        >>> A.set_ang_acc(N, V)
        >>> A.ang_acc_in(N)
        10*N.x

        i    N(   R   R   R   RA   Rš   (   R!   Rf   t   value(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   set_ang_accÀ  s    
c         C   sd   | d k r t  d ƒ } n  t | ƒ } t | ƒ |  j j i | | 6ƒ | j j i | |  6ƒ d S(   s!  Define the angular velocity vector in a ReferenceFrame.

        Defines the angular velocity of this ReferenceFrame, in another.
        Angular velocity can be defined with respect to multiple different
        ReferenceFrames. Care must be taken to not create loops which are
        inconsistent.

        Parameters
        ==========

        otherframe : ReferenceFrame
            A ReferenceFrame to define the angular velocity in
        value : Vector
            The Vector representing angular velocity

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, Vector
        >>> N = ReferenceFrame('N')
        >>> A = ReferenceFrame('A')
        >>> V = 10 * N.x
        >>> A.set_ang_vel(N, V)
        >>> A.ang_vel_in(N)
        10*N.x

        i    N(   R   R   R   R@   Rš   (   R!   Rf   R¾   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   set_ang_velä  s    
c         C   s   |  j  S(   s=   The basis Vector for the ReferenceFrame, in the x direction. (   R1   (   R!   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR.     s    c         C   s   |  j  S(   s=   The basis Vector for the ReferenceFrame, in the y direction. (   R2   (   R!   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR/     s    c         C   s   |  j  S(   s=   The basis Vector for the ReferenceFrame, in the z direction. (   R3   (   R!   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR0     s    c         G   s\   g  | D]' } |  j  | ƒ j | | d t ƒ^ q } t | ƒ d k rN | d St | ƒ Sd S(   s¬  Returns the partial angular velocities of this frame in the given
        frame with respect to one or more provided generalized speeds.

        Parameters
        ==========
        frame : ReferenceFrame
            The frame with which the angular velocity is defined in.
        gen_speeds : functions of time
            The generalized speeds.

        Returns
        =======
        partial_velocities : tuple of Vector
            The partial angular velocity vectors corresponding to the provided
            generalized speeds.

        Examples
        ========

        >>> from sympy.physics.vector import ReferenceFrame, dynamicsymbols
        >>> N = ReferenceFrame('N')
        >>> A = ReferenceFrame('A')
        >>> u1, u2 = dynamicsymbols('u1, u2')
        >>> A.set_ang_vel(N, u1 * A.x + u2 * N.y)
        >>> A.partial_velocity(N, u1)
        A.x
        >>> A.partial_velocity(N, u1, u2)
        (A.x, N.y)

        t
   var_in_dcmi   i    N(   Rt   R    R$   R7   R(   (   R!   R   t
   gen_speedst   speedt   partials(    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   partial_velocity  s
     1N(   R*   R+   R,   RF   R5   RJ   RL   RN   RO   t   __repr__R_   Rm   Rs   Rv   Rt   Rc   R¹   R½   R¿   RÀ   R-   R.   R/   R0   RÅ   (    (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR   P   s,   p						*	!	"	+ÕB	$	$c         C   s;   d d l  m } t |  t ƒ s7 | |  t d ƒ ƒ ‚ n  d  S(   Ni   (   t   VectorTypeErrort   A(   t   vectorRÇ   R"   R   (   R%   RÇ   (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyR   @  s    N(   t   sympy.core.backendR    R   R   R   R   R   R   R   RD   R   t   sympyR	   R
   R   R   t   sympy.core.compatibilityR   R   t   sympy.physics.vector.vectorR   R   t   sympy.utilities.miscR   t   __all__R   t   objectR   R   (    (    (    s9   lib/python2.7/site-packages/sympy/physics/vector/frame.pyt   <module>   s   @"Eÿ ÿ ò