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

Function recon

ar.py:132–147  ·  view source on GitHub ↗

Reconcile one variable in the expression e=0, given const.

(e: dict[str, float], const: str)

Source from the content-addressed store, hash-verified

130
131
132def recon(e: dict[str, float], const: str) -> tuple[str, dict[str, float]]:
133 """Reconcile one variable in the expression e=0, given const."""
134 e = strip(e)
135 if len(e) == 0: # pylint: disable=g-explicit-length-test
136 return None
137
138 v0 = None
139 for v in e:
140 if v != const:
141 v0 = v
142 break
143 if v0 is None:
144 return v0
145
146 c0 = e.pop(v0)
147 return v0, {v: -c / c0 for v, c in e.items()}
148
149
150def replace(

Callers 1

add_exprMethod · 0.85

Calls 1

stripFunction · 0.85

Tested by

no test coverage detected