fork download
  1.  
  2. def solve_hyperb(xs,ys):
  3. x1,x2,x3 = xs
  4. y1,y2,y3 = ys
  5. a = x1 - x3
  6. b = x1 - x2
  7. c = x1 * y1 - x2 * y2
  8. d = x1 * y1 - x3 * y3
  9. e = y1 - y2
  10. f = y1 - y3
  11. x0 = (a * c - b * d) / ( a * e - b * f )
  12. y0 = (c - x0 * e) / b
  13. a = (y1 - y0) * (x1 - x0)
  14. return (a,x0,y0)
  15.  
  16. xs = [4,5,6]
  17. ys = [2.6667,2.2500,2.0000]
  18.  
  19. print(solve_hyperb(xs,ys))
Success #stdin #stdout 0.04s 9260KB
stdin
Standard input is empty
stdout
(4.99865035991002, 1.0005998800239964, 1.000149970005999)