ó
~9­\c           @  se  d  Z  d d l m Z m Z d d l m Z m Z m Z m Z d d l	 m
 Z
 d d l m Z d d l m Z m Z m Z d d l m Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z d d l m Z d d l m Z e d d i d g d 6ƒZ e d d i d g d 6ƒZ i d g d f 6Z  d e! f d „  ƒ  YZ" d e" f d „  ƒ  YZ# d S(   sd   
This module can be used to solve 2D beam bending problems with
singularity functions in mechanics.
iÿÿÿÿ(   t   print_functiont   division(   t   St   Symbolt   difft   symbols(   t   linsolve(   t   sstr(   t   SingularityFunctiont	   Piecewiset	   factorial(   t   sympify(   t	   integrate(   t   limit(   t   plot(   t   import_module(   t   doctest_depends_on(   t   lambdifyt
   matplotlibt   __import__kwargst   pyplott   fromlistt   numpyt   linspaces   Beam.plot_loading_resultst   Beamc           B  s  e  Z d  Z e d ƒ d d „ Z d „  Z e d „  ƒ Z e d „  ƒ Z e j	 d „  ƒ Z e d „  ƒ Z
 e
 j	 d	 „  ƒ Z
 e d
 „  ƒ Z e j	 d „  ƒ Z e d „  ƒ Z e j	 d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e j	 d „  ƒ Z e d „  ƒ Z e j	 d „  ƒ Z d d „ Z d d „ Z d, d „ Z d, d „ Z e d „  ƒ Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d  „  Z d! „  Z d" „  Z d# „  Z  d, d$ „ Z! d, d% „ Z" d, d& „ Z# d, d' „ Z$ e% d( d- ƒ d, d+ „ ƒ Z& RS(.   sü  
    A Beam is a structural element that is capable of withstanding load
    primarily by resisting against bending. Beams are characterized by
    their cross sectional profile(Second moment of area), their length
    and their material.

    .. note::
       While solving a beam bending problem, a user should choose its
       own sign convention and should stick to it. The results will
       automatically follow the chosen sign convention.

    Examples
    ========
    There is a beam of length 4 meters. A constant distributed load of 6 N/m
    is applied from half of the beam till the end. There are two simple supports
    below the beam, one at the starting point and another at the ending point
    of the beam. The deflection of the beam at the end is restricted.

    Using the sign convention of downwards forces being positive.

    >>> from sympy.physics.continuum_mechanics.beam import Beam
    >>> from sympy import symbols, Piecewise
    >>> E, I = symbols('E, I')
    >>> R1, R2 = symbols('R1, R2')
    >>> b = Beam(4, E, I)
    >>> b.apply_load(R1, 0, -1)
    >>> b.apply_load(6, 2, 0)
    >>> b.apply_load(R2, 4, -1)
    >>> b.bc_deflection = [(0, 0), (4, 0)]
    >>> b.boundary_conditions
    {'deflection': [(0, 0), (4, 0)], 'slope': []}
    >>> b.load
    R1*SingularityFunction(x, 0, -1) + R2*SingularityFunction(x, 4, -1) + 6*SingularityFunction(x, 2, 0)
    >>> b.solve_for_reaction_loads(R1, R2)
    >>> b.load
    -3*SingularityFunction(x, 0, -1) + 6*SingularityFunction(x, 2, 0) - 9*SingularityFunction(x, 4, -1)
    >>> b.shear_force()
    -3*SingularityFunction(x, 0, 0) + 6*SingularityFunction(x, 2, 1) - 9*SingularityFunction(x, 4, 0)
    >>> b.bending_moment()
    -3*SingularityFunction(x, 0, 1) + 3*SingularityFunction(x, 2, 2) - 9*SingularityFunction(x, 4, 1)
    >>> b.slope()
    (-3*SingularityFunction(x, 0, 2)/2 + SingularityFunction(x, 2, 3) - 9*SingularityFunction(x, 4, 2)/2 + 7)/(E*I)
    >>> b.deflection()
    (7*x - SingularityFunction(x, 0, 3)/2 + SingularityFunction(x, 2, 4)/4 - 3*SingularityFunction(x, 4, 3)/2)/(E*I)
    >>> b.deflection().rewrite(Piecewise)
    (7*x - Piecewise((x**3, x > 0), (0, True))/2
         - 3*Piecewise(((x - 4)**3, x - 4 > 0), (0, True))/2
         + Piecewise(((x - 2)**4, x - 2 > 0), (0, True))/4)/(E*I)
    t   xt   Cc         C  su   | |  _  | |  _ | |  _ | |  _ | |  _ i g  d 6g  d 6|  _ d |  _ g  |  _ i  |  _ d |  _
 d |  _ d S(   sã  Initializes the class.

        Parameters
        ==========
        length : Sympifyable
            A Symbol or value representing the Beam's length.
        elastic_modulus : Sympifyable
            A SymPy expression representing the Beam's Modulus of Elasticity.
            It is a measure of the stiffness of the Beam material. It can
            also be a continuous function of position along the beam.
        second_moment : Sympifyable
            A SymPy expression representing the Beam's Second moment of area.
            It is a geometrical property of an area which reflects how its
            points are distributed with respect to its neutral axis. It can
            also be a continuous function of position along the beam.
        variable : Symbol, optional
            A Symbol object that will be used as the variable along the beam
            while representing the load, shear, moment, slope and deflection
            curve. By default, it is set to ``Symbol('x')``.
        base_char : String, optional
            A String that will be used as base character to generate sequential
            symbols for integration constants in cases where boundary conditions
            are not sufficient to solve them.
        t
   deflectiont   slopei    N(   t   lengtht   elastic_modulust   second_momentt   variablet
   _base_chart   _boundary_conditionst   _loadt   _applied_loadst   _reaction_loadst   Nonet   _composite_typet   _hinge_position(   t   selfR   R   R   R    t	   base_char(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   __init__N   s    									c         C  s4   d j  t |  j ƒ t |  j ƒ t |  j ƒ ƒ } | S(   Ns   Beam({}, {}, {})(   t   formatR   t   _lengtht   _elastic_modulust   _second_moment(   R)   t   str_sol(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   __str__s   s    0c         C  s   |  j  S(   s-    Returns the reaction forces in a dictionary.(   R%   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   reaction_loadsw   s    c         C  s   |  j  S(   s   Length of the Beam.(   R-   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   |   s    c         C  s   t  | ƒ |  _ d  S(   N(   R   R-   (   R)   t   l(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR      s    c         C  s   |  j  S(   s¼  
        A symbol that can be used as a variable along the length of the beam
        while representing load distribution, shear force curve, bending
        moment, slope curve and the deflection curve. By default, it is set
        to ``Symbol('x')``, but this property is mutable.

        Examples
        ========

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> x, y, z = symbols('x, y, z')
        >>> b = Beam(4, E, I)
        >>> b.variable
        x
        >>> b.variable = y
        >>> b.variable
        y
        >>> b = Beam(4, E, I, z)
        >>> b.variable
        z
        (   t	   _variable(   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR    …   s    c         C  s+   t  | t ƒ r | |  _ n t d ƒ ‚ d  S(   Ns'   The variable should be a Symbol object.(   t
   isinstanceR   R4   t	   TypeError(   R)   t   v(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR        s    c         C  s   |  j  S(   s   Young's Modulus of the Beam. (   R.   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   §   s    c         C  s   t  | ƒ |  _ d  S(   N(   R   R.   (   R)   t   e(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   ¬   s    c         C  s   |  j  S(   s#   Second moment of area of the Beam. (   R/   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   °   s    c         C  s   t  | ƒ |  _ d  S(   N(   R   R/   (   R)   t   i(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   µ   s    c         C  s   |  j  S(   s  
        Returns a dictionary of boundary conditions applied on the beam.
        The dictionary has three kewwords namely moment, slope and deflection.
        The value of each keyword is a list of tuple, where each tuple
        contains loaction and value of a boundary condition in the format
        (location, value).

        Examples
        ========
        There is a beam of length 4 meters. The bending moment at 0 should be 4
        and at 4 it should be 0. The slope of the beam should be 1 at 0. The
        deflection should be 2 at 0.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(4, E, I)
        >>> b.bc_deflection = [(0, 2)]
        >>> b.bc_slope = [(0, 1)]
        >>> b.boundary_conditions
        {'deflection': [(0, 2)], 'slope': [(0, 1)]}

        Here the deflection of the beam should be ``2`` at ``0``.
        Similarly, the slope of the beam should be ``1`` at ``0``.
        (   R"   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   boundary_conditions¹   s    c         C  s   |  j  d S(   NR   (   R"   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   bc_slopeÖ   s    c         C  s   | |  j  d <d  S(   NR   (   R"   (   R)   t   s_bcs(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR;   Ú   s    c         C  s   |  j  d S(   NR   (   R"   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   bc_deflectionÞ   s    c         C  s   | |  j  d <d  S(   NR   (   R"   (   R)   t   d_bcs(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR=   â   s    t   fixedc         C  sÜ   |  j  } |  j } |  j | j } |  j | j k rg t |  j | |  j k f | j | | k f ƒ } n	 |  j } | d k rž t | | | | ƒ } d | _ | S| d k rØ t | | | | ƒ } d | _ |  j | _ | Sd S(   s  
        This method joins two beams to make a new composite beam system.
        Passed Beam class instance is attached to the right end of calling
        object. This method can be used to form beams having Discontinuous
        values of Elastic modulus or Second moment.

        Parameters
        ==========
        beam : Beam class object
            The Beam object which would be connected to the right of calling
            object.
        via : String
            States the way two Beam object would get connected
            - For axially fixed Beams, via="fixed"
            - For Beams connected via hinge, via="hinge"

        Examples
        ========
        There is a cantilever beam of length 4 meters. For first 2 meters
        its moment of inertia is `1.5*I` and `I` for the other end.
        A pointload of magnitude 4 N is applied from the top at its free end.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> R1, R2 = symbols('R1, R2')
        >>> b1 = Beam(2, E, 1.5*I)
        >>> b2 = Beam(2, E, I)
        >>> b = b1.join(b2, "fixed")
        >>> b.apply_load(20, 4, -1)
        >>> b.apply_load(R1, 0, -1)
        >>> b.apply_load(R2, 0, -2)
        >>> b.bc_slope = [(0, 0)]
        >>> b.bc_deflection = [(0, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.load
        80*SingularityFunction(x, 0, -2) - 20*SingularityFunction(x, 0, -1) + 20*SingularityFunction(x, 4, -1)
        >>> b.slope()
        (((80*SingularityFunction(x, 0, 1) - 10*SingularityFunction(x, 0, 2) + 10*SingularityFunction(x, 4, 2))/I - 120/I)/E + 80.0/(E*I))*SingularityFunction(x, 2, 0)
        + 0.666666666666667*(80*SingularityFunction(x, 0, 1) - 10*SingularityFunction(x, 0, 2) + 10*SingularityFunction(x, 4, 2))*SingularityFunction(x, 0, 0)/(E*I)
        - 0.666666666666667*(80*SingularityFunction(x, 0, 1) - 10*SingularityFunction(x, 0, 2) + 10*SingularityFunction(x, 4, 2))*SingularityFunction(x, 2, 0)/(E*I)
        R?   t   hingeN(   R    R   R   R   R	   R   R'   R(   (   R)   t   beamt   viaR   t   Et
   new_lengtht   new_second_momentt   new_beam(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   joinæ   s     +					c         C  sÜ   | d k s | d k rZ t  d t | ƒ ƒ } |  j | | d ƒ |  j j | d f ƒ n~ t  d t | ƒ ƒ } t  d t | ƒ ƒ } |  j | | d ƒ |  j | | d ƒ |  j j | d f ƒ |  j j | d f ƒ d S(	   s.  
        This method applies support to a particular beam object.

        Parameters
        ==========
        loc : Sympifyable
            Location of point at which support is applied.
        type : String
            Determines type of Beam support applied. To apply support structure
            with
            - zero degree of freedom, type = "fixed"
            - one degree of freedom, type = "pin"
            - two degrees of freedom, type = "roller"

        Examples
        ========
        There is a beam of length 30 meters. A moment of magnitude 120 Nm is
        applied in the clockwise direction at the end of the beam. A pointload
        of magnitude 8 N is applied from the top of the beam at the starting
        point. There are two simple supports below the beam. One at the end
        and another one at a distance of 10 meters from the start. The
        deflection is restricted at both the supports.

        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(30, E, I)
        >>> b.apply_support(10, 'roller')
        >>> b.apply_support(30, 'roller')
        >>> b.apply_load(-8, 0, -1)
        >>> b.apply_load(120, 30, -2)
        >>> R_10, R_30 = symbols('R_10, R_30')
        >>> b.solve_for_reaction_loads(R_10, R_30)
        >>> b.load
        -8*SingularityFunction(x, 0, -1) + 6*SingularityFunction(x, 10, -1)
        + 120*SingularityFunction(x, 30, -2) + 2*SingularityFunction(x, 30, -1)
        >>> b.slope()
        (-4*SingularityFunction(x, 0, 2) + 3*SingularityFunction(x, 10, 2)
            + 120*SingularityFunction(x, 30, 1) + SingularityFunction(x, 30, 2) + 4000/3)/(E*I)
        t   pint   rollert   R_iÿÿÿÿi    t   M_iþÿÿÿN(   R   t   strt
   apply_loadR=   t   appendR;   (   R)   t   loct   typet   reaction_loadt   reaction_moment(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   apply_support%  s    ,c   	      C  s  |  j  } t | ƒ } t | ƒ } t | ƒ } |  j j | | | | f ƒ |  j | t | | | ƒ 7_ | r | j rŒ d } t | ƒ ‚ n  | | | } xc t d | d ƒ D]K } |  j | j	 | | ƒ j
 | | | ƒ t | | | ƒ t | ƒ 8_ q® Wn  d S(   s*  
        This method adds up the loads given to a particular beam object.

        Parameters
        ==========
        value : Sympifyable
            The magnitude of an applied load.
        start : Sympifyable
            The starting point of the applied load. For point moments and
            point forces this is the location of application.
        order : Integer
            The order of the applied load.

               - For moments, order = -2
               - For point loads, order =-1
               - For constant distributed load, order = 0
               - For ramp loads, order = 1
               - For parabolic ramp loads, order = 2
               - ... so on.

        end : Sympifyable, optional
            An optional argument that can be used if the load has an end point
            within the length of the beam.

        Examples
        ========
        There is a beam of length 4 meters. A moment of magnitude 3 Nm is
        applied in the clockwise direction at the starting point of the beam.
        A point load of magnitude 4 N is applied from the top of the beam at
        2 meters from the starting point and a parabolic ramp load of magnitude
        2 N/m is applied below the beam starting from 2 meters to 3 meters
        away from the starting point of the beam.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(4, E, I)
        >>> b.apply_load(-3, 0, -2)
        >>> b.apply_load(4, 2, -1)
        >>> b.apply_load(-2, 2, 2, end=3)
        >>> b.load
        -3*SingularityFunction(x, 0, -2) + 4*SingularityFunction(x, 2, -1) - 2*SingularityFunction(x, 2, 2) + 2*SingularityFunction(x, 3, 0) + 4*SingularityFunction(x, 3, 1) + 2*SingularityFunction(x, 3, 2)

        sp   If 'end' is provided the 'order' of the load cannot be negative, i.e. 'end' is only valid for distributed loads.i    i   N(   R    R   R$   RN   R#   R   t   is_negativet
   ValueErrort   rangeR   t   subsR
   (	   R)   t   valuet   startt   ordert   endR   t   msgt   fR9   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRM   ]  s    -		c   	      C  s4  |  j  } t | ƒ } t | ƒ } t | ƒ } | | | | f |  j k r† |  j | t | | | ƒ 8_ |  j j | | | | f ƒ n d } t | ƒ ‚ | r0| j r¼ d } t | ƒ ‚ n  | | | } xc t d | d ƒ D]K } |  j | j	 | | ƒ j
 | | | ƒ t | | | ƒ t | ƒ 7_ qÞ Wn  d S(   sû  
        This method removes a particular load present on the beam object.
        Returns a ValueError if the load passed as an argument is not
        present on the beam.

        Parameters
        ==========
        value : Sympifyable
            The magnitude of an applied load.
        start : Sympifyable
            The starting point of the applied load. For point moments and
            point forces this is the location of application.
        order : Integer
            The order of the applied load.
            - For moments, order= -2
            - For point loads, order=-1
            - For constant distributed load, order=0
            - For ramp loads, order=1
            - For parabolic ramp loads, order=2
            - ... so on.
        end : Sympifyable, optional
            An optional argument that can be used if the load has an end point
            within the length of the beam.

        Examples
        ========
        There is a beam of length 4 meters. A moment of magnitude 3 Nm is
        applied in the clockwise direction at the starting point of the beam.
        A pointload of magnitude 4 N is applied from the top of the beam at
        2 meters from the starting point and a parabolic ramp load of magnitude
        2 N/m is applied below the beam starting from 2 meters to 3 meters
        away from the starting point of the beam.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(4, E, I)
        >>> b.apply_load(-3, 0, -2)
        >>> b.apply_load(4, 2, -1)
        >>> b.apply_load(-2, 2, 2, end=3)
        >>> b.load
        -3*SingularityFunction(x, 0, -2) + 4*SingularityFunction(x, 2, -1) - 2*SingularityFunction(x, 2, 2) + 2*SingularityFunction(x, 3, 0) + 4*SingularityFunction(x, 3, 1) + 2*SingularityFunction(x, 3, 2)
        >>> b.remove_load(-2, 2, 2, end = 3)
        >>> b.load
        -3*SingularityFunction(x, 0, -2) + 4*SingularityFunction(x, 2, -1)
        s4   No such load distribution exists on the beam object.sp   If 'end' is provided the 'order' of the load cannot be negative, i.e. 'end' is only valid for distributed loads.i    i   N(   R    R   R$   R#   R   t   removeRU   RT   RV   R   RW   R
   (	   R)   RX   RY   RZ   R[   R   R\   R]   R9   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   remove_load   s"    /		c         C  s   |  j  S(   sâ  
        Returns a Singularity Function expression which represents
        the load distribution curve of the Beam object.

        Examples
        ========
        There is a beam of length 4 meters. A moment of magnitude 3 Nm is
        applied in the clockwise direction at the starting point of the beam.
        A point load of magnitude 4 N is applied from the top of the beam at
        2 meters from the starting point and a parabolic ramp load of magnitude
        2 N/m is applied below the beam starting from 3 meters away from the
        starting point of the beam.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(4, E, I)
        >>> b.apply_load(-3, 0, -2)
        >>> b.apply_load(4, 2, -1)
        >>> b.apply_load(-2, 3, 2)
        >>> b.load
        -3*SingularityFunction(x, 0, -2) + 4*SingularityFunction(x, 2, -1) - 2*SingularityFunction(x, 3, 2)
        (   R#   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   loadì  s    c         C  s   |  j  S(   sß  
        Returns a list of all loads applied on the beam object.
        Each load in the list is a tuple of form (value, start, order, end).

        Examples
        ========
        There is a beam of length 4 meters. A moment of magnitude 3 Nm is
        applied in the clockwise direction at the starting point of the beam.
        A pointload of magnitude 4 N is applied from the top of the beam at
        2 meters from the starting point. Another pointload of magnitude 5 N
        is applied at same position.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(4, E, I)
        >>> b.apply_load(-3, 0, -2)
        >>> b.apply_load(4, 2, -1)
        >>> b.apply_load(5, 2, -1)
        >>> b.load
        -3*SingularityFunction(x, 0, -2) + 9*SingularityFunction(x, 2, -1)
        >>> b.applied_loads
        [(-3, 0, -2, None), (4, 2, -1, None), (5, 2, -1, None)]
        (   R$   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   applied_loads  s    c   !   	   G  sz  |  j  } |  j } |  j } |  j } t | t ƒ rX | j d d } | j d d } n
 | } } d } d }	 x|  j D]}
 |
 d | k  rE| |
 d t | |
 d |
 d ƒ 7} |
 d d k rí | |
 d t | |
 d |
 d ƒ 8} q|
 d d k r| |
 d t | |
 d |
 d ƒ |
 d t | |
 d d ƒ 8} qqx |
 d | k r¨| |
 d t | |
 d |
 d ƒ 7} |	 |
 d t | |
 d | |
 d ƒ 7}	 qx |
 d | k rx |	 |
 d t | |
 d | |
 d ƒ 7}	 |
 d d k r|	 |
 d t | |
 d | |
 d ƒ 8}	 q|
 d d k r|	 |
 d t | |
 d | |
 d ƒ |
 d t | |
 d | d ƒ 8}	 qqx qx Wt	 d ƒ } | | t | | d ƒ 7} |	 | t | d d ƒ 8}	 g  } t
 | | ƒ } t | | | ƒ } | j | ƒ t
 | | ƒ } t | | | ƒ } | j | ƒ t
 |	 | ƒ } t | | |  j | ƒ } | j | ƒ t
 | | ƒ } t | | |  j | ƒ } | j | ƒ t	 d ƒ } t	 d ƒ } t	 d	 ƒ } t	 d
 ƒ } t d ƒ | | t
 | | ƒ | } t d ƒ | | t
 | | | | ƒ | | | } t d ƒ | | t
 t
 t
 |	 | ƒ | ƒ | ƒ | } t d ƒ | | t
 | | | | ƒ | } xd |  j D]Y \ } } | | k  r¿| j | j | | ƒ | ƒ q‡| j | j | | | ƒ | ƒ q‡Wxd |  j D]Y \ } } | | k  r&| j | j | | ƒ | ƒ qî| j | j | | | ƒ | ƒ qîW| j | j | | ƒ | j | d ƒ ƒ t t | | | | | | | Œ ƒ } t | d ƒ d }  t t | |  ƒ ƒ |  _ |  j j |  j ƒ |  _ | j i | d d | 6| d d | 6ƒ j |  j ƒ } | j i | d d | 6| d d | 6| d d | 6ƒ j |  j ƒ } | j i | | | 6| d d | 6| d d | 6ƒ j |  j ƒ } | j i | | | 6| d d | 6| d d | 6| d d | 6ƒ j |  j ƒ } | t | d d ƒ | t | | d ƒ | t | | d ƒ |  _ | t | d d ƒ | t | | d ƒ | t | | d ƒ |  _ d S(   s3  Method to find integration constants and reactional variables in a
        composite beam connected via hinge.
        This method resolves the composite Beam into its sub-beams and then
        equations of shear force, bending moment, slope and deflection are
        evaluated for both of them separately. These equations are then solved
        for unknown reactions and integration constants using the boundary
        conditions applied on the Beam. Equal deflection of both sub-beams
        at the hinge joint gives us another equation to solve the system.

        Examples
        ========
        A combined beam, with constant fkexural rigidity E*I, is formed by joining
        a Beam of length 2*l to the right of another Beam of length l. The whole beam
        is fixed at both of its both end. A point load of magnitude P is also applied
        from the top at a distance of 2*l from starting point.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> l=symbols('l', positive=True)
        >>> b1=Beam(l ,E,I)
        >>> b2=Beam(2*l ,E,I)
        >>> b=b1.join(b2,"hinge")
        >>> M1, A1, M2, A2, P = symbols('M1 A1 M2 A2 P')
        >>> b.apply_load(A1,0,-1)
        >>> b.apply_load(M1,0,-2)
        >>> b.apply_load(P,2*l,-1)
        >>> b.apply_load(A2,3*l,-1)
        >>> b.apply_load(M2,3*l,-2)
        >>> b.bc_slope=[(0,0), (3*l, 0)]
        >>> b.bc_deflection=[(0,0), (3*l, 0)]
        >>> b.solve_for_reaction_loads(M1, A1, M2, A2)
        >>> b.reaction_loads
        {A1: -5*P/18, A2: -13*P/18, M1: 5*P*l/18, M2: -4*P*l/9}
        >>> b.slope()
        (5*P*l*SingularityFunction(x, 0, 1)/18 - 5*P*SingularityFunction(x, 0, 2)/36 + 5*P*SingularityFunction(x, l, 2)/36)*SingularityFunction(x, 0, 0)/(E*I)
        - (5*P*l*SingularityFunction(x, 0, 1)/18 - 5*P*SingularityFunction(x, 0, 2)/36 + 5*P*SingularityFunction(x, l, 2)/36)*SingularityFunction(x, l, 0)/(E*I)
        + (P*l**2/18 - 4*P*l*SingularityFunction(-l + x, 2*l, 1)/9 - 5*P*SingularityFunction(-l + x, 0, 2)/36 + P*SingularityFunction(-l + x, l, 2)/2
        - 13*P*SingularityFunction(-l + x, 2*l, 2)/36)*SingularityFunction(x, l, 0)/(E*I)
        >>> b.deflection()
        (5*P*l*SingularityFunction(x, 0, 2)/36 - 5*P*SingularityFunction(x, 0, 3)/108 + 5*P*SingularityFunction(x, l, 3)/108)*SingularityFunction(x, 0, 0)/(E*I)
        - (5*P*l*SingularityFunction(x, 0, 2)/36 - 5*P*SingularityFunction(x, 0, 3)/108 + 5*P*SingularityFunction(x, l, 3)/108)*SingularityFunction(x, l, 0)/(E*I)
        + (5*P*l**3/54 + P*l**2*(-l + x)/18 - 2*P*l*SingularityFunction(-l + x, 2*l, 2)/9 - 5*P*SingularityFunction(-l + x, 0, 3)/108 + P*SingularityFunction(-l + x, l, 3)/6
        - 13*P*SingularityFunction(-l + x, 2*l, 3)/108)*SingularityFunction(x, l, 0)/(E*I)
        i    i   i   i   t   hiÿÿÿÿt   C1t   C2t   C3t   C4i   i   N(   R    R(   R.   R/   R5   R	   t   argsRa   R   R   R   R   RN   R   R   R;   RW   R=   t   listR   t   dictt   zipR%   R#   t   _hinge_beam_slopet   _hinge_beam_deflection(!   R)   t	   reactionsR   R3   RC   t   It   I1t   I2t   load_1t   load_2R`   Rb   t   eqt   shear_1t   shear_curve_1t	   bending_1t   moment_curve_1t   shear_2t   shear_curve_2t	   bending_2t   moment_curve_2Rc   Rd   Re   Rf   t   slope_1t   def_1t   slope_2t   def_2t   positionRX   t	   constantst   reaction_values(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   _solve_hinge_beams#  sŠ    .				
&)H&-*-T%57- % %)$9HDSAc         G  s¢  |  j  d k r |  j | Œ  S|  j } |  j } t d ƒ } t d ƒ } t |  j ƒ  | | ƒ } t |  j ƒ  | | ƒ } g  } g  }	 t |  j ƒ  | ƒ | }
 x> |  j	 d D]/ \ } } |
 j
 | | ƒ | } | j | ƒ q© Wt |
 | ƒ | } x> |  j	 d D]/ \ } } | j
 | | ƒ | } |	 j | ƒ qý Wt t | | g | |	 | | f | ƒ j d ƒ } | d } t t | | ƒ ƒ |  _ |  j j
 |  j ƒ |  _ d S(	   s  
        Solves for the reaction forces.

        Examples
        ========
        There is a beam of length 30 meters. A moment of magnitude 120 Nm is
        applied in the clockwise direction at the end of the beam. A pointload
        of magnitude 8 N is applied from the top of the beam at the starting
        point. There are two simple supports below the beam. One at the end
        and another one at a distance of 10 meters from the start. The
        deflection is restricted at both the supports.

        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols, linsolve, limit
        >>> E, I = symbols('E, I')
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(30, E, I)
        >>> b.apply_load(-8, 0, -1)
        >>> b.apply_load(R1, 10, -1)  # Reaction force at x = 10
        >>> b.apply_load(R2, 30, -1)  # Reaction force at x = 30
        >>> b.apply_load(120, 30, -2)
        >>> b.bc_deflection = [(10, 0), (30, 0)]
        >>> b.load
        R1*SingularityFunction(x, 10, -1) + R2*SingularityFunction(x, 30, -1)
            - 8*SingularityFunction(x, 0, -1) + 120*SingularityFunction(x, 30, -2)
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.reaction_loads
        {R1: 6, R2: 2}
        >>> b.load
        -8*SingularityFunction(x, 0, -1) + 6*SingularityFunction(x, 10, -1)
            + 120*SingularityFunction(x, 30, -2) + 2*SingularityFunction(x, 30, -1)
        R@   Re   Rf   R   R   i    i   N(   R'   Rƒ   R    R   R   R   t   shear_forcet   bending_momentR   R"   RW   RN   Rh   R   Rg   Ri   Rj   R%   R#   (   R)   Rm   R   R3   Re   Rf   t   shear_curvet   moment_curvet	   slope_eqst   deflection_eqst   slope_curveR€   RX   t   eqst   deflection_curvet   solution(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   solve_for_reaction_loadsª  s.    $		.
c         C  s   |  j  } t |  j | ƒ S(   s*  
        Returns a Singularity Function expression which represents
        the shear force curve of the Beam object.

        Examples
        ========
        There is a beam of length 30 meters. A moment of magnitude 120 Nm is
        applied in the clockwise direction at the end of the beam. A pointload
        of magnitude 8 N is applied from the top of the beam at the starting
        point. There are two simple supports below the beam. One at the end
        and another one at a distance of 10 meters from the start. The
        deflection is restricted at both the supports.

        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(30, E, I)
        >>> b.apply_load(-8, 0, -1)
        >>> b.apply_load(R1, 10, -1)
        >>> b.apply_load(R2, 30, -1)
        >>> b.apply_load(120, 30, -2)
        >>> b.bc_deflection = [(10, 0), (30, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.shear_force()
        -8*SingularityFunction(x, 0, 0) + 6*SingularityFunction(x, 10, 0) + 120*SingularityFunction(x, 30, -1) + 2*SingularityFunction(x, 30, 0)
        (   R    R   R`   (   R)   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR„   í  s    	c         C  s&  d d l  m } m } m } |  j ƒ  } |  j } | j } g  } xA | D]9 } t | | ƒ rl | j d } n  | j | j d ƒ qG W| j	 ƒ  t
 t | ƒ ƒ } g  }	 g  }
 x9t | ƒ D]+\ } } | d k r× q¹ n  y/t t d ƒ | | | d k f |  j j t ƒ | | k  f t d ƒ t f ƒ } | | | ƒ } g  } x' | D] } | j | j | | ƒ ƒ qFW| j | | d | g ƒ | j t | | | | d d ƒ t | | | d ƒ g ƒ t
 t t | ƒ ƒ } t | ƒ } |
 j | ƒ |	 j | | j | ƒ ƒ Wq¹ t k
 rãt | | | | d d ƒ } t | | | d ƒ } | j | | | d | d ƒ | | d k rµ| | k rµ|
 j | | g ƒ |	 j | | d | g ƒ qä|
 j | ƒ |	 j | | | d | ƒ ƒ q¹ Xq¹ Wt
 t t |
 ƒ ƒ }
 t |
 ƒ } |	 |
 j | ƒ } | | f S(	   sJ   Returns maximum Shear force and its coordinate
        in the Beam object.iÿÿÿÿ(   t   solvet   Mult   Intervali   i    t   nant   +t   -i   (   t   sympyR   R   R‘   R„   R    Rg   R5   RN   t   sortRh   t   sett	   enumerateR	   t   floatR#   t   rewritet   TrueRW   t   extendR   t   mapt   abst   maxt   indext   NotImplementedError(   R)   R   R   R‘   R†   R   t   termst   singularityt   termt	   intervalst   shear_valuesR9   t   st   shear_slopet   pointst   valt   pointt	   max_sheart   initial_sheart   final_sheart   maximum_shear(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   max_shear_force  sP    		
P9<&c         C  s   |  j  } t |  j ƒ  | ƒ S(   s/  
        Returns a Singularity Function expression which represents
        the bending moment curve of the Beam object.

        Examples
        ========
        There is a beam of length 30 meters. A moment of magnitude 120 Nm is
        applied in the clockwise direction at the end of the beam. A pointload
        of magnitude 8 N is applied from the top of the beam at the starting
        point. There are two simple supports below the beam. One at the end
        and another one at a distance of 10 meters from the start. The
        deflection is restricted at both the supports.

        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(30, E, I)
        >>> b.apply_load(-8, 0, -1)
        >>> b.apply_load(R1, 10, -1)
        >>> b.apply_load(R2, 30, -1)
        >>> b.apply_load(120, 30, -2)
        >>> b.bc_deflection = [(10, 0), (30, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.bending_moment()
        -8*SingularityFunction(x, 0, 1) + 6*SingularityFunction(x, 10, 1) + 120*SingularityFunction(x, 30, 0) + 2*SingularityFunction(x, 30, 1)
        (   R    R   R„   (   R)   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR…   C  s    	c         C  s)  d d l  m } m } m } |  j ƒ  } |  j } | j } g  } xA | D]9 } t | | ƒ rl | j d } n  | j | j d ƒ qG W| j	 ƒ  t
 t | ƒ ƒ } g  }	 g  }
 x<t | ƒ D].\ } } | d k r× q¹ n  y2t t d ƒ | | | d k f |  j ƒ  j t ƒ | | k  f t d ƒ t f ƒ } | | | ƒ } g  } x' | D] } | j | j | | ƒ ƒ qIW| j | | d | g ƒ | j t | | | | d d ƒ t | | | d ƒ g ƒ t
 t t | ƒ ƒ } t | ƒ } |
 j | ƒ |	 j | | j | ƒ ƒ Wq¹ t k
 ræt | | | | d d ƒ } t | | | d ƒ } | j | | | d | d ƒ | | d k r¸| | k r¸|
 j | | g ƒ |	 j | | d | g ƒ qç|
 j | ƒ |	 j | | | d | ƒ ƒ q¹ Xq¹ Wt
 t t |
 ƒ ƒ }
 t |
 ƒ } |	 |
 j | ƒ } | | f S(	   sJ   Returns maximum Shear force and its coordinate
        in the Beam object.iÿÿÿÿ(   R   R   R‘   i   i    R’   R“   R”   i   (   R•   R   R   R‘   R…   R    Rg   R5   RN   R–   Rh   R—   R˜   R	   R™   R„   Rš   R›   RW   Rœ   R   R   Rž   RŸ   R    R¡   (   R)   R   R   R‘   t   bending_curveR   R¢   R£   R¤   R¥   t   moment_valuesR9   R§   t   moment_slopeR©   Rª   R«   t
   max_momentt   initial_momentt   final_momentt   maximum_moment(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   max_bmomente  sP    		
S9<&c         C  s‰   d d l  m } m } | t d ƒ |  j d k f |  j ƒ  |  j |  j k  f t d ƒ t f ƒ } | | j | ƒ |  j d t	 j
 ƒ} | S(   s¨  
        Returns a Set of point(s) with zero bending moment and
        where bending moment curve of the beam object changes
        its sign from negative to positive or vice versa.

        Examples
        ========
        There is is 10 meter long overhanging beam. There are
        two simple supports below the beam. One at the start
        and another one at a distance of 6 meters from the start.
        Point loads of magnitude 10KN and 20KN are applied at
        2 meters and 4 meters from start respectively. A Uniformly
        distribute load of magnitude of magnitude 3KN/m is also
        applied on top starting from 6 meters away from starting
        point till end.
        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> b = Beam(10, E, I)
        >>> b.apply_load(-4, 0, -1)
        >>> b.apply_load(-46, 6, -1)
        >>> b.apply_load(10, 2, -1)
        >>> b.apply_load(20, 4, -1)
        >>> b.apply_load(3, 6, 0)
        >>> b.point_cflexure()
        [10/3]
        iÿÿÿÿ(   R   R	   R’   i    t   domain(   R•   R   R	   R™   R    R…   R   R›   Rš   R   t   Reals(   R)   R   R	   R‡   R©   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   point_cflexure™  s    c         C  s]  |  j  } |  j } |  j } |  j d k r1 |  j S|  j d sQ t |  j ƒ  | ƒ St | t	 ƒ r¨|  j d k r¨| j
 } d } d } d } xt t | ƒ ƒ D]} | d k rË | | d d j
 d } n  t d ƒ | t |  j ƒ  | | d | | | f ƒ }	 | t | ƒ d k ra| | |	 t | | d ƒ | |	 t | | | d j
 d d ƒ 7} n | | |	 t | | d ƒ 7} |	 j | | | d j
 d ƒ } q W| St d ƒ }
 t t d ƒ | | |  j ƒ  | ƒ |
 } g  } x> |  j d D]/ \ } } | j | | ƒ | } | j | ƒ qóWt t | |
 ƒ ƒ } | j i | d d |
 6ƒ } | S(   sD  
        Returns a Singularity Function expression which represents
        the slope the elastic curve of the Beam object.

        Examples
        ========
        There is a beam of length 30 meters. A moment of magnitude 120 Nm is
        applied in the clockwise direction at the end of the beam. A pointload
        of magnitude 8 N is applied from the top of the beam at the starting
        point. There are two simple supports below the beam. One at the end
        and another one at a distance of 10 meters from the start. The
        deflection is restricted at both the supports.

        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(30, E, I)
        >>> b.apply_load(-8, 0, -1)
        >>> b.apply_load(R1, 10, -1)
        >>> b.apply_load(R2, 30, -1)
        >>> b.apply_load(120, 30, -2)
        >>> b.bc_deflection = [(10, 0), (30, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.slope()
        (-4*SingularityFunction(x, 0, 2) + 3*SingularityFunction(x, 10, 2)
            + 120*SingularityFunction(x, 30, 1) + SingularityFunction(x, 30, 2) + 4000/3)/(E*I)
        R@   R   R?   i    i   Re   (   R    R   R   R'   Rk   R"   R   R   R5   R	   Rg   RV   t   lenR   R   R…   R   RW   R   RN   Rh   R   (   R)   R   RC   Rn   Rg   R   t
   prev_slopet   prev_endR9   t   slope_valueRe   RŠ   t   bc_eqsR€   RX   R‹   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   Ã  s>     				8.%+c         C  ss  |  j  } |  j } |  j } |  j d k r1 |  j S|  j d rH|  j d rHt | t ƒ rí|  j d k rí| j } d } d } d } d } xZt	 t
 | ƒ ƒ D]F}	 |	 d k rÍ | |	 d d j d } n  t d ƒ | t |  j ƒ  | |	 d | | | f ƒ }
 | |
 } t | | | | f ƒ } |	 t
 | ƒ d k r…| | | t | | d ƒ | | t | | |	 d j d d ƒ 7} n | | | t | | d ƒ 7} |
 j | | |	 d j d ƒ } | j | | |	 d j d ƒ } qŸ W| S|  j } t | d ƒ } t d ƒ | | t t |  j ƒ  | ƒ | ƒ | d | | d S|  j d s…|  j } t | d ƒ } t |  j ƒ  | ƒ | S|  j d r0|  j d r0t | t ƒ r@|  j d k r@| j } d } d } d } d } xZt	 t
 | ƒ ƒ D]F}	 |	 d k r | |	 d d j d } n  t d ƒ | t |  j ƒ  | |	 d | | | f ƒ }
 | |
 } t | | | | f ƒ } |	 t
 | ƒ d k rØ| | | t | | d ƒ | | t | | |	 d j d d ƒ 7} n | | | t | | d ƒ 7} |
 j | | |	 d j d ƒ } | j | | |	 d j d ƒ } qòW| S|  j } t | d ƒ \ } } t |  j ƒ  | ƒ | } t | | ƒ | } g  } x> |  j d D]/ \ } } | j | | ƒ | } | j | ƒ qŸWt t | | | f ƒ ƒ } | j i | d d | 6| d d | 6ƒ } t d ƒ | | | St | t ƒ rÐ|  j d k rÐ| j } d } d } d } d } xZt	 t
 | ƒ ƒ D]F}	 |	 d k r°| |	 d d j d } n  t d ƒ | t |  j ƒ  | |	 d | | | f ƒ }
 | |
 } t | | | | f ƒ } |	 t
 | ƒ d k rh| | | t | | d ƒ | | t | | |	 d j d d ƒ 7} n | | | t | | d ƒ 7} |
 j | | |	 d j d ƒ } | j | | |	 d j d ƒ } q‚W| St d	 ƒ } t |  j ƒ  | ƒ | } g  } x> |  j d D]/ \ } } | j | | ƒ | } | j | ƒ q	Wt t | | ƒ ƒ } | j i | d d | 6ƒ } | S(
   sW  
        Returns a Singularity Function expression which represents
        the elastic curve or deflection of the Beam object.

        Examples
        ========
        There is a beam of length 30 meters. A moment of magnitude 120 Nm is
        applied in the clockwise direction at the end of the beam. A pointload
        of magnitude 8 N is applied from the top of the beam at the starting
        point. There are two simple supports below the beam. One at the end
        and another one at a distance of 10 meters from the start. The
        deflection is restricted at both the supports.

        Using the sign convention of upward forces and clockwise moment
        being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> E, I = symbols('E, I')
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(30, E, I)
        >>> b.apply_load(-8, 0, -1)
        >>> b.apply_load(R1, 10, -1)
        >>> b.apply_load(R2, 30, -1)
        >>> b.apply_load(120, 30, -2)
        >>> b.bc_deflection = [(10, 0), (30, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.deflection()
        (4000*x/3 - 4*SingularityFunction(x, 0, 3)/3 + SingularityFunction(x, 10, 3)
            + 60*SingularityFunction(x, 30, 2) + SingularityFunction(x, 30, 3)/3 - 12000)/(E*I)
        R@   R   R   R?   i    i   s   3:5t   4Rf   (   R    R   R   R'   Rl   R"   R5   R	   Rg   RV   R¼   R   R   R…   R   RW   R!   R   R   RN   Rh   R   R   (   R)   R   RC   Rn   Rg   R½   t   prev_defR¾   R   R9   R¿   t   recent_segment_slopet   deflection_valueR*   R   t   constantRe   Rf   RŠ   RŒ   RÀ   R€   RX   R‹   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR     s¶     				8
.!%	B		8
.!%	-	8
.!%c   	      C  s  d d l  m } m } | t d ƒ |  j d k f |  j ƒ  |  j |  j k  f t d ƒ t f ƒ } | | j | ƒ |  j d t	 j
 ƒ} |  j ƒ  } g  | D] } | j |  j | ƒ ^ q˜ } t t t | ƒ ƒ } t | ƒ d k rt | ƒ } | | j | ƒ | f Sd Sd S(   sq   
        Returns point of max deflection and its coresponding deflection value
        in a Beam object.
        iÿÿÿÿ(   R   R	   R’   i    R¹   N(   R•   R   R	   R™   R    R   R   R›   Rš   R   Rº   R   RW   Rh   R   Rž   R¼   RŸ   R    R&   (	   R)   R   R	   RŠ   R©   RŒ   R   t   deflectionst   max_def(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   max_deflectionŠ  s    (c         C  sÑ   |  j  ƒ  } | d k r! i  } n  xK | j t ƒ D]: } | |  j k rL q1 n  | | k r1 t d | ƒ ‚ q1 q1 W|  j | k rŽ | |  j } n	 |  j } t | j | ƒ |  j d | f d d d d d d d	 d
 ƒS(   s  
        Returns a plot for Shear force present in the Beam object.

        Parameters
        ==========
        subs : dictionary
            Python dictionary containing Symbols as key and their
            corresponding values.

        Examples
        ========
        There is a beam of length 8 meters. A constant distributed load of 10 KN/m
        is applied from half of the beam till the end. There are two simple supports
        below the beam, one at the starting point and another at the ending point
        of the beam. A pointload of magnitude 5 KN is also applied from top of the
        beam, at a distance of 4 meters from the starting point.
        Take E = 200 GPa and I = 400*(10**-6) meter**4.

        Using the sign convention of downwards forces being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(8, 200*(10**9), 400*(10**-6))
        >>> b.apply_load(5000, 2, -1)
        >>> b.apply_load(R1, 0, -1)
        >>> b.apply_load(R2, 8, -1)
        >>> b.apply_load(10000, 4, 0, end=8)
        >>> b.bc_deflection = [(0, 0), (8, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.plot_shear_force()
        Plot object containing:
        [0]: cartesian line: -13750*SingularityFunction(x, 0, 0) + 5000*SingularityFunction(x, 2, 0)
        + 10000*SingularityFunction(x, 4, 1) - 31250*SingularityFunction(x, 8, 0)
        - 10000*SingularityFunction(x, 8, 1) for x over (0.0, 8.0)
        s   Value of %s was not passed.i    t   titles   Shear Forcet   xlabelR€   t   ylabelt   Valuet
   line_colort   gN(	   R„   R&   t   atomsR   R    RU   R   R   RW   (   R)   RW   R„   t   symR   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   plot_shear_force¡  s    %		'c         C  sÑ   |  j  ƒ  } | d k r! i  } n  xK | j t ƒ D]: } | |  j k rL q1 n  | | k r1 t d | ƒ ‚ q1 q1 W|  j | k rŽ | |  j } n	 |  j } t | j | ƒ |  j d | f d d d d d d d	 d
 ƒS(   s  
        Returns a plot for Bending moment present in the Beam object.

        Parameters
        ==========
        subs : dictionary
            Python dictionary containing Symbols as key and their
            corresponding values.

        Examples
        ========
        There is a beam of length 8 meters. A constant distributed load of 10 KN/m
        is applied from half of the beam till the end. There are two simple supports
        below the beam, one at the starting point and another at the ending point
        of the beam. A pointload of magnitude 5 KN is also applied from top of the
        beam, at a distance of 4 meters from the starting point.
        Take E = 200 GPa and I = 400*(10**-6) meter**4.

        Using the sign convention of downwards forces being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(8, 200*(10**9), 400*(10**-6))
        >>> b.apply_load(5000, 2, -1)
        >>> b.apply_load(R1, 0, -1)
        >>> b.apply_load(R2, 8, -1)
        >>> b.apply_load(10000, 4, 0, end=8)
        >>> b.bc_deflection = [(0, 0), (8, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.plot_bending_moment()
        Plot object containing:
        [0]: cartesian line: -13750*SingularityFunction(x, 0, 1) + 5000*SingularityFunction(x, 2, 1)
        + 5000*SingularityFunction(x, 4, 2) - 31250*SingularityFunction(x, 8, 1)
        - 5000*SingularityFunction(x, 8, 2) for x over (0.0, 8.0)
        s   Value of %s was not passed.i    RÉ   s   Bending MomentRÊ   R€   RË   RÌ   RÍ   t   bN(	   R…   R&   RÏ   R   R    RU   R   R   RW   (   R)   RW   R…   RÐ   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   plot_bending_momentÕ  s    %		'c         C  sÑ   |  j  ƒ  } | d k r! i  } n  xK | j t ƒ D]: } | |  j k rL q1 n  | | k r1 t d | ƒ ‚ q1 q1 W|  j | k rŽ | |  j } n	 |  j } t | j | ƒ |  j d | f d d d d d d d	 d
 ƒS(   s\  
        Returns a plot for slope of deflection curve of the Beam object.

        Parameters
        ==========
        subs : dictionary
            Python dictionary containing Symbols as key and their
            corresponding values.

        Examples
        ========
        There is a beam of length 8 meters. A constant distributed load of 10 KN/m
        is applied from half of the beam till the end. There are two simple supports
        below the beam, one at the starting point and another at the ending point
        of the beam. A pointload of magnitude 5 KN is also applied from top of the
        beam, at a distance of 4 meters from the starting point.
        Take E = 200 GPa and I = 400*(10**-6) meter**4.

        Using the sign convention of downwards forces being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(8, 200*(10**9), 400*(10**-6))
        >>> b.apply_load(5000, 2, -1)
        >>> b.apply_load(R1, 0, -1)
        >>> b.apply_load(R2, 8, -1)
        >>> b.apply_load(10000, 4, 0, end=8)
        >>> b.bc_deflection = [(0, 0), (8, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.plot_slope()
        Plot object containing:
        [0]: cartesian line: -8.59375e-5*SingularityFunction(x, 0, 2) + 3.125e-5*SingularityFunction(x, 2, 2)
        + 2.08333333333333e-5*SingularityFunction(x, 4, 3) - 0.0001953125*SingularityFunction(x, 8, 2)
        - 2.08333333333333e-5*SingularityFunction(x, 8, 3) + 0.00138541666666667 for x over (0.0, 8.0)
        s   Value of %s was not passed.i    RÉ   t   SlopeRÊ   R€   RË   RÌ   RÍ   t   mN(	   R   R&   RÏ   R   R    RU   R   R   RW   (   R)   RW   R   RÐ   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt
   plot_slope	  s    %		'c         C  sÑ   |  j  ƒ  } | d k r! i  } n  xK | j t ƒ D]: } | |  j k rL q1 n  | | k r1 t d | ƒ ‚ q1 q1 W|  j | k rŽ | |  j } n	 |  j } t | j | ƒ |  j d | f d d d d d d d	 d
 ƒS(   s|  
        Returns a plot for deflection curve of the Beam object.

        Parameters
        ==========
        subs : dictionary
            Python dictionary containing Symbols as key and their
            corresponding values.

        Examples
        ========
        There is a beam of length 8 meters. A constant distributed load of 10 KN/m
        is applied from half of the beam till the end. There are two simple supports
        below the beam, one at the starting point and another at the ending point
        of the beam. A pointload of magnitude 5 KN is also applied from top of the
        beam, at a distance of 4 meters from the starting point.
        Take E = 200 GPa and I = 400*(10**-6) meter**4.

        Using the sign convention of downwards forces being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(8, 200*(10**9), 400*(10**-6))
        >>> b.apply_load(5000, 2, -1)
        >>> b.apply_load(R1, 0, -1)
        >>> b.apply_load(R2, 8, -1)
        >>> b.apply_load(10000, 4, 0, end=8)
        >>> b.bc_deflection = [(0, 0), (8, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> b.plot_deflection()
        Plot object containing:
        [0]: cartesian line: 0.00138541666666667*x - 2.86458333333333e-5*SingularityFunction(x, 0, 3)
        + 1.04166666666667e-5*SingularityFunction(x, 2, 3) + 5.20833333333333e-6*SingularityFunction(x, 4, 4)
        - 6.51041666666667e-5*SingularityFunction(x, 8, 3) - 5.20833333333333e-6*SingularityFunction(x, 8, 4)
        for x over (0.0, 8.0)
        s   Value of %s was not passed.i    RÉ   t
   DeflectionRÊ   R€   RË   RÌ   RÍ   t   rN(	   R   R&   RÏ   R   R    RU   R   R   RW   (   R)   RW   R   RÐ   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   plot_deflection=  s    &		!t   modulesR   R   c         C  s{  t  d k r t d ƒ ‚ n	 t  j } t d k r? t d ƒ ‚ n	 t j } |  j } | d k rf i  } n  xQ |  j ƒ  j t	 ƒ D]: } | |  j k r— q| n  | | k r| t
 d | ƒ ‚ q| q| W|  j | k rÙ | |  j } n	 |  j } t | |  j ƒ  j | ƒ j t ƒ d ƒ } t | |  j ƒ  j | ƒ j t ƒ d ƒ } t | |  j ƒ  j | ƒ j t ƒ d ƒ }	 t | |  j ƒ  j | ƒ j t ƒ d ƒ }
 | d t | ƒ d d | ƒ} | j d d	 ƒ \ } } | d j | | | ƒ ƒ | d j d
 ƒ | d	 j | | | ƒ ƒ | d	 j d ƒ | d j | |	 | ƒ ƒ | d j d ƒ | d j | |
 | ƒ ƒ | d j d ƒ | j ƒ  | S(   sÉ  
        Returns Axes object containing subplots of Shear Force, Bending Moment,
        Slope and Deflection of the Beam object.

        Parameters
        ==========
        subs : dictionary
            Python dictionary containing Symbols as key and their
            corresponding values.

        .. note::
           This method only works if numpy and matplotlib libraries
           are installed on the system.

        Examples
        ========
        There is a beam of length 8 meters. A constant distributed load of 10
        KN/m is applied from half of the beam till the end. There are two
        simple supports below the beam, one at the starting point and another
        at the ending point of the beam. A pointload of magnitude 5 KN is also
        applied from top of the beam, at a distance of 4 meters from the
        starting point.  Take E = 200 GPa and I = 400*(10**-6) meter**4.

        Using the sign convention of downwards forces being positive.

        >>> from sympy.physics.continuum_mechanics.beam import Beam
        >>> from sympy import symbols
        >>> R1, R2 = symbols('R1, R2')
        >>> b = Beam(8, 200*(10**9), 400*(10**-6))
        >>> b.apply_load(5000, 2, -1)
        >>> b.apply_load(R1, 0, -1)
        >>> b.apply_load(R2, 8, -1)
        >>> b.apply_load(10000, 4, 0, end=8)
        >>> b.bc_deflection = [(0, 0), (8, 0)]
        >>> b.solve_for_reaction_loads(R1, R2)
        >>> axes = b.plot_loading_results()
        s&   Install matplotlib to use this method.s!   Install numpy to use this method.s   Value of %s was not passed.R   i    t   numid   i   i   s   Shear Forces   Bending Momenti   RÔ   i   R×   N(   R   R&   t   ImportErrorR   R   R   R    R   RÏ   R   RU   R   R   R„   RW   Rš   R	   R…   R   R™   t   subplotsR   t	   set_titlet   tight_layout(   R)   RW   t   pltR   R    RÐ   R   t   sheart   momentR   R   R©   t   figt   axs(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   plot_loading_resultss  sP    '							!		
N(   R   R   ('   t   __name__t
   __module__t   __doc__R   R+   R1   t   propertyR2   R   t   setterR    R   R   R:   R;   R=   RG   RS   R&   RM   R_   R`   Ra   Rƒ   RŽ   R„   R°   R…   R¸   R»   R   R   RÈ   RÑ   RÓ   RÖ   RÙ   R   Rå   (    (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR      sN   1%	?8CL	‡	C	"	4	"	4	*	D	ƒ	4446t   Beam3Dc           B  s  e  Z d  Z e d ƒ d „ Z e d „  ƒ Z e j d „  ƒ Z e d „  ƒ Z e j d „  ƒ Z e d „  ƒ Z	 e	 j d „  ƒ Z	 e d	 „  ƒ Z
 e d
 „  ƒ Z e d „  ƒ Z d d „ Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s  
    This class handles loads applied in any direction of a 3D space along
    with unequal values of Second moment along different axes.

    .. note::
       While solving a beam bending problem, a user should choose its
       own sign convention and should stick to it. The results will
       automatically follow the chosen sign convention.
       This class assumes that any kind of distributed load/moment is
       applied through out the span of a beam.

    Examples
    ========
    There is a beam of l meters long. A constant distributed load of magnitude q
    is applied along y-axis from start till the end of beam. A constant distributed
    moment of magnitude m is also applied along z-axis from start till the end of beam.
    Beam is fixed at both of its end. So, deflection of the beam at the both ends
    is restricted.

    >>> from sympy.physics.continuum_mechanics.beam import Beam3D
    >>> from sympy import symbols, simplify
    >>> l, E, G, I, A = symbols('l, E, G, I, A')
    >>> b = Beam3D(l, E, G, I, A)
    >>> x, q, m = symbols('x, q, m')
    >>> b.apply_load(q, 0, 0, dir="y")
    >>> b.apply_moment_load(m, 0, -1, dir="z")
    >>> b.shear_force()
    [0, -q*x, 0]
    >>> b.bending_moment()
    [0, 0, -m*x + q*x**2/2]
    >>> b.bc_slope = [(0, [0, 0, 0]), (l, [0, 0, 0])]
    >>> b.bc_deflection = [(0, [0, 0, 0]), (l, [0, 0, 0])]
    >>> b.solve_slope_deflection()
    >>> b.slope()
    [0, 0, l*x*(-l*q + 3*l*(A*G*l*(l*q - 2*m) + 12*E*I*q)/(2*(A*G*l**2 + 12*E*I)) + 3*m)/(6*E*I)
    + q*x**3/(6*E*I) + x**2*(-l*(A*G*l*(l*q - 2*m) + 12*E*I*q)/(2*(A*G*l**2 + 12*E*I))
    - m)/(2*E*I)]
    >>> dx, dy, dz = b.deflection()
    >>> dx
    0
    >>> dz
    0
    >>> expectedy = (
    ... -l**2*q*x**2/(12*E*I) + l**2*x**2*(A*G*l*(l*q - 2*m) + 12*E*I*q)/(8*E*I*(A*G*l**2 + 12*E*I))
    ... + l*m*x**2/(4*E*I) - l*x**3*(A*G*l*(l*q - 2*m) + 12*E*I*q)/(12*E*I*(A*G*l**2 + 12*E*I)) - m*x**3/(6*E*I)
    ... + q*x**4/(24*E*I) + l*x*(A*G*l*(l*q - 2*m) + 12*E*I*q)/(2*A*G*(A*G*l**2 + 12*E*I)) - q*x**2/(2*A*G)
    ... )
    >>> simplify(dy - expectedy)
    0

    References
    ==========

    .. [1] http://homes.civil.aau.dk/jc/FemteSemester/Beams3D.pdf

    R   c         C  s   t  t |  ƒ j | | | | ƒ | |  _ | |  _ d d d g |  _ d d d g |  _ d d d g |  _ d d d g |  _ d d d g |  _	 d S(   sè  Initializes the class.

        Parameters
        ==========
        length : Sympifyable
            A Symbol or value representing the Beam's length.
        elastic_modulus : Sympifyable
            A SymPy expression representing the Beam's Modulus of Elasticity.
            It is a measure of the stiffness of the Beam material.
        shear_modulus : Sympifyable
            A SymPy expression representing the Beam's Modulus of rigidity.
            It is a measure of rigidity of the Beam material.
        second_moment : Sympifyable or list
            A list of two elements having SymPy expression representing the
            Beam's Second moment of area. First value represent Second moment
            across y-axis and second across z-axis.
            Single SymPy expression can be passed if both values are same
        area : Sympifyable
            A SymPy expression representing the Beam's cross-sectional area
            in a plane prependicular to length of the Beam.
        variable : Symbol, optional
            A Symbol object that will be used as the variable along the beam
            while representing the load, shear, moment, slope and deflection
            curve. By default, it is set to ``Symbol('x')``.
        i    N(
   t   superRë   R+   t   shear_modulust   areat   _load_vectort   _moment_load_vectort   _load_Singularityt   _slopet   _deflection(   R)   R   R   Rí   R   Rî   R    (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR+   
  s    		c         C  s   |  j  S(   s   Young's Modulus of the Beam. (   t   _shear_modulus(   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRí   -  s    c         C  s   t  | ƒ |  _ d  S(   N(   R   Rô   (   R)   R8   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRí   2  s    c         C  s   |  j  S(   s#   Second moment of area of the Beam. (   R/   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   6  s    c         C  sM   t  | t ƒ r: g  | D] } t | ƒ ^ q } | |  _ n t | ƒ |  _ d  S(   N(   R5   Rh   R   R/   (   R)   R9   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   ;  s    c         C  s   |  j  S(   s"   Cross-sectional area of the Beam. (   t   _area(   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRî   C  s    c         C  s   t  | ƒ |  _ d  S(   N(   R   Rõ   (   R)   t   a(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRî   H  s    c         C  s   |  j  S(   sL   
        Returns a three element list representing the load vector.
        (   Rï   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   load_vectorL  s    c         C  s   |  j  S(   sQ   
        Returns a three element list representing moment loads on Beam.
        (   Rð   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   moment_load_vectorS  s    c         C  s   |  j  S(   s	  
        Returns a dictionary of boundary conditions applied on the beam.
        The dictionary has two keywords namely slope and deflection.
        The value of each keyword is a list of tuple, where each tuple
        contains loaction and value of a boundary condition in the format
        (location, value). Further each value is a list corresponding to
        slope or deflection(s) values along three axes at that location.

        Examples
        ========
        There is a beam of length 4 meters. The slope at 0 should be 4 along
        the x-axis and 0 along others. At the other end of beam, deflection
        along all the three axes should be zero.

        >>> from sympy.physics.continuum_mechanics.beam import Beam3D
        >>> from sympy import symbols
        >>> l, E, G, I, A, x = symbols('l, E, G, I, A, x')
        >>> b = Beam3D(30, E, G, I, A, x)
        >>> b.bc_slope = [(0, (4, 0, 0))]
        >>> b.bc_deflection = [(4, [0, 0, 0])]
        >>> b.boundary_conditions
        {'deflection': [(4, [0, 0, 0])], 'slope': [(0, (4, 0, 0))]}

        Here the deflection of the beam should be ``0`` along all the three axes at ``4``.
        Similarly, the slope of the beam should be ``4`` along x-axis and ``0``
        along y and z axis at ``0``.
        (   R"   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR:   Z  s    t   yc         C  s  |  j  } t | ƒ } t | ƒ } t | ƒ } | d k r | d k s[ |  j d c | 7<n  |  j d c | t | | | ƒ 7<n™ | d k rÕ | d k s¯ |  j d c | 7<n  |  j d c | t | | | ƒ 7<nE | d k s÷ |  j d c | 7<n  |  j d c | t | | | ƒ 7<d S(   s  
        This method adds up the force load to a particular beam object.

        Parameters
        ==========
        value : Sympifyable
            The magnitude of an applied load.
        dir : String
            Axis along which load is applied.
        order : Integer
            The order of the applied load.
            - For point loads, order=-1
            - For constant distributed load, order=0
            - For ramp loads, order=1
            - For parabolic ramp loads, order=2
            - ... so on.
        R   iÿÿÿÿi    Rù   i   i   N(   R    R   Rï   Rñ   R   (   R)   RX   RY   RZ   t   dirR   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRM   y  s    	&&c         C  s  |  j  } t | ƒ } t | ƒ } t | ƒ } | d k r | d k s[ |  j d c | 7<n  |  j d c | t | | | ƒ 7<n™ | d k rÕ | d k s¯ |  j d c | 7<n  |  j d c | t | | | ƒ 7<nE | d k s÷ |  j d c | 7<n  |  j d c | t | | | ƒ 7<d S(   s#  
        This method adds up the moment loads to a particular beam object.

        Parameters
        ==========
        value : Sympifyable
            The magnitude of an applied moment.
        dir : String
            Axis along which moment is applied.
        order : Integer
            The order of the applied load.
            - For point moments, order=-2
            - For constant distributed moment, order=-1
            - For ramp moments, order=0
            - For parabolic ramp moments, order=1
            - ... so on.
        R   iþÿÿÿi    Rù   i   i   N(   R    R   Rð   Rñ   R   (   R)   RX   RY   RZ   Rú   R   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   apply_moment_loadŸ  s    	&&R?   c         C  sÞ   | d k s | d k r] t  d t | ƒ ƒ } | |  j | <|  j j | d d d g f ƒ n} t  d t | ƒ ƒ } t  d t | ƒ ƒ } | | g |  j | <|  j j | d d d g f ƒ |  j j | d d d g f ƒ d  S(   NRH   RI   RJ   i    RK   (   R   RL   R%   R=   RN   R;   (   R)   RO   RP   RQ   RR   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRS   Ã  s    "c         G  s‘  |  j  } |  j } |  j } g  | D] } t | | ƒ ^ q" } g  | D] } t | | ƒ ^ qD } x+t d ƒ D]}	 g  | D]2 }
 | |	 j |
 ƒ s¥ | |	 j |
 ƒ ry |
 ^ qy } t | ƒ d k rÉ ql n  t | |	 | | ƒ } t | |	 | | ƒ } t t	 | | g | ƒ j
 d ƒ } t t | | ƒ ƒ } |  j } xA | D]9 } | | k r<| | | | k r<t d | ƒ ‚ q<q<W|  j j | ƒ ql Wd S(   sŒ  
        Solves for the reaction forces.

        Examples
        ========
        There is a beam of length 30 meters. It it supported by rollers at
        of its end. A constant distributed load of magnitude 8 N is applied
        from start till its end along y-axis. Another linear load having
        slope equal to 9 is applied along z-axis.

        >>> from sympy.physics.continuum_mechanics.beam import Beam3D
        >>> from sympy import symbols
        >>> l, E, G, I, A, x = symbols('l, E, G, I, A, x')
        >>> b = Beam3D(30, E, G, I, A, x)
        >>> b.apply_load(8, start=0, order=0, dir="y")
        >>> b.apply_load(9*x, start=0, order=0, dir="z")
        >>> b.bc_deflection = [(0, [0, 0, 0]), (30, [0, 0, 0])]
        >>> R1, R2, R3, R4 = symbols('R1, R2, R3, R4')
        >>> b.apply_load(R1, start=0, order=-1, dir="y")
        >>> b.apply_load(R2, start=30, order=-1, dir="y")
        >>> b.apply_load(R3, start=0, order=-1, dir="z")
        >>> b.apply_load(R4, start=30, order=-1, dir="z")
        >>> b.solve_for_reaction_loads(R1, R2, R3, R4)
        >>> b.reaction_loads
        {R1: -120, R2: -120, R3: -1350, R4: -2700}
        i   i    s2   Ambiguous solution for %s in different directions.N(   R    R   Rñ   R   RV   t   hasR¼   R   Rh   R   Rg   Ri   Rj   R%   RU   t   update(   R)   t   reactionR   R3   t   qR`   t   shear_curvesRá   t   moment_curvesR9   RØ   t   reactR†   R‡   t   solt   sol_dictR2   t   key(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRŽ   Ï  s$    			""?"	 c         C  sI   |  j  } |  j } t | d | ƒ t | d | ƒ t | d | ƒ g S(   s   
        Returns a list of three expressions which represents the shear force
        curve of the Beam object along all three axes.
        i    i   i   (   R    Rï   R   (   R)   R   Rÿ   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR„   ÿ  s    		c         C  s   |  j  ƒ  d S(   sY   
        Returns expression of Axial shear force present inside the Beam object.
        i    (   R„   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   axial_force  s    c         C  se   |  j  } |  j } |  j ƒ  } t | d | ƒ t | d | d | ƒ t | d | d | ƒ g S(   s   
        Returns a list of three expressions which represents the bending moment
        curve of the Beam object along all three axes.
        i    i   i   (   R    Rð   R„   R   (   R)   R   RÕ   Rá   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR…     s
    		*c         C  s   |  j  ƒ  d S(   sX   
        Returns expression of Torsional moment present inside the Beam object.
        i    (   R…   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   torsional_moment  s    c         C  sû  d d l  m } m } m } m } |  j } |  j } |  j } |  j } |  j	 }	 t
 |	 t ƒ rv |	 d |	 d }
 } n
 |	 }
 } |  j } |  j } |  j } | d ƒ } | d ƒ } | | | | | | ƒ | ƒ | ƒ | d } | | | d ƒ | | ƒ ƒ j d } t d ƒ } t d ƒ } t t | j | d ƒ | j | | ƒ g | | ƒ j d ƒ } | j i | d | 6| d | 6ƒ } | j | ƒ } | |  j d <| |  j d <t d	 ƒ } | | | | | | ƒ | ƒ | ƒ t | d | ƒ | | d
 } | | | d ƒ ƒ j d } t t | j | d ƒ | j | | ƒ g | | ƒ j d ƒ } | j i | d | 6| d | 6ƒ } | | | | | ƒ | ƒ | d | | | | | } | | | d ƒ | | ƒ ƒ j d } t t | j | d ƒ | j | | ƒ g | | ƒ j d ƒ } | j i | d | 6| d | 6ƒ |  j d <| j | | d ƒ |  j d
 <| | |
 | | | ƒ | ƒ | ƒ t | d
 | ƒ | | d } | | | d ƒ ƒ j d } t t | j | d ƒ | j | | ƒ g | | ƒ j d ƒ } | j i | d | 6| d | 6ƒ } | | | | | ƒ | ƒ | d
 | | | | | } | | | d ƒ ƒ j d } t t | j | d ƒ | j | | ƒ g | | ƒ j d ƒ } | j i | d | 6| d | 6ƒ |  j d
 <| j | | d ƒ |  j d <d  S(   Niÿÿÿÿ(   t   dsolvet   Functiont
   Derivativet   Eqi    i   t   deflt   thetaRc   Rd   t   C_ii   (   R•   R  R	  R
  R  R    R   R   Rí   R   R5   Rh   Rî   Rï   Rð   Rg   R   R   RW   R   Ró   Rò   R   (   R)   R  R	  R
  R  R   R3   RC   t   GRn   t   I_yt   I_zt   AR`   Râ   R  R  Rs   t   def_xRc   Rd   R   t   slope_xR  t   eq1t   slope_zt   eq2t   def_yt   slope_yt   def_z(    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   solve_slope_deflection   sT    "					
			.%=%D=%9%=,C=%9=,c         C  s   |  j  S(   sw   
        Returns a three element list representing slope of deflection curve
        along all the three axes.
        (   Rò   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   e  s    c         C  s   |  j  S(   sn   
        Returns a three element list representing deflection curve along all
        the three axes.
        (   Ró   (   R)   (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyR   l  s    (   Ræ   Rç   Rè   R   R+   Ré   Rí   Rê   R   Rî   R÷   Rø   R:   RM   Rû   RS   RŽ   R„   R  R…   R  R  R   R   (    (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyRë   Ð  s,   8#&$	0						E	N($   Rè   t
   __future__R    R   t
   sympy.coreR   R   R   R   t   sympy.solversR   t   sympy.printingR   t   sympy.functionsR   R	   R
   R   t   sympy.integralsR   t   sympy.seriesR   t   sympy.plottingR   t   sympy.externalR   t   sympy.utilities.decoratorR   R•   R   R   R   t   __doctest_requires__t   objectR   Rë   (    (    (    sE   lib/python2.7/site-packages/sympy/physics/continuum_mechanics/beam.pyt   <module>   s,   "ÿ ÿ ÿ ÿ ÿ º