Physical quantities¶
Physical quantities.
- 
class sympy.physics.units.quantities.Quantity(name, abbrev=None, dimension=None, scale_factor=None, latex_repr=None, pretty_unicode_repr=None, pretty_ascii_repr=None, mathml_presentation_repr=None, **assumptions)[source]¶
- Physical quantity: can be a unit of measure, a constant or a generic quantity. - 
property abbrev¶
- Symbol representing the unit name. - Prepend the abbreviation with the prefix symbol if it is defines. 
 - 
convert_to(other, unit_system='SI')[source]¶
- 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 
 - 
property free_symbols¶
- Return free symbols from quantity. 
 - 
property scale_factor¶
- Overall magnitude of the quantity as compared to the canonical units. 
 
- 
property 
Conversion between quantities¶
Several methods to simplify expressions involving unit objects.
- 
sympy.physics.units.util.convert_to(expr, target_units, unit_system='SI')[source]¶
- Convert - exprto the same expression with all of its units and quantities represented as factors of- target_units, whenever the dimension is compatible.- target_unitsmay be a single unit/quantity, or a collection of units/quantities.- Examples - >>> from sympy.physics.units import speed_of_light, meter, gram, second, day >>> from sympy.physics.units import mile, newton, kilogram, atomic_mass_constant >>> from sympy.physics.units import kilometer, centimeter >>> from sympy.physics.units import gravitational_constant, hbar >>> from sympy.physics.units import convert_to >>> convert_to(mile, kilometer) 25146*kilometer/15625 >>> convert_to(mile, kilometer).n() 1.609344*kilometer >>> convert_to(speed_of_light, meter/second) 299792458*meter/second >>> convert_to(day, second) 86400*second >>> 3*newton 3*newton >>> convert_to(3*newton, kilogram*meter/second**2) 3*kilogram*meter/second**2 >>> convert_to(atomic_mass_constant, gram) 1.660539060e-24*gram - Conversion to multiple units: - >>> convert_to(speed_of_light, [meter, second]) 299792458*meter/second >>> convert_to(3*newton, [centimeter, gram, second]) 300000*centimeter*gram/second**2 - Conversion to Planck units: - >>> from sympy.physics.units import gravitational_constant, hbar >>> convert_to(atomic_mass_constant, [gravitational_constant, speed_of_light, hbar]).n() 7.62963085040767e-20*gravitational_constant**(-0.5)*hbar**0.5*speed_of_light**0.5 
