U
    ZÊ¹jw  ã                   @   s4   d dl mZ d dlmZmZmZ G dd„ deƒZdS )é    )ÚBasic)ÚgradientÚ
divergenceÚcurlc                       sj   e Zd ZdZ‡ fdd„Zddd„ZeZeje_ddd„ZeZeje_dd	d
„Z	e	Z
e	je
_dd„ Z‡  ZS )ÚDelz�
    Represents the vector differential operator, usually represented in
    mathematical expressions as the 'nabla' symbol.
    c                    s   t ƒ  | ¡}d|_|S )NZdelop)ÚsuperÚ__new__Ú_name)ÚclsÚobj©Ú	__class__© úW/var/www/html/bwave/python/venv/lib/python3.8/site-packages/sympy/vector/deloperator.pyr      s    zDel.__new__Fc                 C   s   t ||d�S )aº  
        Returns the gradient of the given scalar field, as a
        Vector instance.

        Parameters
        ==========

        scalar_field : SymPy expression
            The scalar field to calculate the gradient of.

        doit : bool
            If True, the result is returned after calling .doit() on
            each component. Else, the returned expression contains
            Derivative instances

        Examples
        ========

        >>> from sympy.vector import CoordSys3D, Del
        >>> C = CoordSys3D('C')
        >>> delop = Del()
        >>> delop.gradient(9)
        0
        >>> delop(C.x*C.y*C.z).doit()
        C.y*C.z*C.i + C.x*C.z*C.j + C.x*C.y*C.k

        ©Údoit)r   )ÚselfZscalar_fieldr   r   r   r   r      s    zDel.gradientc                 C   s   t ||d�S )a  
        Represents the dot product between this operator and a given
        vector - equal to the divergence of the vector field.

        Parameters
        ==========

        vect : Vector
            The vector whose divergence is to be calculated.

        doit : bool
            If True, the result is returned after calling .doit() on
            each component. Else, the returned expression contains
            Derivative instances

        Examples
        ========

        >>> from sympy.vector import CoordSys3D, Del
        >>> delop = Del()
        >>> C = CoordSys3D('C')
        >>> delop.dot(C.x*C.i)
        Derivative(C.x, C.x)
        >>> v = C.x*C.y*C.z * (C.i + C.j + C.k)
        >>> (delop & v).doit()
        C.x*C.y + C.x*C.z + C.y*C.z

        r   )r   ©r   Zvectr   r   r   r   Údot2   s    zDel.dotc                 C   s   t ||d�S )a4  
        Represents the cross product between this operator and a given
        vector - equal to the curl of the vector field.

        Parameters
        ==========

        vect : Vector
            The vector whose curl is to be calculated.

        doit : bool
            If True, the result is returned after calling .doit() on
            each component. Else, the returned expression contains
            Derivative instances

        Examples
        ========

        >>> from sympy.vector import CoordSys3D, Del
        >>> C = CoordSys3D('C')
        >>> delop = Del()
        >>> v = C.x*C.y*C.z * (C.i + C.j + C.k)
        >>> delop.cross(v, doit = True)
        (-C.x*C.y + C.x*C.z)*C.i + (C.x*C.y - C.y*C.z)*C.j +
            (-C.x*C.z + C.y*C.z)*C.k
        >>> (delop ^ C.i).doit()
        0

        r   )r   r   r   r   r   ÚcrossT   s    z	Del.crossc                 C   s   | j S )N)r	   )r   Úprinterr   r   r   Ú	_sympystrx   s    zDel._sympystr)F)F)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__call__r   Ú__and__r   Ú__xor__r   Ú__classcell__r   r   r   r   r      s   


!r   N)Z
sympy.corer   Zsympy.vector.operatorsr   r   r   r   r   r   r   r   Ú<module>   s   