ó
FÖ3Zc           @   sF   d    Z  d d  Z d d  Z d   Z d d  Z d d  Z d S(   c         C   s    d | | |  |  |  |  S(   Ng      ŕ?(    (   t   ft   x0t   x1(    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt	   Trapezoid   s    id   c         C   s]   | | d | } d } | } x8 t  |  D]* } | t |  | | |  7} | | 7} q+ W| S(   Ng      đ?g        (   t   rangeR   (   R    R   t   xnt   nt   ht   trapezt   xt   i(    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt   Trapezoids_1   s    c         C   s}   | | d | } d |  |  } | } x6 t  | d  D]$ } | |  | |  7} | | 7} q9 W| d |  |  7} | | S(   Ng      đ?g      ŕ?i   (   R   (   R    R   R   R   R   R   R	   R
   (    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt   Trapezoids_R   s    c         C   sB   d | | } |  |  d |  |  |  |  } | | | d S(   Ng      ŕ?g      @g      @(    (   R    R   t   x2R   t   simp(    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt   Simpson$   s    $c         C   s]   | | d | } d } | } x8 t  |  D]* } | t |  | | |  7} | | 7} q+ W| S(   Ng      đ?g        (   R   R   (   R    R   t   x2nR   R   t   simpsonR	   R
   (    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt
   Simpsons_1*   s    c   	      C   sĹ   | | d | } | d } |  |  } | | } x2 t  |  D]$ } | d |  |  7} | | 7} q? W| | } x5 t  d |  D]$ } | d |  |  7} | | 7} q W| |  |  7} | | d S(   Ng      đ?g      ŕ?g      @i   g       @g      @(   R   (	   R    R   R   R   t   dxR   R   R	   R
   (    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt
   Simpsons_R8   s    


N(   R   R   R   R   R   R   (    (    (    sD   /usr/local/Slides/1_Disciplines/1_CN/9_Tests/2017.2.2/Integration.pyt   <module>   s
   		