Real roots of a polynomial (highest degree first), as decimal strings. Used to bake an independent reference root set for `solve` cases — the `solve` oracle checks a tool's returned (real) roots against this set.
(coeffs)
| 35 | |
| 36 | |
| 37 | def real_roots(coeffs): |
| 38 | """Real roots of a polynomial (highest degree first), as decimal strings. |
| 39 | |
| 40 | Used to bake an independent reference root set for `solve` cases — the |
| 41 | `solve` oracle checks a tool's returned (real) roots against this set.""" |
| 42 | roots = polyroots([mpf(c) for c in coeffs], maxsteps=500, extraprec=200) |
| 43 | reals = sorted(r.real for r in roots if abs(r.imag) < mpf(10) ** (-40)) |
| 44 | return [dec(r, 40) for r in reals] |
| 45 | |
| 46 | DEF_POINTS = [mpf("0.37"), mpf("1.93"), mpf("2.71")] # > 0, off singularities |
| 47 | UNIT_POINTS = [mpf("0.13"), mpf("0.41"), mpf("0.67")] # inside (-1, 1) |
no test coverage detected