MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / solve_quad

Function solve_quad

numericals.py:470–478  ·  view source on GitHub ↗

Solve a x^2 + bx + c = 0.

(a: float, b: float, c: float)

Source from the content-addressed store, hash-verified

468
469
470def solve_quad(a: float, b: float, c: float) -> tuple[float, float]:
471 """Solve a x^2 + bx + c = 0."""
472 a = 2 * a
473 d = b * b - 2 * a * c
474 if d < 0:
475 return None # the caller should expect this result.
476
477 y = math.sqrt(d)
478 return (-b - y) / a, (-b + y) / a
479
480
481def circle_circle_intersection(c1: Circle, c2: Circle) -> tuple[Point, Point]:

Callers 1

line_circle_intersectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected