ó
î&]\c           @` s³  d  d l  m Z m Z m Z d  d l Z d  d l m Z m Z m	 Z	 d  d l
 Z
 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 d  d l m Z d d d	 „  ƒ  YZ d
 d d „  ƒ  YZ d d  d „  ƒ  YZ d d! d „  ƒ  YZ  d d" d „  ƒ  YZ! d d# d „  ƒ  YZ" d e" f d „  ƒ  YZ# d e" f d „  ƒ  YZ$ d e" f d „  ƒ  YZ% d e" f d „  ƒ  YZ& d d$ d „  ƒ  YZ' d S(%   i    (   t   divisiont   print_functiont   absolute_importN(   t   assert_almost_equalt   assert_allcloset   assert_array_almost_equal(	   t   sint   cost   sinht   cosht   expt   inft   nant   r_t   pi(   t   spherical_jnt   spherical_ynt   spherical_int   spherical_kn(   t   quad(   t   suppress_warningst   TestSphericalJnc           B` sP   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   c         C` sh   t  j d d d d d g ƒ } t t d | ƒ d | d | d t | ƒ d | d t | ƒ ƒ d  S(	   Ng¸…ëQ¸¾?g®Gáz®ó?g®Gáz®(@gÍÌÌÌÌÜ^@g     J“@i   iÿÿÿÿi   (   t   npt   arrayR   R   R   R   (   t   selft   x(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_exact   s    c         C` sl   t  j d d d d d g ƒ } d } t t | d | ƒ t | d | ƒ d | d | t | | ƒ ƒ d  S(	   Ni   i   i   i   i   gš™™™™™ñ?y              ø?yš™™™™™ñ?      ø?(   R   R   R   R   (   R   t   nR   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt$   test_spherical_jn_recurrence_complex   s    $c         C` sl   t  j d d d d d g ƒ } d } t t | d | ƒ t | d | ƒ d | d | t | | ƒ ƒ d  S(   Ni   i   i   i   i   g¸…ëQ¸¾?(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt!   test_spherical_jn_recurrence_real"   s    $c         C` sE   d } t  j t t g ƒ } t t | | ƒ t  j d d g ƒ ƒ d  S(   Ni   i    (   R   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_inf_real)   s    c         C` s}   d } t  j t d t d t d g ƒ } t ƒ  C } | j t d ƒ t t | | ƒ t  j d d t d g ƒ ƒ Wd  QXd  S(	   Ni   y                i   y              ð?s%   invalid value encountered in multiplyi    y      ð?      ð?y      ð?      ð?(   R   R   R   R   t   filtert   RuntimeWarningR   R   (   R   R   R   t   sup(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_inf_complex/   s
    %c         C` s   t  t d d ƒ d ƒ d  S(   Ni   g%•-ª@g·õ<«]3¿(   R   R   (   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_large_arg_17   s    c         C` s   t  t d d ƒ d ƒ d  S(   Ni   i'  g°µ|¸	 ?(   R   R   (   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_large_arg_2=   s    c      	   C` s\   t  j d d d d d d g ƒ } d } t t | | ƒ t  j d d d d d d g ƒ ƒ d  S(   Ni    i   i   i   i
   id   (   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_at_zeroC   s    !(
   t   __name__t
   __module__R   R   R   R   R"   R#   R$   R%   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR      s   							t   TestSphericalYnc           B` sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` sh   t  j d d d d d g ƒ } t t d | ƒ d | d | d t | ƒ d | d t | ƒ ƒ d  S(	   Ng¸…ëQ¸¾?g®Gáz®ó?g®Gáz®(@gÍÌÌÌÌÜ^@g     J“@i   i   i   (   R   R   R   R   R   R   (   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_yn_exactL   s    c         C` sl   t  j d d d d d g ƒ } d } t t | d | ƒ t | d | ƒ d | d | t | | ƒ ƒ d  S(   Ni   i   i   i   i   g¸…ëQ¸¾?(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt!   test_spherical_yn_recurrence_realT   s    $c         C` sl   t  j d d d d d g ƒ } d } t t | d | ƒ t | d | ƒ d | d | t | | ƒ ƒ d  S(	   Ni   i   i   i   i   gš™™™™™ñ?y              ø?yš™™™™™ñ?      ø?(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt$   test_spherical_yn_recurrence_complex[   s    $c         C` sE   d } t  j t t g ƒ } t t | | ƒ t  j d d g ƒ ƒ d  S(   Ni   i    (   R   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_yn_inf_realb   s    c         C` s}   d } t  j t d t d t d g ƒ } t ƒ  C } | j t d ƒ t t | | ƒ t  j d d t d g ƒ ƒ Wd  QXd  S(	   Ni   y                i   y              ð?s%   invalid value encountered in multiplyi    y      ð?      ð?y      ð?      ð?(   R   R   R   R   R   R    R   R   (   R   R   R   R!   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_yn_inf_complexh   s
    %c         C` sU   t  j d d d d d d g ƒ } d } t t | | ƒ t t  j d | j ƒ ƒ d  S(   Ni    i   i   i   i
   id   t   shape(   R   R   R   R   R   t   onesR.   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_yn_at_zerop   s    !c         C` sT   t  j d d d d d d g ƒ } d	 } t t | | ƒ t t  j d | j ƒ ƒ d  S(
   Ni    i   i   i   i
   id   y                R.   y                (   R   R   R   R   R   R/   R.   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt!   test_spherical_yn_at_zero_complexv   s    !(	   R&   R'   R)   R*   R+   R,   R-   R0   R1   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR(   K   s   						t   TestSphericalJnYnCrossProductc           B` s   e  Z d  „  Z d „  Z RS(   c         C` s   t  j d d d g ƒ } t  j d d d g ƒ } t | d | ƒ t | | ƒ t | | ƒ t | d | ƒ } d | d } t | | ƒ d  S(   Ni   i   i   gš™™™™™¹?i
   i   (   R   R   R   R   R   (   R   R   R   t   leftt   right(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt$   test_spherical_jn_yn_cross_product_1‚   s    !c         C` s•   t  j d d d g ƒ } t  j d d d g ƒ } t | d | ƒ t | | ƒ t | | ƒ t | d | ƒ } d | d | d } t | | ƒ d  S(   Ni   i   i   gš™™™™™¹?i
   i   i   (   R   R   R   R   R   (   R   R   R   R3   R4   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt$   test_spherical_jn_yn_cross_product_2‹   s    !(   R&   R'   R5   R6   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR2      s   		t   TestSphericalInc           B` s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` se   t  j d d d d g ƒ } t t d | ƒ d | d | d t | ƒ d | d t | ƒ ƒ d  S(   Ng¸…ëQ¸¾?g®Gáz®ó?g®Gáz®(@gÍÌÌÌÌÜ^@i   i   i   (   R   R   R   R   R   R	   (   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_in_exact–   s    c         C` sl   t  j d d d d d g ƒ } d } t t | d | ƒ t | d | ƒ d | d | t | | ƒ ƒ d  S(   Ni   i   i   i   i   g¸…ëQ¸¾?(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt!   test_spherical_in_recurrence_realœ   s    $c         C` sl   t  j d d d d d g ƒ } d } t t | d | ƒ t | d | ƒ d | d | t | | ƒ ƒ d  S(	   Ni   i   i   i   i   gš™™™™™ñ?y              ø?yš™™™™™ñ?      ø?(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt$   test_spherical_in_recurrence_complex£   s    $c         C` sF   d } t  j t t g ƒ } t t | | ƒ t  j t t g ƒ ƒ d  S(   Ni   (   R   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_in_inf_realª   s    c         C` sX   d } t  j t d t d t d g ƒ } t t | | ƒ t  j t t t g ƒ ƒ d  S(   Ni   y                i   y              ð?y      ð?      ð?(   R   R   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_in_inf_complex°   s    %c      	   C` s\   t  j d d d d d d g ƒ } d } t t | | ƒ t  j d d d d d d g ƒ ƒ d  S(   Ni    i   i   i   i
   id   (   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_in_at_zero»   s    !(   R&   R'   R8   R9   R:   R;   R<   R=   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR7   •   s   					t   TestSphericalKnc           B` sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` sd   t  j d d d d g ƒ } t t d | ƒ t d t | ƒ d | d | d d | d ƒ d  S(   Ng¸…ëQ¸¾?g®Gáz®ó?g®Gáz®(@gÍÌÌÌÌÜ^@i   i   i   (   R   R   R   R   R   R
   (   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_kn_exactÄ   s    c         C` sŒ   t  j d d d d d g ƒ } d } t d | d t | d | ƒ d | d t | d | ƒ d | d | d | t | | ƒ ƒ d  S(   Ni   i   i   i   i   g¸…ëQ¸¾?iÿÿÿÿ(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt!   test_spherical_kn_recurrence_realÊ   s    <c         C` sŒ   t  j d d d d d g ƒ } d	 } t d | d t | d | ƒ d | d t | d | ƒ d | d | d | t | | ƒ ƒ d  S(
   Ni   i   i   i   i   gš™™™™™ñ?y              ø?iÿÿÿÿyš™™™™™ñ?      ø?(   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt$   test_spherical_kn_recurrence_complexÑ   s    <c         C` sF   d } t  j t t g ƒ } t t | | ƒ t  j t d g ƒ ƒ d  S(   Ni   i    (   R   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_kn_inf_realØ   s    c         C` sX   d } t  j t d t d t d g ƒ } t t | | ƒ t  j t d t g ƒ ƒ d  S(   Ni   y                i   y              ð?i    y      ð?      ð?(   R   R   R   R   R   R   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_kn_inf_complexÞ   s    %c         C` sT   t  j d d d d d d g ƒ } d } t t | | ƒ t t  j d | j ƒ ƒ d  S(   Ni    i   i   i   i
   id   R.   (   R   R   R   R   R   R/   R.   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_kn_at_zeroç   s    !c         C` sT   t  j d d d d d d g ƒ } d	 } t t | | ƒ t t  j d | j ƒ ƒ d  S(
   Ni    i   i   i   i
   id   y                R.   y                (   R   R   R   R   R   R/   R.   (   R   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt!   test_spherical_kn_at_zero_complexí   s    !(	   R&   R'   R?   R@   RA   RB   RC   RD   RE   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR>   Ã   s   							t   SphericalDerivativesTestCasec           B` s;   e  Z d  „  Z e j j d „  ƒ Z e j j d „  ƒ Z RS(   c         ` sW   t  ‡  ‡ f d †  | | ƒ \ } } t | ˆ j ˆ  | ƒ ˆ j ˆ  | ƒ d | ƒd  S(   Nc         ` s   ˆ j  ˆ  |  ƒ S(   N(   t   df(   t   z(   R   R   (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   <lambda>ö   s    t   atol(   R   R   t   f(   R   R   t   at   bt   integralt	   tolerance(    (   R   R   sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   fundamental_theoremõ   s    $"c         C` s   |  j  d d d ƒ d  S(   Ni    g      @g      .@(   RP   (   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_fundamental_theorem_0û   s    c         C` s   |  j  d d d ƒ d  S(   Ni   g      à?g333333ó?(   RP   (   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_fundamental_theorem_7ÿ   s    (   R&   R'   RP   t   pytestt   markt   slowRQ   RR   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRF   ô   s   	t   TestSphericalJnDerivativesc           B` s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C` s   t  | | ƒ S(   N(   R   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRK     s    c         C` s   t  | | d t ƒS(   Nt
   derivative(   R   t   True(   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRG     s    c      	   C` s\   t  j d d d d d d g ƒ } t t | d d t ƒt  j d d d d d d g ƒ ƒ d  S(	   Ni    i   i   i   i   i   RW   gUUUUUUÕ?(   R   R   R   R   RX   (   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_jn_d_zero  s    !(   R&   R'   RK   RG   RY   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRV     s   		t   TestSphericalYnDerivativesc           B` s   e  Z d  „  Z d „  Z RS(   c         C` s   t  | | ƒ S(   N(   R   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRK     s    c         C` s   t  | | d t ƒS(   NRW   (   R   RX   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRG     s    (   R&   R'   RK   RG   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRZ     s   	t   TestSphericalInDerivativesc           B` s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C` s   t  | | ƒ S(   N(   R   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRK     s    c         C` s   t  | | d t ƒS(   NRW   (   R   RX   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRG     s    c         C` sG   t  j d d d d d g ƒ } t t | d d t ƒt  j d ƒ ƒ d  S(	   Ni   i   i   i   i   i    RW   i   (   R   R   R   R   RX   t   zeros(   R   R   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_spherical_in_d_zero   s    (   R&   R'   RK   RG   R]   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR[     s   		t   TestSphericalKnDerivativesc           B` s   e  Z d  „  Z d „  Z RS(   c         C` s   t  | | ƒ S(   N(   R   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRK   '  s    c         C` s   t  | | d t ƒS(   NRW   (   R   RX   (   R   R   RH   (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyRG   *  s    (   R&   R'   RK   RG   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR^   &  s   	t   TestSphericalOldc           B` s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` sê   t  j d
 ƒ } d } t d | ƒ | d d <t d | ƒ | d d <t d | d t ƒ| d d <t d | d t ƒ| d d <| d d } | d d d | d d } t | d t  j d d g ƒ d	 ƒ t | d | | g d	 ƒ d  S(   Ni   gš™™™™™É?i    i   RW   g       @g±µA€\ð?gÐÉc‘"±?i   (   i   i   g      $@(   R   t   emptyR   RX   R   R   (   R   t   i1nR   t   inp0t   inp1(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_sph_in2  s    c         C` s1  d } t  j d ƒ } t d | ƒ | d <t d | d t ƒ| d <t  j t  j | ƒ | t  j | ƒ | t  j | ƒ | d g ƒ } t t | | ƒ t  j d	 ƒ } t	 d | ƒ | d <t	 d | d t ƒ| d <t  j d t
 t | ƒ | d t
 t | ƒ d | d | d g ƒ } t t | | ƒ d  S(
   Ng      ð?i   i    RW   i   g      à?g      à¿(   i   (   i   (   R   R`   R   RX   R   R   R	   R   R   R   R   R
   (   R   R   t   sph_i0t   sph_i0_expectedt   sph_k0t   sph_k0_expected(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_sph_in_kn_order0B  s    ./c         C` s:  t  j d ƒ } d } t d | ƒ | d d <t d | ƒ | d d <t d | ƒ | d d <t d | d t ƒ| d d <t d | d t ƒ| d d <t d | d t ƒ| d d <| d d } | d d d | d d } | d d d | d d } t | d d	 d
 d g d ƒ t | d | | | g d ƒ d  S(   Ni   i   gš™™™™™É?i    i   RW   g       @g      @gkGì~Éï?g¥Åk‡ÿ°?g’)ËÜqÈe?i   (   i   i   g      $@g      .@(   R   R`   R   RX   R   (   R   t   s1R   t   s10t   s11t   s12(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_sph_jnR  s    c         C` s<  t  j d ƒ } d } t d | ƒ | d d <t d | ƒ | d d <t d | ƒ | d d <t d | d t ƒ| d d <t d | d t ƒ| d d <t d | d t ƒ| d d <| d d } | d d d | d d } | d d d | d d } t | d d	 d
 d g d ƒ t | d | | | g d ƒ d  S(   Ni   i   gš™™™™™É?i    i   RW   g       @g      @gDT»—Ÿ¸@g3Ì±wJC@gè-ßuAI‚@i   i	   (   i   i   g      $@g      .@(   R   R`   R   RX   R   (   R   t   knR   t   kn0t   kn1t   kn2(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_sph_kne  s    c         C` s‹   t  d d ƒ } t  d d ƒ } t | d d ƒ t | d d ƒ t  d d ƒ d t  d d ƒ d } t  d d d	 t ƒ} t | | d
 ƒ d  S(   Ni   gš™™™™™É?i    g[_$´e˜wÀi   g&$Þð™Ài   i   RW   i   (   R   R   RX   (   R   t   sy1t   sy2t   sphpyt   sy3(    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   test_sph_ynx  s    $(   R&   R'   Rd   Ri   Rn   Rs   Rx   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyR_   .  s
   				(    (    (    (    (    (    (    ((   t
   __future__R    R   R   t   numpyR   t   numpy.testingR   R   R   RS   R   R   R   R	   R
   R   R   R   R   t   scipy.specialR   R   R   R   t   scipy.integrateR   t   scipy._lib._numpy_compatR   R   R(   R2   R7   R>   RF   RV   RZ   R[   R^   R_   (    (    (    sH   lib/python2.7/site-packages/scipy/special/tests/test_spherical_bessel.pyt   <module>   s$   @"96.1