I have two equations: a second degree polynomial and one with a modulo. There are two variables: $ x, y \in \mathbb{R}$; $ x, y \geq 0 $, and four constants, which have a known value: $a, b, c, d \in \mathbb{R}$. The two equations:
$$ y = ax^2 + bx + c $$ $$ d \equiv y \ ( \bmod 1 ) $$
I am looking for the lowest $y$, which solves these equations.
Note: The modulo operator used here is defined on real numbers. So $y \ ( \bmod 1 )$ means the fractional part of $y$.
What I tried so far:
I introduced a new variable $ z \in \mathbb{N} $, and changed the second equation to this:
$$ d + z = y $$
After that I tried to solve the second degree polynomial like this:
$$ 0 = ax^2 + bx + c-(d+z) $$ $$ x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4a(c-d-z)} }{2a} $$
I don't know, how to progress further, and get out the $z$ from the square root. My method does not seem to lead to anything.
You need $a \gt 0$ to make the parabola open upward. We can start by ignoring the constraint from $d$ and find the vertex of the parabola, which gives the minimum $y$ on it. Now round up to the next $y$ above the minimum that satisfies the $d$ constraint. Unless the vertex satisfies the $d$ constraint, there will be two values of $x$ that give the minimum $y$. Use the quadratic formula with the $y$ you found and you are done.
As an example, let $y=x^2+3, d=0.1$. The vertex of the parabola is at $y=3$. Rounding up gives $y=3.1$ and the two $x$ values are $\pm \sqrt {0.1}$
The above works if you don't have the requirement $x,y \ge 0$. If the vertex is to the right of the $y$ axis you will have at least one $x \ge 0$. If the vertex is additionally below the $x$ axis the minimum $y$ is $d$, so solve the quadratic formula to get $x$. If the vertex is to the left of the $y$ axis the parabola is monotonically increasing for $x \ge 0$. You have the point $(0,c)$ on the parabola. If $c \le 0$ the minimum $y$ allowed is $d$. If $c \ge 0$ round up from $c$ to the next value that satisfies the $d$ constraint.