How to solve a function and get x, y and z? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to solve a function and get x, y and z? (/thread-16956.html) |
How to solve a function and get x, y and z? - TheZenMan - Mar-21-2019 Hi, I'm fairly new to python and was wondering how to solve this. So I have the following: sigma_x=2 sigma_y=2 sigma_z=2 curr_location_x1=3 curr_location_y1=3 curr_location_z1=3 curr_location_x2=4 curr_location_y2=4 curr_location_z2=4 curr_location_x3=5 curr_location_y3=5 curr_location_z3=5 f_1=0.3 f_2=0.25 f_3=0.2 f = math.exp(-((((curr_location_x - x_my) * (curr_location_x - x_my)) / (2*sigma_x * sigma_x)) + (((curr_location_y - y_my) *(curr_location_y - y_my)) / (2 * sigma_y * sigma_y)) + (((curr_location_z - z_my) *(curr_location_z - z_my)) / (2 * sigma_z * sigma_z))))What I want to do is subsitute f for f_1, f_2 and f_3 to get x_my, y_my and z_my. Since there are three unknowns and three equations this should be solvable. I tried using scipy but had no luck since the equations have to equal 0 and didn't find the way that I could apply my problem on it. Does anyone know how to solve this? RE: How to solve a function and get x, y and z? - micseydel - Mar-22-2019 Have you tried sympy? RE: How to solve a function and get x, y and z? - scidam - Mar-22-2019 Applying natural logarithm to these equations, you will get three equations, where each equation represents an ellipsoid. So, you will need to find intersection of three ellipsoids in R^3; that, probably, could be solved analytically. |