
    \h:'                         S r S/rSSKJr  SSKJr  SSKJrJr  SSK	J
r
JrJr  SSKJr  SSKJrJr  SS	KJrJr  SS
KJr  SSKJr  SSKJrJrJr  SSKJrJrJ r   \RB                  " \\ -  5      r" " S S\5      r#g)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                   &   \ rS rSrSrS\R                  S\" S5      4S jr\	S 5       r
\	S 5       r\	S 5       r\	S	 5       r\	S
 5       r\	S 5       r\	S 5       r\	S 5       r\	S 5       rS r\rS rS rS rS rS rS rS rS rS rS rS rSr g)r      ax  
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                 |   Ub  [        U5      n[        R                  U-  nUbC  [        U5      n[        R                  U-  nUb"  U[        R                  U-  :w  a  [        S5      eUc  Uc  [        S5      eUc  WnUc  Wn[        U5      n[        U5      n[	        U5      n[
        R                  " XX#XE5      nU$ )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	            R/var/www/auris/envauris/lib/python3.13/site-packages/sympy/physics/optics/waves.pyr   TWave.__new__Y   s     "";/K{*J  +I55?L&k 11$%VWW!4IJJ"I&KY'	AJmmCIkM
    c                      U R                   S   $ )z
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    TWave.amplitudev   s     yy|r)   c                      U R                   S   $ )z
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!   TWave.frequency         yy|r)   c                      U R                   S   $ )z
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"   TWave.phase   r3   r)   c                      U R                   S   $ )z
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#   TWave.time_period   r3   r)   c                      U R                   S   $ )z,
Returns the refractive index of the medium
   r+   r-   s    r'   r   TWave.n   s    
 yy|r)   c                 B    [         U R                  U R                  -  -  $ )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'   
wavelengthTWave.wavelength   s    " $..'((r)   c                 4    U R                   U R                  -  $ )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)
)r?   r!   r-   s    r'   speedTWave.speed   s    " t~~--r)   c                 .    S[         -  U R                  -  $ )z
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
r5   )r	   r!   r-   s    r'   angular_velocityTWave.angular_velocity   s      tDNN""r)   c                 .    S[         -  U R                  -  $ )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)
r5   )r	   r?   r-   s    r'   
wavenumberTWave.wavenumber   s      tDOO##r)   c                 ^    SSK Jn  [        U 5      R                  U" U R                  5      -   $ )z!String representation of a TWave.r   )sstr)sympy.printingrK   type__name__r,   )r.   rK   s     r'   __str__TWave.__str__  s"    'Dz""T$))_44r)   c                    [        U[        5      (       GaN  U R                  UR                  :X  Ga(  U R                  UR                  :X  Ga  [        [	        U R
                  S-  UR
                  S-  -   SU R
                  -  UR
                  -  [        U R                  UR                  -
  5      -  -   5      U R                  [        U R
                  [        U R                  5      -  UR
                  [        UR                  5      -  -   U R
                  [        U R                  5      -  UR
                  [        UR                  5      -  -   5      5      $ [        S5      e[        [        U5      R                  S-   5      e)zw
Addition of two waves will result in their superposition.
The type of interference will depend on their phase angles.
r5   zJInterference of waves with different frequencies has not been implemented.z# and TWave objects cannot be added.)
isinstancer   r!   r?   r   r    r   r"   r   r   NotImplementedError	TypeErrorrM   rN   r.   others     r'   __add__TWave.__add__  sD   
 eU##~~0T__HXHX5XT$..!"3eooq6H"H1"&..L116LAAD&*jj5;;&>B@L@ #@ A "^^"4>>#djj/#A$s5;;/??$@!^^C

O;$s5;;/??@A	  * +1 2 2 DK003XXYYr)   c                     [        U5      n[        U[        5      (       a&  [        U R                  U-  /U R
                  SS Q76 $ [        [        U5      R                  S-   5      e)zD
Multiplying a wave by a scalar rescales the amplitude of the wave.
r1   Nz( and TWave objects cannot be multiplied.)	r   rR   r   r   r    r,   rT   rM   rN   rU   s     r'   __mul__TWave.__mul__,  sX     eV$$->		!">>DK003]]^^r)   c                 *    U R                  SU-  5      $ NrW   rU   s     r'   __sub__TWave.__sub__6  s    ||BuH%%r)   c                 $    U R                  S5      $ r]   rZ   r-   s    r'   __neg__TWave.__neg__9  s    ||Br)   c                 $    U R                  U5      $ Nr_   rU   s     r'   __radd__TWave.__radd__<      ||E""r)   c                 $    U R                  U5      $ rg   rc   rU   s     r'   __rmul__TWave.__rmul__?  rj   r)   c                 &    U * R                  U5      $ rg   )rh   rU   s     r'   __rsub__TWave.__rsub__B  s    &&r)   c                     U R                   [        U R                  [        S5      -  U R                  [        S5      -  -
  U R
                  -   [        S-  -   SS9-  $ )Nxtr5   F)evaluate)r    r   rH   r   rE   r"   r	   r.   r,   kwargss      r'   _eval_rewrite_as_sinTWave._eval_rewrite_as_sinE  s_    ~~c$//&+"=##F3K/#026**#=?A!t#DNSU U 	Ur)   c                     U R                   [        U R                  [        S5      -  U R                  [        S5      -  -
  U R
                  -   5      -  $ Nrr   rs   )r    r   rH   r   rE   r"   ru   s      r'   _eval_rewrite_as_cosTWave._eval_rewrite_as_cosI  sL    ~~c$//&+"=##F3K/#026**#= > > 	>r)   c                     [        S5      u  p4pV[        S5      n[        U" XV5      US5      X4-  [        U" XV5      US5      -  -   $ )Nzmu, epsilon, x, tEr5   )r   r   r   )r.   r,   rv   muepsilonrr   rs   r~   s           r'   _eval_rewrite_as_pdeTWave._eval_rewrite_as_pdeM  sG    #$78QSM!A'1a(2:j1!Q6O+OOOr)   c           	          U R                   [        [        U R                  [	        S5      -  U R
                  [	        S5      -  -
  U R                  -   -  5      -  $ rz   )r    r   r
   rH   r   rE   r"   ru   s      r'   _eval_rewrite_as_expTWave._eval_rewrite_as_expR  sS    ~~c!T__VC[%@##F3K/&026**&= #> ? ? 	?r)    )!rN   
__module____qualname____firstlineno____doc__r   Zeror   r   propertyr    r!   r"   r#   r   r?   rB   rE   rH   rO   __repr__rW   rZ   r`   rd   rh   rl   ro   rw   r{   r   r   __static_attributes__r   r)   r'   r   r      s   :~ &&Sk:     "  "  "   ) )& . .$ # #" $ $"5
 HZ,_& ##'U>P
?r)   N)$r   __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_tor>   r   r   r)   r'   <module>r      sa    ) "   4 . . " / 0 6 9 F F = = eFl+y?D y?r)   