K i?pdZddlmZddlmZddlmZddlmZddl m Z GddeZ Gd d e Z y ) z Physical quantities. ) AtomicExpr)Symbol)sympify)_QuantityMapper)PrefixceZdZdZdZdZdZdZdZdZ ddZ dZ dZ e dZe d Ze d Ze d Zd Zd ZdZdZdZddZe dZe dZy)QuantityzX Physical quantity: can be a unit of measure, a constant or a generic quantity. TFNc t|ts t|}||}nt|tr t|}||_t j |||} || _|| _|| _|| _ || _ || _ || _| SN) isinstancerstr _is_prefixedr__new___name_abbrev _latex_repr _unicode_repr _ascii_repr _mathml_repr) clsnameabbrev latex_reprpretty_unicode_reprpretty_ascii_reprmathml_presentation_repr is_prefixed assumptionsobjs d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/physics/units/quantities.pyrzQuantity.__new__s $'$F  $F^F'  dF3  $/+3& c*|tj|<yr )r_quantity_dimension_global)self dimensions r set_global_dimensionzQuantity.set_global_dimension3s;D2248r!cddlm}t|}t|trd|_|j dd}t|}||f|j|<||j|<y)zN Setting a scale factor that is valid across all unit system. r UnitSystemTc"t|tSr )r rxs r z;Quantity.set_global_relative_scale_factor..@s jF+r!c|jSr ) scale_factorr+s r r-z;Quantity.set_global_relative_scale_factor..As annr!N) sympy.physics.unitsr)rr rrreplace_quantity_scale_factors_global,_quantity_dimensional_equivalence_map_global)r$r/reference_quantityr)s r set_global_relative_scale_factorz)Quantity.set_global_relative_scale_factor6sk 3|, lF + $D #++ + $ |, ;GI[:\ 11$7HZ ??Er!c|jSr )rr$s r rz Quantity.nameGs zzr!cPddlm}|j}|j|S)Nrr()r0r)get_default_unit_systemget_quantity_dimensionr$r) unit_systems r r%zQuantity.dimensionKs$2 88: 11$77r!c|jS)z Symbol representing the unit name. Prepend the abbreviation with the prefix symbol if it is defines. )rr7s r rzQuantity.abbrevQs||r!cPddlm}|j}|j|S)zW Overall magnitude of the quantity as compared to the canonical units. rr()r0r)r9get_quantity_scale_factorr;s r r/zQuantity.scale_factorZs& 3 88: 44T::r!cyNTr7s r _eval_is_positivezQuantity._eval_is_positivecr!cyrArBr7s r _eval_is_constantzQuantity._eval_is_constantfrDr!c|Sr rBr7s r _eval_AbszQuantity._eval_Absis r!c4t|tr||k7r|Syyr )r r )r$oldnews r _eval_subszQuantity._eval_subsls c8 $K*5 $r!c|jr |jSdjt|jdk\r|jdS|jdS)Nz \text{{{}}}r)rformatlenargs)r$printers r _latexzQuantity._latexps`   ## #!(( ^q0*.1D D6:iilD Dr!c"ddlm}||||S)a 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 rO) convert_to)utilrV)r$otherr<rVs r rVzQuantity.convert_tows" %${33r!ctS)z"Return free symbols from quantity.)setr7s r free_symbolszQuantity.free_symbolss u r!c|jS)zWWhether or not the quantity is prefixed. Eg. `kilogram` is prefixed, but `gram` is not.)rr7s r rzQuantity.is_prefixeds   r!)NNNNNF)SI)__name__ __module__ __qualname____doc__is_commutativeis_real is_number is_nonzerois_physical_constant _diff_wrtrr&r5propertyrr%rr/rCrFrHrLrTrVr[rrBr!r r r sNGIJ I"&59AE!6E["88 ;;D4(!!r!r ceZdZdZdZy)PhysicalConstantzLRepresents a physical constant, eg. `speed_of_light` or `avogadro_constant`.TN)r^r_r`rarfrBr!r rjrjs Vr!rjN) rasympy.core.exprrsympy.core.symbolrsympy.core.sympifyrsympy.physics.units.dimensionsrsympy.physics.units.prefixesrr rjrBr!r rps6'$&:/G!zG!R x r!