Alex Naoki
Alex Naoki

Reputation: 11

Is there a way to return boolean from relational in Sympy?

Code example:

>>> import sympy.physics.units as u
>>> 10*u.cm > 20*u.mm
10*centimeter > 20*milimeter

However, I want to return a boolean.

Upvotes: 0

Views: 42

Answers (1)

Alex Naoki
Alex Naoki

Reputation: 11

I found an easier solution to just use a package called pint. This package was created especially for manipulation of physics units.

>>> from pint import UnitRegistry
>>> ureg = UnitRegistry()
>>> 10*ureg.cm > 10*ureg.mm
True

Upvotes: 1

Related Questions