It only requires one small change to work. The reason you get False is because you use == 0 in the definition of your function. Sympy usually assumes your functions are evaluated to 0 . To give an example from here :
If you want to solve the equations x+5y=2, -3x+6y=15 , you must do this as follows:
from sympy import * x, y = symbols('x y') solve([x + 5*y - 2, -3*x + 6*y - 15], [x, y])
which gives you
{x: -3, y: 1}
Note that equations are passed so that they are evaluated as 0 .
If you run it like you did
solve([x + 5*y - 2 == 0, -3*x + 6*y - 15 == 0], [x, y])
then returns False .
So, for your example, the following will work:
from sympy import * x, y, xa, xb, xc, ya, yb, yc, D12, D13 = symbols('xy xa xb xc ya yb yc D12 D13') eqs = [sqrt((xa - x) ** (2) + (ya - y) ** (2)) - sqrt((xb - x) ** (2) + (yb - y) ** (2)) - D12, sqrt((xa - x) ** (2) + (ya - y) ** (2)) - sqrt((xc - x) ** (2) + (yc - y) ** (2)) - D13] solve(eqs, [x, y])
Unfortunately, this does not work on my personal computer (my Python gets killed , apparently this is hard to solve), so I just tested it on a simpler version to demonstrate the principle:
eqs2 = [sqrt(xa - x) - D12, (yc - y) ** (2) - D13] solve(eqs2, [x, y])
which then gives the expected result:
[(-D12**2 + xa, -sqrt(D13) + yc), (-D12**2 + xa, sqrt(D13) + yc)]
We hope you can solve these complex functions on your machine. But this post explains why you get False .
EDIT
With the modified code, you can get a solution if you reduce the accuracy of your parameters D12 and D13 . Here is the solution you get:
[sqrt((-x + 3)**2 + (-y + 1)**2) - sqrt((-x + 4)**2 + (-y + 6)**2) - 0.3, sqrt((-x + 3)**2 + (-y + 1)**2) - sqrt((-x + 10)**2 + (-y + 4)**2) - 0.42] [{x: 6.45543078993649, y: 3.14390310591109}, {x: 6.67962865117349, y: 2.61399193301427}]
Are they the same as for Matlab modeling?
Here is the modified code; note that I force the output to be in the form of a dictionary, and also print the equations (I round to two decimal places, but also works with 4, you can play with this):
from sympy import * def alg(xa=None, ya=None, za=None, Ta=None, xb=None, yb=None, zb=None, Tb=None, xc=None, yc=None, zc=None, Tc=None, xd=None, yd=None, zd=None, Td=None, RSSIA=None, RSSIB=None, RSSIC=None, RSSID=None, txPower=None, n=None): n = 2 c = 3 * 10 ** 8 TOA12 = Ta - Tb TOA13 = Ta - Tc TOA14 = Ta - Td D12 = round(TOA12 * c, 2) D13 = round(TOA13 * c, 2)