+
    
þÎjºS  ã                   óÌ   € R t ^ RIHtHt ^ RIHtHtHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt R	 tRR
 ltR tRR ltRR ltR tR tR tR tR tRR ltR# )u«	  
The module implements routines to model the polarization of optical fields
and can be used to calculate the effects of polarization optical elements on
the fields.

- Jones vectors.

- Stokes vectors.

- Jones matrices.

- Mueller matrices.

Examples
========

We calculate a generic Jones vector:

>>> from sympy import symbols, pprint, zeros, simplify
>>> from sympy.physics.optics.polarization import (jones_vector, stokes_vector,
...     half_wave_retarder, polarizing_beam_splitter, jones_2_stokes)

>>> psi, chi, p, I0 = symbols("psi, chi, p, I0", real=True)
>>> x0 = jones_vector(psi, chi)
>>> pprint(x0, use_unicode=True)
âŽ¡-â…ˆâ‹…sin(Ï‡)â‹…sin(Ïˆ) + cos(Ï‡)â‹…cos(Ïˆ)âŽ¤
âŽ¢                                âŽ¥
âŽ£â…ˆâ‹…sin(Ï‡)â‹…cos(Ïˆ) + sin(Ïˆ)â‹…cos(Ï‡) âŽ¦

And the more general Stokes vector:

>>> s0 = stokes_vector(psi, chi, p, I0)
>>> pprint(s0, use_unicode=True)
âŽ¡          Iâ‚€          âŽ¤
âŽ¢                      âŽ¥
âŽ¢Iâ‚€â‹…pâ‹…cos(2â‹…Ï‡)â‹…cos(2â‹…Ïˆ)âŽ¥
âŽ¢                      âŽ¥
âŽ¢Iâ‚€â‹…pâ‹…sin(2â‹…Ïˆ)â‹…cos(2â‹…Ï‡)âŽ¥
âŽ¢                      âŽ¥
âŽ£    Iâ‚€â‹…pâ‹…sin(2â‹…Ï‡)     âŽ¦

We calculate how the Jones vector is modified by a half-wave plate:

>>> alpha = symbols("alpha", real=True)
>>> HWP = half_wave_retarder(alpha)
>>> x1 = simplify(HWP*x0)

We calculate the very common operation of passing a beam through a half-wave
plate and then through a polarizing beam-splitter. We do this by putting this
Jones vector as the first entry of a two-Jones-vector state that is transformed
by a 4x4 Jones matrix modelling the polarizing beam-splitter to get the
transmitted and reflected Jones vectors:

>>> PBS = polarizing_beam_splitter()
>>> X1 = zeros(4, 1)
>>> X1[:2, :] = x1
>>> X2 = PBS*X1
>>> transmitted_port = X2[:2, :]
>>> reflected_port = X2[2:, :]

This allows us to calculate how the power in both ports depends on the initial
polarization:

>>> transmitted_power = jones_2_stokes(transmitted_port)[0]
>>> reflected_power = jones_2_stokes(reflected_port)[0]
>>> print(transmitted_power)
cos(-2*alpha + chi + psi)**2/2 + cos(2*alpha + chi - psi)**2/2


>>> print(reflected_power)
sin(-2*alpha + chi + psi)**2/2 + sin(2*alpha + chi - psi)**2/2

Please see the description of the individual functions for further
details and examples.

References
==========

.. [1] https://en.wikipedia.org/wiki/Jones_calculus
.. [2] https://en.wikipedia.org/wiki/Mueller_calculus
.. [3] https://en.wikipedia.org/wiki/Stokes_parameters

)ÚIÚpi)ÚAbsÚimÚre)Úexp)Úsqrt)ÚcosÚsin)ÚMatrix)Úsimplify)ÚTensorProductc                ó.  € \        \        ) \        V4      ,          \        V 4      ,          \        V4      \        V 4      ,          ,           \        \        V4      ,          \        V 4      ,          \        V 4      \        V4      ,          ,           .4      # )u¯  A Jones vector corresponding to a polarization ellipse with `psi` tilt,
and `chi` circularity.

Parameters
==========

psi : numeric type or SymPy Symbol
    The tilt of the polarization relative to the `x` axis.

chi : numeric type or SymPy Symbol
    The angle adjacent to the mayor axis of the polarization ellipse.


Returns
=======

Matrix :
    A Jones vector.

Examples
========

The axes on the PoincarÃ© sphere.

>>> from sympy import pprint, symbols, pi
>>> from sympy.physics.optics.polarization import jones_vector
>>> psi, chi = symbols("psi, chi", real=True)

A general Jones vector.

>>> pprint(jones_vector(psi, chi), use_unicode=True)
âŽ¡-â…ˆâ‹…sin(Ï‡)â‹…sin(Ïˆ) + cos(Ï‡)â‹…cos(Ïˆ)âŽ¤
âŽ¢                                âŽ¥
âŽ£â…ˆâ‹…sin(Ï‡)â‹…cos(Ïˆ) + sin(Ïˆ)â‹…cos(Ï‡) âŽ¦

Horizontal polarization.

>>> pprint(jones_vector(0, 0), use_unicode=True)
âŽ¡1âŽ¤
âŽ¢ âŽ¥
âŽ£0âŽ¦

Vertical polarization.

>>> pprint(jones_vector(pi/2, 0), use_unicode=True)
âŽ¡0âŽ¤
âŽ¢ âŽ¥
âŽ£1âŽ¦

Diagonal polarization.

>>> pprint(jones_vector(pi/4, 0), use_unicode=True)
âŽ¡âˆš2âŽ¤
âŽ¢â”€â”€âŽ¥
âŽ¢2 âŽ¥
âŽ¢  âŽ¥
âŽ¢âˆš2âŽ¥
âŽ¢â”€â”€âŽ¥
âŽ£2 âŽ¦

Anti-diagonal polarization.

>>> pprint(jones_vector(-pi/4, 0), use_unicode=True)
âŽ¡ âˆš2 âŽ¤
âŽ¢ â”€â”€ âŽ¥
âŽ¢ 2  âŽ¥
âŽ¢    âŽ¥
âŽ¢-âˆš2 âŽ¥
âŽ¢â”€â”€â”€â”€âŽ¥
âŽ£ 2  âŽ¦

Right-hand circular polarization.

>>> pprint(jones_vector(0, pi/4), use_unicode=True)
âŽ¡ âˆš2 âŽ¤
âŽ¢ â”€â”€ âŽ¥
âŽ¢ 2  âŽ¥
âŽ¢    âŽ¥
âŽ¢âˆš2â‹…â…ˆâŽ¥
âŽ¢â”€â”€â”€â”€âŽ¥
âŽ£ 2  âŽ¦

Left-hand circular polarization.

>>> pprint(jones_vector(0, -pi/4), use_unicode=True)
âŽ¡  âˆš2  âŽ¤
âŽ¢  â”€â”€  âŽ¥
âŽ¢  2   âŽ¥
âŽ¢      âŽ¥
âŽ¢-âˆš2â‹…â…ˆ âŽ¥
âŽ¢â”€â”€â”€â”€â”€â”€âŽ¥
âŽ£  2   âŽ¦

)r   r   r
   r	   )ÚpsiÚchis   &&ÚW/opt/data/home/.local/lib/python3.14/site-packages/sympy/physics/optics/polarization.pyÚjones_vectorr   a   sd   € ô~ ”A�2”c˜#“h•;œs 3›xÕ'¬#¨c«(´3°s³8Õ*;Õ;Ü”S˜“X•:œc #›hÕ&¬¨S«´#°c³(Õ):Õ:ð<ó =ð =ó    c                ó6  € TpW2,          \        ^V ,          4      ,          \        ^V,          4      ,          pW2,          \        ^V ,          4      ,          \        ^V,          4      ,          pW2,          \        ^V,          4      ,          p\        WEWg.4      # )uÃ  A Stokes vector corresponding to a polarization ellipse with ``psi``
tilt, and ``chi`` circularity.

Parameters
==========

psi : numeric type or SymPy Symbol
    The tilt of the polarization relative to the ``x`` axis.
chi : numeric type or SymPy Symbol
    The angle adjacent to the mayor axis of the polarization ellipse.
p : numeric type or SymPy Symbol
    The degree of polarization.
I : numeric type or SymPy Symbol
    The intensity of the field.


Returns
=======

Matrix :
    A Stokes vector.

Examples
========

The axes on the PoincarÃ© sphere.

>>> from sympy import pprint, symbols, pi
>>> from sympy.physics.optics.polarization import stokes_vector
>>> psi, chi, p, I = symbols("psi, chi, p, I", real=True)
>>> pprint(stokes_vector(psi, chi, p, I), use_unicode=True)
âŽ¡          I          âŽ¤
âŽ¢                     âŽ¥
âŽ¢Iâ‹…pâ‹…cos(2â‹…Ï‡)â‹…cos(2â‹…Ïˆ)âŽ¥
âŽ¢                     âŽ¥
âŽ¢Iâ‹…pâ‹…sin(2â‹…Ïˆ)â‹…cos(2â‹…Ï‡)âŽ¥
âŽ¢                     âŽ¥
âŽ£    Iâ‹…pâ‹…sin(2â‹…Ï‡)     âŽ¦


Horizontal polarization

>>> pprint(stokes_vector(0, 0), use_unicode=True)
âŽ¡1âŽ¤
âŽ¢ âŽ¥
âŽ¢1âŽ¥
âŽ¢ âŽ¥
âŽ¢0âŽ¥
âŽ¢ âŽ¥
âŽ£0âŽ¦

Vertical polarization

>>> pprint(stokes_vector(pi/2, 0), use_unicode=True)
âŽ¡1 âŽ¤
âŽ¢  âŽ¥
âŽ¢-1âŽ¥
âŽ¢  âŽ¥
âŽ¢0 âŽ¥
âŽ¢  âŽ¥
âŽ£0 âŽ¦

Diagonal polarization

>>> pprint(stokes_vector(pi/4, 0), use_unicode=True)
âŽ¡1âŽ¤
âŽ¢ âŽ¥
âŽ¢0âŽ¥
âŽ¢ âŽ¥
âŽ¢1âŽ¥
âŽ¢ âŽ¥
âŽ£0âŽ¦

Anti-diagonal polarization

>>> pprint(stokes_vector(-pi/4, 0), use_unicode=True)
âŽ¡1 âŽ¤
âŽ¢  âŽ¥
âŽ¢0 âŽ¥
âŽ¢  âŽ¥
âŽ¢-1âŽ¥
âŽ¢  âŽ¥
âŽ£0 âŽ¦

Right-hand circular polarization

>>> pprint(stokes_vector(0, pi/4), use_unicode=True)
âŽ¡1âŽ¤
âŽ¢ âŽ¥
âŽ¢0âŽ¥
âŽ¢ âŽ¥
âŽ¢0âŽ¥
âŽ¢ âŽ¥
âŽ£1âŽ¦

Left-hand circular polarization

>>> pprint(stokes_vector(0, -pi/4), use_unicode=True)
âŽ¡1 âŽ¤
âŽ¢  âŽ¥
âŽ¢0 âŽ¥
âŽ¢  âŽ¥
âŽ¢0 âŽ¥
âŽ¢  âŽ¥
âŽ£-1âŽ¦

Unpolarized light

>>> pprint(stokes_vector(0, 0, 0), use_unicode=True)
âŽ¡1âŽ¤
âŽ¢ âŽ¥
âŽ¢0âŽ¥
âŽ¢ âŽ¥
âŽ¢0âŽ¥
âŽ¢ âŽ¥
âŽ£0âŽ¦

)r	   r
   r   )r   r   Úpr   ÚS0ÚS1ÚS2ÚS3s   &&&&    r   Ústokes_vectorr   Ä   sm   € ðn 
€BØ	
�ŒS��3•‹Z�œ˜A˜c�E›
Õ	"€BØ	
�ŒS��3•‹Z�œ˜A˜c�E›
Õ	"€BØ	
�ŒS��3•‹Z�€BÜ�2˜2Ð"Ó#Ð#r   c                óT  € V w  r\        \        V4      ^,          \        V4      ^,          ,           \        V4      ^,          \        V4      ^,          ,
          ^\        WP                  4       ,          4      ,          R\	        WP                  4       ,          4      ,          .4      # )u;  Return the Stokes vector for a Jones vector ``e``.

Parameters
==========

e : SymPy Matrix
    A Jones vector.

Returns
=======

SymPy Matrix
    A Jones vector.

Examples
========

The axes on the PoincarÃ© sphere.

>>> from sympy import pprint, pi
>>> from sympy.physics.optics.polarization import jones_vector
>>> from sympy.physics.optics.polarization import jones_2_stokes
>>> H = jones_vector(0, 0)
>>> V = jones_vector(pi/2, 0)
>>> D = jones_vector(pi/4, 0)
>>> A = jones_vector(-pi/4, 0)
>>> R = jones_vector(0, pi/4)
>>> L = jones_vector(0, -pi/4)
>>> pprint([jones_2_stokes(e) for e in [H, V, D, A, R, L]],
...         use_unicode=True)
âŽ¡âŽ¡1âŽ¤  âŽ¡1 âŽ¤  âŽ¡1âŽ¤  âŽ¡1 âŽ¤  âŽ¡1âŽ¤  âŽ¡1 âŽ¤âŽ¤
âŽ¢âŽ¢ âŽ¥  âŽ¢  âŽ¥  âŽ¢ âŽ¥  âŽ¢  âŽ¥  âŽ¢ âŽ¥  âŽ¢  âŽ¥âŽ¥
âŽ¢âŽ¢1âŽ¥  âŽ¢-1âŽ¥  âŽ¢0âŽ¥  âŽ¢0 âŽ¥  âŽ¢0âŽ¥  âŽ¢0 âŽ¥âŽ¥
âŽ¢âŽ¢ âŽ¥, âŽ¢  âŽ¥, âŽ¢ âŽ¥, âŽ¢  âŽ¥, âŽ¢ âŽ¥, âŽ¢  âŽ¥âŽ¥
âŽ¢âŽ¢0âŽ¥  âŽ¢0 âŽ¥  âŽ¢1âŽ¥  âŽ¢-1âŽ¥  âŽ¢0âŽ¥  âŽ¢0 âŽ¥âŽ¥
âŽ¢âŽ¢ âŽ¥  âŽ¢  âŽ¥  âŽ¢ âŽ¥  âŽ¢  âŽ¥  âŽ¢ âŽ¥  âŽ¢  âŽ¥âŽ¥
âŽ£âŽ£0âŽ¦  âŽ£0 âŽ¦  âŽ£0âŽ¦  âŽ£0 âŽ¦  âŽ£1âŽ¦  âŽ£-1âŽ¦âŽ¦

éþÿÿÿ)r   r   r   Ú	conjugater   )ÚeÚexÚeys   &  r   Újones_2_stokesr!   B  sy   € ðP �F€BÜ”3�r“7˜A•:¤ B£¨¥
Õ*Ü�r“7˜A•:¤ B£¨¥
Õ*Ø”R˜Ÿ<™<›>Õ)Ó*Õ*Ø”b˜ŸL™L›NÕ*Ó+Õ+ð-ó .ð .r   c                óÌ   € \        \        V 4      ^,          \        V 4      \        V 4      ,          .\        V 4      \        V 4      ,          \        V 4      ^,          ..4      pV# )uØ  A linear polarizer Jones matrix with transmission axis at
an angle ``theta``.

Parameters
==========

theta : numeric type or SymPy Symbol
    The angle of the transmission axis relative to the horizontal plane.

Returns
=======

SymPy Matrix
    A Jones matrix representing the polarizer.

Examples
========

A generic polarizer.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import linear_polarizer
>>> theta = symbols("theta", real=True)
>>> J = linear_polarizer(theta)
>>> pprint(J, use_unicode=True)
âŽ¡      2                     âŽ¤
âŽ¢   cos (Î¸)     sin(Î¸)â‹…cos(Î¸)âŽ¥
âŽ¢                            âŽ¥
âŽ¢                     2      âŽ¥
âŽ£sin(Î¸)â‹…cos(Î¸)     sin (Î¸)   âŽ¦


)r   r	   r
   )ÚthetaÚMs   & r   Úlinear_polarizerr%   q  sR   € ôD 	”�U“˜Q•¤ E£
¬3¨u«:Õ 5Ð6Ü�U“œC ›JÕ&¬¨E«
°A­Ð6ð8ó 	9€Aà€Hr   c           	     ób  € \        \        V 4      ^,          \        \        V,          4      \	        V 4      ^,          ,          ,           ^\        \        V,          4      ,
          \        V 4      ,          \	        V 4      ,          .^\        \        V,          4      ,
          \        V 4      ,          \	        V 4      ,          \	        V 4      ^,          \        \        V,          4      \        V 4      ^,          ,          ,           ..4      pV\        \        ) V,          ^,          4      ,          # )u»  A phase retarder Jones matrix with retardance ``delta`` at angle ``theta``.

Parameters
==========

theta : numeric type or SymPy Symbol
    The angle of the fast axis relative to the horizontal plane.
delta : numeric type or SymPy Symbol
    The phase difference between the fast and slow axes of the
    transmitted light.

Returns
=======

SymPy Matrix :
    A Jones matrix representing the retarder.

Examples
========

A generic retarder.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import phase_retarder
>>> theta, delta = symbols("theta, delta", real=True)
>>> R = phase_retarder(theta, delta)
>>> pprint(R, use_unicode=True)
âŽ¡                          -â…ˆâ‹…Î´               -â…ˆâ‹…Î´               âŽ¤
âŽ¢                          â”€â”€â”€â”€â”€              â”€â”€â”€â”€â”€              âŽ¥
âŽ¢âŽ› â…ˆâ‹…Î´    2         2   âŽž    2    âŽ›     â…ˆâ‹…Î´âŽž    2                âŽ¥
âŽ¢âŽ�â„¯   â‹…sin (Î¸) + cos (Î¸)âŽ â‹…â„¯       âŽ�1 - â„¯   âŽ â‹…â„¯     â‹…sin(Î¸)â‹…cos(Î¸)âŽ¥
âŽ¢                                                                âŽ¥
âŽ¢            -â…ˆâ‹…Î´                                           -â…ˆâ‹…Î´ âŽ¥
âŽ¢            â”€â”€â”€â”€â”€                                          â”€â”€â”€â”€â”€âŽ¥
âŽ¢âŽ›     â…ˆâ‹…Î´âŽž    2                  âŽ› â…ˆâ‹…Î´    2         2   âŽž    2  âŽ¥
âŽ£âŽ�1 - â„¯   âŽ â‹…â„¯     â‹…sin(Î¸)â‹…cos(Î¸)  âŽ�â„¯   â‹…cos (Î¸) + sin (Î¸)âŽ â‹…â„¯     âŽ¦

)r   r	   r   r   r
   )r#   ÚdeltaÚRs   && r   Úphase_retarderr)   ˜  sÄ   € ôN 	”�U“˜Q•¤¤Q u¥W£¬c°%«j¸!­mÕ!;Õ;Ø”3”q˜•w“<•¤ U£Õ+¬C°«JÕ6ð8à”Cœ˜%�“L•.¤# e£*Õ,¬S°«ZÕ7Ü�E“
˜A•¤¤A e¥G£¬S°«Z¸­]Õ :Õ:ð<ð=ó 	>€Að ŒS”!��E•˜!•‹_ÕÐr   c                ó"   € \        V \        4      # )uM  A half-wave retarder Jones matrix at angle ``theta``.

Parameters
==========

theta : numeric type or SymPy Symbol
    The angle of the fast axis relative to the horizontal plane.

Returns
=======

SymPy Matrix
    A Jones matrix representing the retarder.

Examples
========

A generic half-wave plate.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import half_wave_retarder
>>> theta= symbols("theta", real=True)
>>> HWP = half_wave_retarder(theta)
>>> pprint(HWP, use_unicode=True)
âŽ¡   âŽ›     2         2   âŽž                        âŽ¤
âŽ¢-â…ˆâ‹…âŽ�- sin (Î¸) + cos (Î¸)âŽ     -2â‹…â…ˆâ‹…sin(Î¸)â‹…cos(Î¸)  âŽ¥
âŽ¢                                                âŽ¥
âŽ¢                             âŽ›   2         2   âŽžâŽ¥
âŽ£   -2â‹…â…ˆâ‹…sin(Î¸)â‹…cos(Î¸)     -â…ˆâ‹…âŽ�sin (Î¸) - cos (Î¸)âŽ âŽ¦

©r)   r   ©r#   s   &r   Úhalf_wave_retarderr-   Æ  s   € ô@ ˜%¤Ó$Ð$r   c                ó0   € \        V \        ^,          4      # )u×  A quarter-wave retarder Jones matrix at angle ``theta``.

Parameters
==========

theta : numeric type or SymPy Symbol
    The angle of the fast axis relative to the horizontal plane.

Returns
=======

SymPy Matrix
    A Jones matrix representing the retarder.

Examples
========

A generic quarter-wave plate.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import quarter_wave_retarder
>>> theta= symbols("theta", real=True)
>>> QWP = quarter_wave_retarder(theta)
>>> pprint(QWP, use_unicode=True)
âŽ¡                       -â…ˆâ‹…Ï€            -â…ˆâ‹…Ï€               âŽ¤
âŽ¢                       â”€â”€â”€â”€â”€           â”€â”€â”€â”€â”€              âŽ¥
âŽ¢âŽ›     2         2   âŽž    4               4                âŽ¥
âŽ¢âŽ�â…ˆâ‹…sin (Î¸) + cos (Î¸)âŽ â‹…â„¯       (1 - â…ˆ)â‹…â„¯     â‹…sin(Î¸)â‹…cos(Î¸)âŽ¥
âŽ¢                                                          âŽ¥
âŽ¢         -â…ˆâ‹…Ï€                                        -â…ˆâ‹…Ï€ âŽ¥
âŽ¢         â”€â”€â”€â”€â”€                                       â”€â”€â”€â”€â”€âŽ¥
âŽ¢           4                  âŽ›   2           2   âŽž    4  âŽ¥
âŽ£(1 - â…ˆ)â‹…â„¯     â‹…sin(Î¸)â‹…cos(Î¸)  âŽ�sin (Î¸) + â…ˆâ‹…cos (Î¸)âŽ â‹…â„¯     âŽ¦

r+   r,   s   &r   Úquarter_wave_retarderr/   é  s   € ôH ˜%¤ A¥Ó&Ð&r   c                óH   € \        \        V 4      ^ .^ \        V 4      ..4      # )u  An attenuator Jones matrix with transmittance ``T``.

Parameters
==========

T : numeric type or SymPy Symbol
    The transmittance of the attenuator.

Returns
=======

SymPy Matrix
    A Jones matrix representing the filter.

Examples
========

A generic filter.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import transmissive_filter
>>> T = symbols("T", real=True)
>>> NDF = transmissive_filter(T)
>>> pprint(NDF, use_unicode=True)
âŽ¡âˆšT  0 âŽ¤
âŽ¢      âŽ¥
âŽ£0   âˆšTâŽ¦

©r   r   )ÚTs   &r   Útransmissive_filterr3     s$   € ô< ”D˜“G˜Q�< !¤T¨!£W Ð.Ó/Ð/r   c                óJ   € \        \        V 4      ^ .^ \        V 4      ) ..4      # )uó  A reflective filter Jones matrix with reflectance ``R``.

Parameters
==========

R : numeric type or SymPy Symbol
    The reflectance of the filter.

Returns
=======

SymPy Matrix
    A Jones matrix representing the filter.

Examples
========

A generic filter.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import reflective_filter
>>> R = symbols("R", real=True)
>>> pprint(reflective_filter(R), use_unicode=True)
âŽ¡âˆšR   0 âŽ¤
âŽ¢       âŽ¥
âŽ£0   -âˆšRâŽ¦

r1   )r(   s   &r   Úreflective_filterr5   1  s&   € ô: ”D˜“G˜Q�< !¤d¨1£g X Ð/Ó0Ð0r   c           	     óÂ   € \        . RO. RO. RO^ \        ) \        ^ ..4      p\        V\        W P	                  4       4      ,          VP                  4       ,          4      # )u¢
  The Mueller matrix corresponding to Jones matrix `J`.

Parameters
==========

J : SymPy Matrix
    A Jones matrix.

Returns
=======

SymPy Matrix
    The corresponding Mueller matrix.

Examples
========

Generic optical components.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import (mueller_matrix,
...     linear_polarizer, half_wave_retarder, quarter_wave_retarder)
>>> theta = symbols("theta", real=True)

A linear_polarizer

>>> pprint(mueller_matrix(linear_polarizer(theta)), use_unicode=True)
âŽ¡            cos(2â‹…Î¸)      sin(2â‹…Î¸)     âŽ¤
âŽ¢  1/2       â”€â”€â”€â”€â”€â”€â”€â”€      â”€â”€â”€â”€â”€â”€â”€â”€    0âŽ¥
âŽ¢               2             2         âŽ¥
âŽ¢                                       âŽ¥
âŽ¢cos(2â‹…Î¸)  cos(4â‹…Î¸)   1    sin(4â‹…Î¸)     âŽ¥
âŽ¢â”€â”€â”€â”€â”€â”€â”€â”€  â”€â”€â”€â”€â”€â”€â”€â”€ + â”€    â”€â”€â”€â”€â”€â”€â”€â”€    0âŽ¥
âŽ¢   2         4       4       4         âŽ¥
âŽ¢                                       âŽ¥
âŽ¢sin(2â‹…Î¸)    sin(4â‹…Î¸)    1   cos(4â‹…Î¸)   âŽ¥
âŽ¢â”€â”€â”€â”€â”€â”€â”€â”€    â”€â”€â”€â”€â”€â”€â”€â”€    â”€ - â”€â”€â”€â”€â”€â”€â”€â”€  0âŽ¥
âŽ¢   2           4        4      4       âŽ¥
âŽ¢                                       âŽ¥
âŽ£   0           0             0        0âŽ¦

A half-wave plate

>>> pprint(mueller_matrix(half_wave_retarder(theta)), use_unicode=True)
âŽ¡1              0                           0               0 âŽ¤
âŽ¢                                                             âŽ¥
âŽ¢        4           2                                        âŽ¥
âŽ¢0  8â‹…sin (Î¸) - 8â‹…sin (Î¸) + 1           sin(4â‹…Î¸)            0 âŽ¥
âŽ¢                                                             âŽ¥
âŽ¢                                     4           2           âŽ¥
âŽ¢0          sin(4â‹…Î¸)           - 8â‹…sin (Î¸) + 8â‹…sin (Î¸) - 1  0 âŽ¥
âŽ¢                                                             âŽ¥
âŽ£0              0                           0               -1âŽ¦

A quarter-wave plate

>>> pprint(mueller_matrix(quarter_wave_retarder(theta)), use_unicode=True)
âŽ¡1       0             0            0    âŽ¤
âŽ¢                                        âŽ¥
âŽ¢   cos(4â‹…Î¸)   1    sin(4â‹…Î¸)             âŽ¥
âŽ¢0  â”€â”€â”€â”€â”€â”€â”€â”€ + â”€    â”€â”€â”€â”€â”€â”€â”€â”€    -sin(2â‹…Î¸)âŽ¥
âŽ¢      2       2       2                 âŽ¥
âŽ¢                                        âŽ¥
âŽ¢     sin(4â‹…Î¸)    1   cos(4â‹…Î¸)           âŽ¥
âŽ¢0    â”€â”€â”€â”€â”€â”€â”€â”€    â”€ - â”€â”€â”€â”€â”€â”€â”€â”€  cos(2â‹…Î¸) âŽ¥
âŽ¢        2        2      2               âŽ¥
âŽ¢                                        âŽ¥
âŽ£0    sin(2â‹…Î¸)     -cos(2â‹…Î¸)        0    âŽ¦

)é   é    r8   r7   )r7   r8   r8   éÿÿÿÿ)r8   r7   r7   r8   )r   r   r   r   r   Úinv)ÚJÚAs   & r   Úmueller_matrixr=   Q  sQ   € ôN 	’ÚÚØ”Q�Bœ˜1�ðó 	 €Aô
 �A”m A§{¡{£}Ó5Õ5°a·e±e³gÕ=Ó>Ð>r   c                óœ  € \        \        V 4      ^ \        \        V4      ,          ^ .^ \        V4      ^ \        ) \        V4      ,          \        \        V,          4      ,          .\        \        V4      ,          ^ \        V 4      ^ .^ \        ) \        V4      ,          \        \        V,          4      ,          ^ \        V4      ..4      pV# )aß  A polarizing beam splitter Jones matrix at angle `theta`.

Parameters
==========

J : SymPy Matrix
    A Jones matrix.
Tp : numeric type or SymPy Symbol
    The transmissivity of the P-polarized component.
Rs : numeric type or SymPy Symbol
    The reflectivity of the S-polarized component.
Ts : numeric type or SymPy Symbol
    The transmissivity of the S-polarized component.
Rp : numeric type or SymPy Symbol
    The reflectivity of the P-polarized component.
phia : numeric type or SymPy Symbol
    The phase difference between transmitted and reflected component for
    output mode a.
phib : numeric type or SymPy Symbol
    The phase difference between transmitted and reflected component for
    output mode b.


Returns
=======

SymPy Matrix
    A 4x4 matrix representing the PBS. This matrix acts on a 4x1 vector
    whose first two entries are the Jones vector on one of the PBS ports,
    and the last two entries the Jones vector on the other port.

Examples
========

Generic polarizing beam-splitter.

>>> from sympy import pprint, symbols
>>> from sympy.physics.optics.polarization import polarizing_beam_splitter
>>> Ts, Rs, Tp, Rp = symbols(r"Ts, Rs, Tp, Rp", positive=True)
>>> phia, phib = symbols("phi_a, phi_b", real=True)
>>> PBS = polarizing_beam_splitter(Tp, Rs, Ts, Rp, phia, phib)
>>> pprint(PBS, use_unicode=False)
[   ____                           ____                    ]
[ \/ Tp            0           I*\/ Rp           0         ]
[                                                          ]
[                  ____                       ____  I*phi_a]
[   0            \/ Ts            0      -I*\/ Rs *e       ]
[                                                          ]
[    ____                         ____                     ]
[I*\/ Rp           0            \/ Tp            0         ]
[                                                          ]
[               ____  I*phi_b                    ____      ]
[   0      -I*\/ Rs *e            0            \/ Ts       ]

)r   r   r   r   )ÚTpÚRsÚTsÚRpÚphiaÚphibÚPBSs   &&&&&& r   Úpolarizing_beam_splitterrF      s˜   € ôp ”4˜“8˜Q¤¤$ r£(¥
¨AÐ.Ø”d˜2“h ¤A 2¤d¨2£h¥;¬s´1°Tµ6«{Õ#:Ð;Ü”T˜"“X•:˜q¤$ r£(¨AÐ.Ø”q�bœ˜b›•k¤#¤a¨¥f£+Õ-¨q´$°r³(Ð;ð=ó >€Cð €Jr   N)r7   r7   )r8   )r8   r8   )r7   r7   r8   r8   r8   r8   ) Ú__doc__Úsympy.core.numbersr   r   Ú$sympy.functions.elementary.complexesr   r   r   Ú&sympy.functions.elementary.exponentialr   Ú(sympy.functions.elementary.miscellaneousr   Ú(sympy.functions.elementary.trigonometricr	   r
   Úsympy.matrices.denser   Úsympy.simplify.simplifyr   Úsympy.physics.quantumr   r   r   r!   r%   r)   r-   r/   r3   r5   r=   rF   © r   r   Ú<module>rQ      sm   ðñR÷h 'ß >Ñ >Ý 6Ý 9ß ?Ý 'Ý ,Ý /ò`=ôF{$ò|,.ô^$ôN+ò\ %òF$'òN0òB1ò@L?ö^<r   