
    \h?                     p    S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
   " S S\5      r " S	 S
\5      rg)z
Physical quantities.
    )
AtomicExpr)Symbol)sympify)_QuantityMapper)Prefixc                       \ rS rSrSrSrSrSrSrSr	Sr
    SS jrS rS r\S	 5       r\S
 5       r\S 5       r\S 5       rS rS rS rS rS rSS jr\S 5       r\S 5       rSrg)Quantity   zP
Physical quantity: can be a unit of measure, a constant or a generic quantity.
TFNc                     [        U[        5      (       d  [        U5      nUc  UnO [        U[        5      (       a  [        U5      nXpl        [        R
                  " XU5      n	Xl        X)l        X9l        XIl	        XYl
        Xil        Xyl        U	$ N)
isinstancer   str_is_prefixedr   __new___name_abbrev_latex_repr_unicode_repr_ascii_repr_mathml_repr)
clsnameabbrev
latex_reprpretty_unicode_reprpretty_ascii_reprmathml_presentation_repris_prefixedassumptionsobjs
             V/var/www/auris/envauris/lib/python3.13/site-packages/sympy/physics/units/quantities.pyr   Quantity.__new__   s     $''$<D>F$$F^F '  F3	$/+3&
    c                 *    U[         R                  U '   g r   )r   _quantity_dimension_global)self	dimensions     r!   set_global_dimensionQuantity.set_global_dimension3   s    ;D2248r#   c                     SSK Jn  [        U5      n[        U[        5      (       a  SU l        UR                  S S 5      n[        U5      nX4UR                  U '   X#R                  U '   g)z>
Setting a scale factor that is valid across all unit system.
r   
UnitSystemTc                 "    [        U [        5      $ r   )r   r   xs    r!   <lambda>;Quantity.set_global_relative_scale_factor.<locals>.<lambda>@   s    jF+r#   c                     U R                   $ r   )scale_factorr.   s    r!   r0   r1   A   s    annr#   N)	sympy.physics.unitsr,   r   r   r   r   replace_quantity_scale_factors_global,_quantity_dimensional_equivalence_map_global)r&   r3   reference_quantityr,   s       r!    set_global_relative_scale_factor)Quantity.set_global_relative_scale_factor6   si     	3|,lF++ $D#+++$
 |,;G:\
11$7HZ??Er#   c                     U R                   $ r   )r   r&   s    r!   r   Quantity.nameG   s    zzr#   c                 P    SSK Jn  UR                  5       nUR                  U 5      $ )Nr   r+   )r4   r,   get_default_unit_systemget_quantity_dimensionr&   r,   unit_systems      r!   r'   Quantity.dimensionK   s$    2 88:11$77r#   c                     U R                   $ )zg
Symbol representing the unit name.

Prepend the abbreviation with the prefix symbol if it is defines.
)r   r<   s    r!   r   Quantity.abbrevQ   s     ||r#   c                 P    SSK Jn  UR                  5       nUR                  U 5      $ )zG
Overall magnitude of the quantity as compared to the canonical units.
r   r+   )r4   r,   r?   get_quantity_scale_factorrA   s      r!   r3   Quantity.scale_factorZ   s&    
 	3 88:44T::r#   c                     gNT r<   s    r!   _eval_is_positiveQuantity._eval_is_positivec       r#   c                     grJ   rK   r<   s    r!   _eval_is_constantQuantity._eval_is_constantf   rN   r#   c                     U $ r   rK   r<   s    r!   	_eval_AbsQuantity._eval_Absi   s    r#   c                 >    [        U[        5      (       a  X:w  a  U $ g g r   )r   r	   )r&   oldnews      r!   
_eval_subsQuantity._eval_subsl   s     c8$$K *5$r#   c                     U R                   (       a  U R                   $ SR                  [        U R                  5      S:  a  U R                  S   5      $ U R                  S   5      $ )Nz\text{{{}}}      r   )r   formatlenargs)r&   printers     r!   _latexQuantity._latexp   s`    ###!(( ^q0 *.1 D D6:iilD Dr#   c                      SSK Jn  U" XU5      $ )aQ  
Convert the quantity to another quantity of same dimensions.

Examples
========

>>> from sympy.physics.units import speed_of_light, meter, second
>>> speed_of_light
speed_of_light
>>> speed_of_light.convert_to(meter/second)
299792458*meter/second

>>> from sympy.physics.units import liter
>>> liter.convert_to(meter**3)
meter**3/1000
r\   )
convert_to)utilrd   )r&   otherrB   rd   s       r!   rd   Quantity.convert_tow   s    " 	%${33r#   c                     [        5       $ )z"Return free symbols from quantity.)setr<   s    r!   free_symbolsQuantity.free_symbols   s     ur#   c                     U R                   $ )zWWhether or not the quantity is prefixed. Eg. `kilogram` is prefixed, but `gram` is not.r   r<   s    r!   r   Quantity.is_prefixed   s        r#   rm   )NNNNNF)SI)__name__
__module____qualname____firstlineno____doc__is_commutativeis_real	is_number
is_nonzerois_physical_constant	_diff_wrtr   r(   r9   propertyr   r'   r   r3   rL   rP   rS   rX   ra   rd   rj   r   __static_attributes__rK   r#   r!   r	   r	      s     NGIJ I"&59AE!6E["   8 8
   ; ;D4(   ! !r#   r	   c                       \ rS rSrSrSrSrg)PhysicalConstant   zLRepresents a physical constant, eg. `speed_of_light` or `avogadro_constant`.TrK   N)rp   rq   rr   rs   rt   ry   r|   rK   r#   r!   r~   r~      s    Vr#   r~   N)rt   sympy.core.exprr   sympy.core.symbolr   sympy.core.sympifyr   sympy.physics.units.dimensionsr   sympy.physics.units.prefixesr   r	   r~   rK   r#   r!   <module>r      s6    ' $ & : /G!z G!R x  r#   