Issue
Is there a way to get a solution to three spheres intersection (trilateration) with SymPy? sympy.geometry
doesn't have a sphere object, so a direct approach is not feasible. Can SymPy solve a system of non-linear equations as shown at Trilateration and the Intersection of Three Spheres?
Solution
Yes. There are different ways but e.g.:
In [21]: x, y, z = symbols('x, y, z', real=True)
In [22]: eq1 = (x-1)**2 + (y-2)**2 + (z-3)**2 - 1
In [23]: eq2 = (x-1)**2 + (y-S(5)/2)**2 + (z-3)**2 - 1
In [24]: eq3 = (x-S.Half)**2 + (y-S(5)/2)**2 + (z-3)**2 - 1
In [25]: solve([eq1, eq2, eq3], [x, y, z])
Out[25]:
⎡⎛ √14⎞ ⎛ √14 ⎞⎤
⎢⎜3/4, 9/4, 3 - ───⎟, ⎜3/4, 9/4, ─── + 3⎟⎥
⎣⎝ 4 ⎠ ⎝ 4 ⎠⎦
Answered By - Oscar Benjamin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.