I noticed that my Python 2.7 code is slow because SymPy uses exact rationals instead of floats as its numbers. My code basically computes intersections between lines, planes and similar geometric objects. I found this question in which it's explained that you can speed up geometric objects creation by passing in evaluate=False
, which forces SymPy to keep the floats. I've done this for the objects I'm intersecting, though the intersection result is returned using exact rationals (while I want floats, even if precision is lost). For example:
>>> import sympy as sp
>>> l = sp.Line((0,0),(1.1,1.1), evaluate=False)
>>> sp.Line((1.1,0),(0,1.1), evaluate=False).intersection(l)
[Point2D(11/20, 11/20)]
How can I disable the exact computation? An alternative library will also be considered.