0

I have the xy-coordinates of two shots. In addition, I have the distance, d, of each shot to the hole. The goal is to find out the xy-coordinate of the hole (xh, yh).

# known
x1 = 11518.096
y1 = 12693.551
d1 = 3693
x2 = 11227.928
y2 = 12537.854
d2 = 342

Consequently, we have the following equations:

enter image description here

We then arrange them into the following form:

enter image description here

I want to write the above in Python

import numpy as np
from scipy.optimize import newton

# the function whose zero is wanted
def f(x: float, y: float, d: float) -> float:
   return (x - xh) ** 2 + (y - yh) ** 2 - d ** 2 

guess = newton(f, np.array([x1, y1]), args=(x1, y1, d1))

According to this answer I need to args to provide the constant parameters. In addition, I am using x1/y1 or x2/y2 as initial guesses

What's the next step to use both shots? How should newton be called?

# unknown
xh = 11255.902
yh = 12532.519
HJA24
  • 410
  • 2
  • 11
  • 33
  • 2
    Maybe this will answer your question: [link](https://stackoverflow.com/questions/55816902/finding-the-intersection-of-two-circles) – imburningbabe Oct 03 '22 at 12:07

0 Answers0