Python Forum
How to solve a function and get x, y and z?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to solve a function and get x, y and z?
#1
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?
Reply
#2
Have you tried sympy?
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how can I solve fsolve function error? troddydeeneeeeeey 3 2,423 Oct-14-2021, 07:07 PM
Last Post: deanhystad
  Conjugate Gradient having issues with defining A (function to solve [A]{x} = {b} ) DimosG 2 2,815 Sep-21-2021, 08:32 PM
Last Post: 1968Edwards

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020