Dear Group,
On the face of it, attaching appropriate physical units to variables
sounds an excellent idea, but if, say, you import speed_of_light from
sympy.physics.units, you have to extract an expression containing the
speed and the physical units:
sl=speed_of_light.convert_to(meter/second)
This is OK, but in more complicated cases - e.g. the
gravitational_constant - it would be nice to be able to extract the
value with appropriate units without actually knowing the units in
advance - just as if you looked it up in a handbook you would find
something equivalent to
6.6743e-11*meter^2*newton/kilogram^2
Also, if you just write an expression with speed_of_light, the result is
confusing, because naively I thought speed_of_light would consist of an
expression - 299792458*meter/second - but you can't use an expression of
that sort at all (as far as I could see).
Indeed it isn't clear why the class
sympy.physics.units.quantities.Quantity exists.
Am I correct that each of these named quantities have to be imported and
subject to convert_to before they are any use in actual calculations?
That didn't seem obvious from the documentation.
I would have thought that introducing the units notation would mean that
meaningless expressions would be faulted - checking the consistency of
is a really useful operation.
sl+3*meter
3*meter + 299792458*meter/second
exp(-sl)
exp(-299792458*meter/second)
Neither of these fault, but I am wondering if there is a function to
check potentially quite complicated expressions for consistency
regarding units?
Looking forward to reading your replies,
David
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/0e61292d-f180-c225-c0ff-d21a73b23473%40dbailey.co.uk.