Ë
    7^(h:'  ã                   óö   — d Z dgZddlmZ ddlmZ ddlmZmZ ddl	m
Z
mZmZ ddlmZ ddlmZmZ dd	lmZmZ dd
lmZ ddlmZ ddlmZmZmZ ddlmZmZm Z   ejB                  ee z  «      Z" G d„ de«      Z#y)zb
This module has all the classes and functions related to waves in optics.

**Contains**

* TWave
ÚTWaveé    )ÚBasic)ÚExpr)Ú
DerivativeÚFunction)ÚNumberÚpiÚI)ÚS)ÚSymbolÚsymbols)Ú_sympifyÚsympify)Úexp)Úsqrt)Úatan2ÚcosÚsin)Úspeed_of_lightÚmeterÚsecondc                   ó  — e Zd ZdZdej
                  d ed«      fd„Zed„ «       Z	ed„ «       Z
ed„ «       Zed„ «       Zed	„ «       Zed
„ «       Zed„ «       Zed„ «       Zed„ «       Zd„ ZeZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)r   a4  
    This is a simple transverse sine wave travelling in a one-dimensional space.
    Basic properties are required at the time of creation of the object,
    but they can be changed later with respective methods provided.

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

    It is represented as :math:`A \times cos(k*x - \omega \times t + \phi )`,
    where :math:`A` is the amplitude, :math:`\omega` is the angular frequency,
    :math:`k` is the wavenumber (spatial frequency), :math:`x` is a spatial variable
    to represent the position on the dimension on which the wave propagates,
    and :math:`\phi` is the phase angle of the wave.


    Arguments
    =========

    amplitude : Sympifyable
        Amplitude of the wave.
    frequency : Sympifyable
        Frequency of the wave.
    phase : Sympifyable
        Phase angle of the wave.
    time_period : Sympifyable
        Time period of the wave.
    n : Sympifyable
        Refractive index of the medium.

    Raises
    =======

    ValueError : When neither frequency nor time period is provided
        or they are not consistent.
    TypeError : When anything other than TWave objects is added.


    Examples
    ========

    >>> from sympy import symbols
    >>> from sympy.physics.optics import TWave
    >>> A1, phi1, A2, phi2, f = symbols('A1, phi1, A2, phi2, f')
    >>> w1 = TWave(A1, f, phi1)
    >>> w2 = TWave(A2, f, phi2)
    >>> w3 = w1 + w2  # Superposition of two waves
    >>> w3
    TWave(sqrt(A1**2 + 2*A1*A2*cos(phi1 - phi2) + A2**2), f,
        atan2(A1*sin(phi1) + A2*sin(phi2), A1*cos(phi1) + A2*cos(phi2)), 1/f, n)
    >>> w3.amplitude
    sqrt(A1**2 + 2*A1*A2*cos(phi1 - phi2) + A2**2)
    >>> w3.phase
    atan2(A1*sin(phi1) + A2*sin(phi2), A1*cos(phi1) + A2*cos(phi2))
    >>> w3.speed
    299792458*meter/(second*n)
    >>> w3.angular_velocity
    2*pi*f

    NÚnc                 óp  — |�t        |«      }t        j                  |z  }|�At        |«      }t        j                  |z  }|�!|t        j                  |z  k7  rt        d«      ‚|€|€t        d«      ‚|€}|€}t        |«      }t        |«      }t	        |«      }t        j                  | |||||«      }|S )Nz/frequency and time_period should be consistent.z*Either frequency or time period is needed.)r   r   ÚOneÚ
ValueErrorr   r   Ú__new__)	ÚclsÚ	amplitudeÚ	frequencyÚphaseÚtime_periodr   Ú
_frequencyÚ_time_periodÚobjs	            úX/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/physics/optics/waves.pyr   zTWave.__new__Y   sÈ   € ð Ð"Ü" ;Ó/ˆKÜŸ™˜{Ñ*ˆJØÐ Ü  Ó+ˆIÜŸ5™5 ™?ˆLØÐ&Ø¤§¡ kÑ 1Ò1Ü$Ð%VÓWÐWØÐ Ð!4ÜÐIÓJÐJØÐØ"ˆIØÐØ&ˆKä˜YÓ'ˆ	Ü˜“ˆÜ�A‹JˆÜ�m‰m˜C ¨I°u¸kÈ1ÓMˆØˆ
ó    c                 ó    — | j                   d   S )a!  
        Returns the amplitude of the wave.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.amplitude
        A
        r   ©Úargs©Úselfs    r&   r   zTWave.amplitudev   s   € ð �y‰y˜‰|Ðr'   c                 ó    — | j                   d   S )a?  
        Returns the frequency of the wave,
        in cycles per second.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.frequency
        f
        é   r)   r+   s    r&   r    zTWave.frequency‡   ó   € ð  �y‰y˜‰|Ðr'   c                 ó    — | j                   d   S )a5  
        Returns the phase angle of the wave,
        in radians.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.phase
        phi
        é   r)   r+   s    r&   r!   zTWave.phase™   r/   r'   c                 ó    — | j                   d   S )aI  
        Returns the temporal period of the wave,
        in seconds per cycle.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.time_period
        1/f
        é   r)   r+   s    r&   r"   zTWave.time_period«   r/   r'   c                 ó    — | j                   d   S )z<
        Returns the refractive index of the medium
        é   r)   r+   s    r&   r   zTWave.n½   s   € ð
 �y‰y˜‰|Ðr'   c                 óB   — t         | j                  | j                  z  z  S )aš  
        Returns the wavelength (spatial period) of the wave,
        in meters per cycle.
        It depends on the medium of the wave.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.wavelength
        299792458*meter/(second*f*n)
        )Úcr    r   r+   s    r&   Ú
wavelengthzTWave.wavelengthÄ   s   € ô" �$—.‘. §¡Ñ'Ñ(Ð(r'   c                 ó4   — | j                   | j                  z  S )a�  
        Returns the propagation speed of the wave,
        in meters per second.
        It is dependent on the propagation medium.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.speed
        299792458*meter/(second*n)
        )r8   r    r+   s    r&   ÚspeedzTWave.speedØ   s   € ð" �‰˜tŸ~™~Ñ-Ð-r'   c                 ó.   — dt         z  | j                  z  S )aS  
        Returns the angular velocity of the wave,
        in radians per second.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.angular_velocity
        2*pi*f
        r1   )r	   r    r+   s    r&   Úangular_velocityzTWave.angular_velocityë   s   € ð  ”‰t�D—N‘NÑ"Ð"r'   c                 ó.   — dt         z  | j                  z  S )a_  
        Returns the wavenumber of the wave,
        in radians per meter.

        Examples
        ========

        >>> from sympy import symbols
        >>> from sympy.physics.optics import TWave
        >>> A, phi, f = symbols('A, phi, f')
        >>> w = TWave(A, f, phi)
        >>> w.wavenumber
        pi*second*f*n/(149896229*meter)
        r1   )r	   r8   r+   s    r&   Ú
wavenumberzTWave.wavenumberý   s   € ð  ”‰t�D—O‘OÑ#Ð#r'   c                 ó^   — ddl m} t        | «      j                   || j                  «      z   S )z!String representation of a TWave.r   )Ússtr)Úsympy.printingr@   ÚtypeÚ__name__r*   )r,   r@   s     r&   Ú__str__zTWave.__str__  s"   € å'Ü�D‹z×"Ñ"¡T¨$¯)©)£_Ñ4Ð4r'   c                 óþ  — t        |t        «      �rL| j                  |j                  k(  �r'| j                  |j                  k(  �rt        t	        | j
                  dz  |j
                  dz  z   d| j
                  z  |j
                  z  t        | j                  |j                  z
  «      z  z   «      | j                  t        | j
                  t        | j                  «      z  |j
                  t        |j                  «      z  z   | j
                  t        | j                  «      z  |j
                  t        |j                  «      z  z   «      «      S t        d«      ‚t        t        |«      j                  dz   «      ‚)z�
        Addition of two waves will result in their superposition.
        The type of interference will depend on their phase angles.
        r1   zJInterference of waves with different frequencies has not been implemented.z# and TWave objects cannot be added.)Ú
isinstancer   r    r8   r   r   r   r!   r   r   ÚNotImplementedErrorÚ	TypeErrorrB   rC   ©r,   Úothers     r&   Ú__add__zTWave.__add__  sA  € ô
 �eœUÕ#Ø�~‰~ §¡Ó0°T·_±_È×HXÑHXÓ5XÜœT $§.¡.°!Ñ"3°e·o±oÀqÑ6HÑ"HÈ1Ø"&§.¡.ñL1Ø16·±ñLAÜADØ&*§j¡j°5·;±;Ñ&>óB@ñL@ñ #@ó Að "Ÿ^™^Ü" 4§>¡>´#°d·j±j³/Ñ#AØ$Ÿ™¬s°5·;±;Ó/?Ñ?ñ$@à!Ÿ^™^¬C°·
±
«OÑ;Ø$Ÿ™¬s°5·;±;Ó/?Ñ?ñ@óAó	ð ô *ð +1ó 2ð 2ô œD ›K×0Ñ0Ð3XÑXÓYÐYr'   c                 óÆ   — t        |«      }t        |t        «      r&t        | j                  |z  g| j
                  dd ¢­Ž S t        t        |«      j                  dz   «      ‚)zT
        Multiplying a wave by a scalar rescales the amplitude of the wave.
        r.   Nz( and TWave objects cannot be multiplied.)	r   rF   r   r   r   r*   rH   rB   rC   rI   s     r&   Ú__mul__zTWave.__mul__,  sU   € ô ˜“ˆÜ�eœVÔ$Ü˜Ÿ™¨Ñ-Ð>°·	±	¸!¸"°Ò>Ð>äœD ›K×0Ñ0Ð3]Ñ]Ó^Ð^r'   c                 ó*   — | j                  d|z  «      S ©Néÿÿÿÿ©rK   rI   s     r&   Ú__sub__zTWave.__sub__6  s   € Ø�|‰|˜B˜u™HÓ%Ð%r'   c                 ó$   — | j                  d«      S rO   ©rM   r+   s    r&   Ú__neg__zTWave.__neg__9  s   € Ø�|‰|˜BÓÐr'   c                 ó$   — | j                  |«      S ©NrQ   rI   s     r&   Ú__radd__zTWave.__radd__<  ó   € Ø�|‰|˜EÓ"Ð"r'   c                 ó$   — | j                  |«      S rW   rT   rI   s     r&   Ú__rmul__zTWave.__rmul__?  rY   r'   c                 ó&   — |  j                  |«      S rW   )rX   rI   s     r&   Ú__rsub__zTWave.__rsub__B  s   € Ø�×Ñ Ó&Ð&r'   c                 óÂ   — | j                   t        | j                  t        d«      z  | j                  t        d«      z  z
  | j
                  z   t        dz  z   d¬«      z  S )NÚxÚtr1   F)Úevaluate)r   r   r>   r   r<   r!   r	   ©r,   r*   Úkwargss      r&   Ú_eval_rewrite_as_sinzTWave._eval_rewrite_as_sinE  s_   € Ø�~‰~œc $§/¡/´&¸³+Ñ"=Ø×#Ñ#¤F¨3£KÑ/ñ#0Ø26·*±*ñ#=Ü?AÀ!¹tñ#DØNSôUñ Uð 	Ur'   c                 óª   — | j                   t        | j                  t        d«      z  | j                  t        d«      z  z
  | j
                  z   «      z  S ©Nr_   r`   )r   r   r>   r   r<   r!   rb   s      r&   Ú_eval_rewrite_as_coszTWave._eval_rewrite_as_cosI  sL   € Ø�~‰~œc $§/¡/´&¸³+Ñ"=Ø×#Ñ#¤F¨3£KÑ/ñ#0Ø26·*±*ñ#=ó >ñ >ð 	>r'   c                 ó–   — t        d«      \  }}}}t        d«      }t         |||«      |d«      ||z  t         |||«      |d«      z  z   S )Nzmu, epsilon, x, tÚEr1   )r   r   r   )r,   r*   rc   ÚmuÚepsilonr_   r`   ri   s           r&   Ú_eval_rewrite_as_pdezTWave._eval_rewrite_as_pdeM  sQ   € Ü#Ð$7Ó8ÑˆˆG�Q˜Ü�S‹MˆÜ™!˜A˜q›' 1 aÓ(¨2¨g©:´jÁÀ1ÀaÃÈ!ÈQÓ6OÑ+OÑOÐOr'   c           	      ó¸   — | j                   t        t        | j                  t	        d«      z  | j
                  t	        d«      z  z
  | j                  z   z  «      z  S rf   )r   r   r
   r>   r   r<   r!   rb   s      r&   Ú_eval_rewrite_as_expzTWave._eval_rewrite_as_expR  sS   € Ø�~‰~œc¤! T§_¡_´V¸C³[Ñ%@Ø×#Ñ#¤F¨3£KÑ/ñ&0Ø26·*±*ñ&=ñ #>ó ?ñ ?ð 	?r'   )rC   Ú
__module__Ú__qualname__Ú__doc__r   ÚZeror   r   Úpropertyr   r    r!   r"   r   r8   r:   r<   r>   rD   Ú__repr__rK   rM   rR   rU   rX   r[   r]   rd   rg   rl   rn   © r'   r&   r   r      s  „ ñ:ð~ Ø—&‘&ØÙ�S‹kóð: ñó ðð  ñó ðð" ñó ðð" ñó ðð" ñó ðð ñ)ó ð)ð& ñ.ó ð.ð$ ñ#ó ð#ð" ñ$ó ð$ò"5ð
 €HòZò,_ò&ò ò#ò#ò'òUò>òPó
?r'   N)$rq   Ú__all__Úsympy.core.basicr   Úsympy.core.exprr   Úsympy.core.functionr   r   Úsympy.core.numbersr   r	   r
   Úsympy.core.singletonr   Úsympy.core.symbolr   r   Úsympy.core.sympifyr   r   Ú&sympy.functions.elementary.exponentialr   Ú(sympy.functions.elementary.miscellaneousr   Ú(sympy.functions.elementary.trigonometricr   r   r   Úsympy.physics.unitsr   r   r   Ú
convert_tor7   r   ru   r'   r&   ú<module>rƒ      sc   ðñð ˆ)€å "Ý  ß 4ß .Ñ .Ý "ß /ß 0Ý 6Ý 9ß FÑ Fß =Ñ =ð €N×Ñ˜e F™lÓ+€ôy?ˆDõ y?r'   