§
    OŠtj¢!  ã                   ó„   — d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ g d¢Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ ZdS )é    )Údiff)ÚS)Ú	integrate)ÚVectorÚexpress)Ú_check_frame)Ú_check_vector)ÚcurlÚ
divergenceÚgradientÚis_conservativeÚis_solenoidalÚscalar_potentialÚscalar_potential_differencec                 ó|  — t          | ¦  «         | dk    rt          d¦  «        S t          | |d¬¦  «        } |                      |j        ¦  «        }|                      |j        ¦  «        }|                      |j        ¦  «        }t          d¦  «        }|t          ||d         ¦  «        t          ||d         ¦  «        z
  |j        z  z  }|t          ||d         ¦  «        t          ||d         ¦  «        z
  |j        z  z  }|t          ||d         ¦  «        t          ||d         ¦  «        z
  |j        z  z  }|S )aP  
    Returns the curl of a vector field computed wrt the coordinate
    symbols of the given frame.

    Parameters
    ==========

    vect : Vector
        The vector operand

    frame : ReferenceFrame
        The reference frame to calculate the curl in

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame
    >>> from sympy.physics.vector import curl
    >>> R = ReferenceFrame('R')
    >>> v1 = R[1]*R[2]*R.x + R[0]*R[2]*R.y + R[0]*R[1]*R.z
    >>> curl(v1, R)
    0
    >>> v2 = R[0]*R[1]*R[2]*R.x
    >>> curl(v2, R)
    R_x*R_y*R.y - R_x*R_z*R.z

    r   T©Ú	variablesé   é   )r	   r   r   ÚdotÚxÚyÚzr   )ÚvectÚframeÚvectxÚvectyÚvectzÚoutvecs         úa/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/physics/vector/fieldfunctions.pyr
   r
      s  € õ: �$ÑÔÐØˆq‚y€yÝ�a‰yŒyÐÝ�4˜¨$Ð/Ñ/Ô/€Dà�HŠH�U”WÑÔ€EØ�HŠH�U”WÑÔ€EØ�HŠH�U”WÑÔ€EÝ�A‰YŒY€FØ
�t�E˜5 œ8Ñ$Ô$¥t¨E°5¸´8Ñ'<Ô'<Ñ<ÀÄÑGÑG€FØ
�t�E˜5 œ8Ñ$Ô$¥t¨E°5¸´8Ñ'<Ô'<Ñ<ÀÄÑGÑG€FØ
�t�E˜5 œ8Ñ$Ô$¥t¨E°5¸´8Ñ'<Ô'<Ñ<ÀÄÑGÑG€FØ€Mó    c                 ó¶  — t          | ¦  «         | dk    rt          j        S t          | |d¬¦  «        } |                      |j        ¦  «        }|                      |j        ¦  «        }|                      |j        ¦  «        }t          j        }|t          ||d         ¦  «        z  }|t          ||d         ¦  «        z  }|t          ||d         ¦  «        z  }|S )ab  
    Returns the divergence of a vector field computed wrt the coordinate
    symbols of the given frame.

    Parameters
    ==========

    vect : Vector
        The vector operand

    frame : ReferenceFrame
        The reference frame to calculate the divergence in

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame
    >>> from sympy.physics.vector import divergence
    >>> R = ReferenceFrame('R')
    >>> v1 = R[0]*R[1]*R[2] * (R.x+R.y+R.z)
    >>> divergence(v1, R)
    R_x*R_y + R_x*R_z + R_y*R_z
    >>> v2 = 2*R[1]*R[2]*R.y
    >>> divergence(v2, R)
    2*R_z

    r   Tr   r   r   )	r	   r   ÚZeror   r   r   r   r   r   )r   r   r   r   r   Úouts         r    r   r   :   sÃ   € õ: �$ÑÔÐØˆq‚y€yÝŒvˆÝ�4˜¨$Ð/Ñ/Ô/€DØ�HŠH�U”WÑÔ€EØ�HŠH�U”WÑÔ€EØ�HŠH�U”WÑÔ€EÝ
Œ&€CØ�4��u˜Q”xÑ Ô Ñ €CØ�4��u˜Q”xÑ Ô Ñ €CØ�4��u˜Q”xÑ Ô Ñ €CØ€Jr!   c                 óÈ   — t          |¦  «         t          d¦  «        }t          | |d¬¦  «        } t          |¦  «        D ]!\  }}|t	          | ||         ¦  «        |z  z  }Œ"|S )a…  
    Returns the vector gradient of a scalar field computed wrt the
    coordinate symbols of the given frame.

    Parameters
    ==========

    scalar : sympifiable
        The scalar field to take the gradient of

    frame : ReferenceFrame
        The frame to calculate the gradient in

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame
    >>> from sympy.physics.vector import gradient
    >>> R = ReferenceFrame('R')
    >>> s1 = R[0]*R[1]*R[2]
    >>> gradient(s1, R)
    R_y*R_z*R.x + R_x*R_z*R.y + R_x*R_y*R.z
    >>> s2 = 5*R[0]**2*R[2]
    >>> gradient(s2, R)
    10*R_x*R_z*R.x + 5*R_x**2*R.z

    r   Tr   )r   r   r   Ú	enumerater   )Úscalarr   r   Úir   s        r    r   r   e   sp   € õ: �ÑÔÐÝ�A‰YŒY€FÝ�V˜U¨dÐ3Ñ3Ô3€FÝ˜%Ñ Ô ð -ð -‰ˆˆ1Ø•$�v˜u QœxÑ(Ô(¨1Ñ,Ñ,ˆˆØ€Mr!   c                 óà   — | t          d¦  «        k    rdS t          |                      ¦   «         ¦  «        d         }t          | |¦  «                             ¦   «         t          d¦  «        k    S )aÀ  
    Checks if a field is conservative.

    Parameters
    ==========

    field : Vector
        The field to check for conservative property

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame
    >>> from sympy.physics.vector import is_conservative
    >>> R = ReferenceFrame('R')
    >>> is_conservative(R[1]*R[2]*R.x + R[0]*R[2]*R.y + R[0]*R[1]*R.z)
    True
    >>> is_conservative(R[2] * R.y)
    False

    r   T)r   ÚlistÚseparater
   Úsimplify©Úfieldr   s     r    r   r   Š   s]   € ð2 •�q‘	”	ÒÐØˆtÝ�—’Ñ!Ô!Ñ"Ô" 1Ô%€EÝ��uÑÔ×&Ò&Ñ(Ô(­F°1©I¬IÒ5Ð5r!   c                 óÖ   — | t          d¦  «        k    rdS t          |                      ¦   «         ¦  «        d         }t          | |¦  «                             ¦   «         t
          j        u S )a¶  
    Checks if a field is solenoidal.

    Parameters
    ==========

    field : Vector
        The field to check for solenoidal property

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame
    >>> from sympy.physics.vector import is_solenoidal
    >>> R = ReferenceFrame('R')
    >>> is_solenoidal(R[1]*R[2]*R.x + R[0]*R[2]*R.y + R[0]*R[1]*R.z)
    True
    >>> is_solenoidal(R[1] * R.y)
    False

    r   T)r   r*   r+   r   r,   r   r#   r-   s     r    r   r   ©   sY   € ð2 •�q‘	”	ÒÐØˆtÝ�—’Ñ!Ô!Ñ"Ô" 1Ô%€EÝ�e˜UÑ#Ô#×,Ò,Ñ.Ô.µ!´&Ð8Ð8r!   c                 ó  — t          | ¦  «        st          d¦  «        ‚| t          d¦  «        k    rt          j        S t          |¦  «         t          | |d¬¦  «        } t          |¦  «        }t          |  	                    |d         ¦  «        |d         ¦  «        }t          |dd…         ¦  «        D ]R\  }}t          |||dz            ¦  «        }|  	                    |¦  «        |z
  }|t          |||dz            ¦  «        z  }ŒS|S )aÊ  
    Returns the scalar potential function of a field in a given frame
    (without the added integration constant).

    Parameters
    ==========

    field : Vector
        The vector field whose scalar potential function is to be
        calculated

    frame : ReferenceFrame
        The frame to do the calculation in

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame
    >>> from sympy.physics.vector import scalar_potential, gradient
    >>> R = ReferenceFrame('R')
    >>> scalar_potential(R.z, R) == R[2]
    True
    >>> scalar_field = 2*R[0]**2*R[1]*R[2]
    >>> grad_field = gradient(scalar_field, R)
    >>> scalar_potential(grad_field, R)
    2*R_x**2*R_y*R_z

    zField is not conservativer   Tr   r   N)r   Ú
ValueErrorr   r   r#   r   r   r*   r   r   r&   r   )r.   r   Ú
dimensionsÚtemp_functionr(   ÚdimÚpartial_diffs          r    r   r   È   sÿ   € õ> ˜5Ñ!Ô!ð 6ÝÐ4Ñ5Ô5Ð5Ø•�q‘	”	ÒÐÝŒvˆõ �ÑÔÐÝ�E˜5¨DÐ1Ñ1Ô1€Eå�e‘”€Jå˜eŸiši¨
°1¬Ñ6Ô6¸¸a¼ÑAÔA€MÝ˜J q r rœNÑ+Ô+ð ?ð ?‰ˆˆ3Ý˜M¨5°°Q±¬<Ñ8Ô8ˆØ—y’y ‘~”~¨Ñ4ˆØ� <°°q¸1±u´Ñ>Ô>Ñ>ˆˆØÐr!   c                 ó  — t          |¦  «         t          | t          ¦  «        rt          | |¦  «        }n| }t	          |                     |¦  «        |d¬¦  «        }t	          |                     |¦  «        |d¬¦  «        }i }i }	t          |¦  «        D ]A\  }
}|                     |¦  «        |||
         <   |                     |¦  «        |	||
         <   ŒB|                     |	¦  «        |                     |¦  «        z
  S )a*  
    Returns the scalar potential difference between two points in a
    certain frame, wrt a given field.

    If a scalar field is provided, its values at the two points are
    considered. If a conservative vector field is provided, the values
    of its scalar potential function at the two points are used.

    Returns (potential at position 2) - (potential at position 1)

    Parameters
    ==========

    field : Vector/sympyfiable
        The field to calculate wrt

    frame : ReferenceFrame
        The frame to do the calculations in

    point1 : Point
        The initial Point in given frame

    position2 : Point
        The second Point in the given frame

    origin : Point
        The Point to use as reference point for position vector
        calculation

    Examples
    ========

    >>> from sympy.physics.vector import ReferenceFrame, Point
    >>> from sympy.physics.vector import scalar_potential_difference
    >>> R = ReferenceFrame('R')
    >>> O = Point('O')
    >>> P = O.locatenew('P', R[0]*R.x + R[1]*R.y + R[2]*R.z)
    >>> vectfield = 4*R[0]*R[1]*R.x + 2*R[0]**2*R.y
    >>> scalar_potential_difference(vectfield, R, O, P, O)
    2*R_x**2*R_y
    >>> Q = O.locatenew('O', 3*R.x + R.y + 2*R.z)
    >>> scalar_potential_difference(vectfield, R, P, Q, O)
    -2*R_x**2*R_y + 18

    Tr   )	r   Ú
isinstancer   r   r   Úpos_fromr&   r   Úsubs)r.   r   Úpoint1Úpoint2ÚoriginÚ	scalar_fnÚ	position1Ú	position2Ú
subs_dict1Ú
subs_dict2r(   r   s               r    r   r   ú   sü   € õ^ �ÑÔÐÝ�%�Ñ Ô ð å$ U¨EÑ2Ô2ˆ	ˆ	ð ˆ	å˜Ÿš¨Ñ/Ô/°À$ÐGÑGÔG€IÝ˜Ÿš¨Ñ/Ô/°À$ÐGÑGÔG€Ià€JØ€JÝ˜%Ñ Ô ð 0ð 0‰ˆˆ1Ø Ÿušu YÑ/Ô/ˆ
�5˜”8ÑØ Ÿušu YÑ/Ô/ˆ
�5˜”8ÑÐØ�>Š>˜*Ñ%Ô%¨	¯ª°zÑ(BÔ(BÑBÐBr!   N)Úsympy.core.functionr   Úsympy.core.singletonr   Úsympy.integrals.integralsr   Úsympy.physics.vectorr   r   Úsympy.physics.vector.framer   Úsympy.physics.vector.vectorr	   Ú__all__r
   r   r   r   r   r   r   © r!   r    ú<module>rJ      s  ðØ $Ð $Ð $Ð $Ð $Ð $Ø "Ð "Ð "Ð "Ð "Ð "Ø /Ð /Ð /Ð /Ð /Ð /Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5ð*ð *ð *€ð
)ð )ð )ðX(ð (ð (ðV"ð "ð "ðJ6ð 6ð 6ð>9ð 9ð 9ð>/ð /ð /ðd?Cð ?Cð ?Cð ?Cð ?Cr!   