U
    L?h                     @   s   d Z ddlmZmZ ddlmZ ddlmZmZ G dd deZ	G dd de	Z
G d	d
 d
e	ZG dd de	ZG dd de	ZdS )z- This module contains the Mathieu functions.
    )FunctionArgumentIndexError)sqrt)sincosc                   @   s   e Zd ZdZdZdd ZdS )MathieuBasezj
    Abstract base class for Mathieu functions.

    This class is meant to reduce code duplication.

    Tc                 C   s&   | j \}}}| | | | S N)argsfunc	conjugate)selfaqz r   [/var/www/html/venv/lib/python3.8/site-packages/sympy/functions/special/mathieu_functions.py_eval_conjugate   s    zMathieuBase._eval_conjugateN)__name__
__module____qualname____doc__Z
unbranchedr   r   r   r   r   r   	   s   r   c                   @   s&   e Zd ZdZdddZedd ZdS )	mathieusa  
    The Mathieu Sine function $S(a,q,z)$.

    Explanation
    ===========

    This function is one solution of the Mathieu differential equation:

    .. math ::
        y(x)^{\prime\prime} + (a - 2 q \cos(2 x)) y(x) = 0

    The other solution is the Mathieu Cosine function.

    Examples
    ========

    >>> from sympy import diff, mathieus
    >>> from sympy.abc import a, q, z

    >>> mathieus(a, q, z)
    mathieus(a, q, z)

    >>> mathieus(a, 0, z)
    sin(sqrt(a)*z)

    >>> diff(mathieus(a, q, z), z)
    mathieusprime(a, q, z)

    See Also
    ========

    mathieuc: Mathieu cosine function.
    mathieusprime: Derivative of Mathieu sine function.
    mathieucprime: Derivative of Mathieu cosine function.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Mathieu_function
    .. [2] https://dlmf.nist.gov/28
    .. [3] https://mathworld.wolfram.com/MathieuFunction.html
    .. [4] https://functions.wolfram.com/MathieuandSpheroidalFunctions/MathieuS/

       c                 C   s.   |dkr | j \}}}t|||S t| |d S N   )r	   mathieusprimer   r   Zargindexr   r   r   r   r   r   fdiffF   s    zmathieus.fdiffc                 C   s8   |j r|jrtt|| S | r4| |||  S d S r   )	is_Numberis_zeror   r   could_extract_minus_signclsr   r   r   r   r   r   evalM   s    zmathieus.evalN)r   r   r   r   r   r   classmethodr#   r   r   r   r   r      s   -
r   c                   @   s&   e Zd ZdZdddZedd ZdS )	mathieuca  
    The Mathieu Cosine function $C(a,q,z)$.

    Explanation
    ===========

    This function is one solution of the Mathieu differential equation:

    .. math ::
        y(x)^{\prime\prime} + (a - 2 q \cos(2 x)) y(x) = 0

    The other solution is the Mathieu Sine function.

    Examples
    ========

    >>> from sympy import diff, mathieuc
    >>> from sympy.abc import a, q, z

    >>> mathieuc(a, q, z)
    mathieuc(a, q, z)

    >>> mathieuc(a, 0, z)
    cos(sqrt(a)*z)

    >>> diff(mathieuc(a, q, z), z)
    mathieucprime(a, q, z)

    See Also
    ========

    mathieus: Mathieu sine function
    mathieusprime: Derivative of Mathieu sine function
    mathieucprime: Derivative of Mathieu cosine function

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Mathieu_function
    .. [2] https://dlmf.nist.gov/28
    .. [3] https://mathworld.wolfram.com/MathieuFunction.html
    .. [4] https://functions.wolfram.com/MathieuandSpheroidalFunctions/MathieuC/

    r   c                 C   s.   |dkr | j \}}}t|||S t| |d S r   )r	   mathieucprimer   r   r   r   r   r      s    zmathieuc.fdiffc                 C   s6   |j r|jrtt|| S | r2| ||| S d S r   )r   r   r   r   r    r!   r   r   r   r#      s    zmathieuc.evalN)r   r$   r   r   r   r   r&   V   s   -
r&   c                   @   s&   e Zd ZdZdddZedd ZdS )	r   a"  
    The derivative $S^{\prime}(a,q,z)$ of the Mathieu Sine function.

    Explanation
    ===========

    This function is one solution of the Mathieu differential equation:

    .. math ::
        y(x)^{\prime\prime} + (a - 2 q \cos(2 x)) y(x) = 0

    The other solution is the Mathieu Cosine function.

    Examples
    ========

    >>> from sympy import diff, mathieusprime
    >>> from sympy.abc import a, q, z

    >>> mathieusprime(a, q, z)
    mathieusprime(a, q, z)

    >>> mathieusprime(a, 0, z)
    sqrt(a)*cos(sqrt(a)*z)

    >>> diff(mathieusprime(a, q, z), z)
    (-a + 2*q*cos(2*z))*mathieus(a, q, z)

    See Also
    ========

    mathieus: Mathieu sine function
    mathieuc: Mathieu cosine function
    mathieucprime: Derivative of Mathieu cosine function

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Mathieu_function
    .. [2] https://dlmf.nist.gov/28
    .. [3] https://mathworld.wolfram.com/MathieuFunction.html
    .. [4] https://functions.wolfram.com/MathieuandSpheroidalFunctions/MathieuSPrime/

    r   c                 C   sF   |dkr8| j \}}}d| td|  | t||| S t| |d S Nr      )r	   r   r   r   r   r   r   r   r      s    $zmathieusprime.fdiffc                 C   s>   |j r$|jr$t|tt||  S | r:| ||| S d S r   )r   r   r   r   r    r!   r   r   r   r#      s    zmathieusprime.evalN)r   r$   r   r   r   r   r      s   -
r   c                   @   s&   e Zd ZdZdddZedd ZdS )	r'   a!  
    The derivative $C^{\prime}(a,q,z)$ of the Mathieu Cosine function.

    Explanation
    ===========

    This function is one solution of the Mathieu differential equation:

    .. math ::
        y(x)^{\prime\prime} + (a - 2 q \cos(2 x)) y(x) = 0

    The other solution is the Mathieu Sine function.

    Examples
    ========

    >>> from sympy import diff, mathieucprime
    >>> from sympy.abc import a, q, z

    >>> mathieucprime(a, q, z)
    mathieucprime(a, q, z)

    >>> mathieucprime(a, 0, z)
    -sqrt(a)*sin(sqrt(a)*z)

    >>> diff(mathieucprime(a, q, z), z)
    (-a + 2*q*cos(2*z))*mathieuc(a, q, z)

    See Also
    ========

    mathieus: Mathieu sine function
    mathieuc: Mathieu cosine function
    mathieusprime: Derivative of Mathieu sine function

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Mathieu_function
    .. [2] https://dlmf.nist.gov/28
    .. [3] https://mathworld.wolfram.com/MathieuFunction.html
    .. [4] https://functions.wolfram.com/MathieuandSpheroidalFunctions/MathieuCPrime/

    r   c                 C   sF   |dkr8| j \}}}d| td|  | t||| S t| |d S r(   )r	   r   r&   r   r   r   r   r   r      s    $zmathieucprime.fdiffc                 C   sB   |j r&|jr&t| tt||  S | r>| |||  S d S r   )r   r   r   r   r    r!   r   r   r   r#     s    zmathieucprime.evalN)r   r$   r   r   r   r   r'      s   -
r'   N)r   Zsympy.core.functionr   r   Z(sympy.functions.elementary.miscellaneousr   Z(sympy.functions.elementary.trigonometricr   r   r   r   r&   r   r'   r   r   r   r   <module>   s   >>>