Reputation: 304
If I use the units module in Sympy, I can't find how to see the values of units. Say I wanted to see what is the gravitional constant.
import sympy.physics.units as u
G = u.gravitational_constant
What should I do to get some value out? I know it's possible to call Sympy's module "convert to" But it assumes I already know what the constant is. For example to see the speed of light I can write:
u.convert_to(u.speed_of_light,u.meter/u.second)
>>> 299792458 m/s
But that assumes I know speed of light is a velocity.
Upvotes: 1
Views: 236
Reputation: 19115
Every Quantity has a dimension:
>>> from sympy.physics.units import *
>>> G.dimension
Dimension(length**3/(mass*time**2))
Knowing these, you can see the value for your dimensions of interest:
>>> G.convert_to(m**3/kg/s**2)
6.6743e-11*meter**3/(kilogram*second**2)
Upvotes: 2