Comment #2 on issue 3617 by [email protected]: Impossible to work with
floating point numbers in the geometry module
http://code.google.com/p/sympy/issues/detail?id=3617
The issue is that Point calls nsimplify on its coordinates by default.
This can be undone by calling Point(evaluate=False), but this is not
enough, because points are created internally as well, and evaluate
defaults to True. The following patch to the geometry module will make
this "work":
diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py
index 899e344..d1fdc01 100644
--- a/sympy/geometry/point.py
+++ b/sympy/geometry/point.py
@@ -85,7 +85,7 @@ def __new__(cls, *args, **kwargs):
if len(coords) != 2:
raise NotImplementedError(
"Only two dimensional points currently supported")
- if kwargs.get('evaluate', True):
+ if kwargs.get('evaluate', False):
coords = [nsimplify(c) for c in coords]
return GeometryEntity.__new__(cls, *coords)
Try applying it and see if that makes your code go a little faster. With
it, we get
In [5]: e2 = Ellipse(Point(3.1, 1.1), hradius=3.1, eccentricity=0.8)
In [6]: r = Ray(Point(-2.1, 3.1), Point(3.1, 1.1))
In [7]: e2.intersection(r)
Out[7]: [Point(0.490174669211991, 2.10377897338), Point(5.70982533078801,
0.0962210266199968)]
In [8]: r = Ray(Point(-2, 3), Point(3, 1))
In [9]: e2 = Ellipse(Point(3, 1), hradius=3, eccentricity=Rational(4, 5))
In [10]: e2.intersection(r)
Out[10]: [Point(-9*sqrt(13)/13 + 3, 18*sqrt(13)/65 + 1),
Point(9*sqrt(13)/13 + 3, -18*sqrt(13)/65 + 1)]
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.