Python Forum

Full Version: How to solve a function and get x, y and z?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
Have you tried sympy?
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.