Every odd degree polynomial has at least one real root. However this root does not have to be a rational number so your task is to output a sequence of rational numbers that approximates it.
Rules
Your input is an odd degree polynomial \$f\$ with integer coefficients in any reasonable format.
You must output a sequence of rational numbers \$(a_n)_{n=1}^{\infty}\$ such that \$f(\lim_{n\to\infty} a_n) =0\$ using the standard sequence rules.
Your solution may fail because of finite precision however it must work in theory, assuming your language has arbitrary precision rational numbers. If your language doesn't support algebraic numbers, you may not assume that it does. In particular you may not assume that a
find_roots
built-in returns an infinite precision algebraic number if it doesn't.This is code-golf so the shortest solution in bytes wins.
Test cases
input -> example output
x^3-2 -> 1, 1.2, 1.25, 1.259, ...
x+7 -> -7, -7, -7, ...
x^5-x+1 -> -1.1, -1.167, -1.167304, ...
2x^7-3x^5-x^4-2x+1 -> 3, 0.7, 0.453 ...
1.23 = 123/100
. What you can't do is output for examplesqrt(2)
or pi. \$\endgroup\$