# Solving equations with dozens of ceil and floor functions efficiently?

I am tackling a problem which uses lots of equations in the form of: where $q_i(x)$ is the only unknown, $c_i$, $C_j$, $P_j$ are always positive. $C_j < P_j$ for all $j$

1.How is this type of problems efficently solved especially when the number of iterations $N$ is between 20 - 100?

What I was doing is $q_i(x) - c_i(x)$ must be equal to the summation of integers. So i was doing an exhaustive search for $q_i(x)$ which satisfies both ends of the equation. Clearly this is computationally exhaustive even if I do the search on a parallel computer..

2.What if $c_i(x)$ is a floating point number, this will even make the problem even more difficult to find a real $q_i(x)$?

Thanks

## 1 Answer

This can be done numerically, making use of Maple. For example, the Maple code $$restart; Digits := 25: f := x-> Student[Calculus1]:-Roots(q[i]-3*x-add(floor(q[i]/(j+1))*j, j = 1 .. 25)): f(.12);$$ outputs $[ 0.36, 3.36]$. The plot $$plot(q[i]-3*.12-add(floor(q[i]/(j+1))*j, j = 1 .. 25), q[i] = 0 .. 5, discont = true)$$ confirms that. See Roots for info.

• Thanks. But Matlab roots does not work with floor and ceil functions. – The Byzantine Aug 1 '14 at 2:01
• @ The Byzantine : The roots command of MATLAB finds the roots of a polynomial only. It seems you try to use it in a wrong way. – user64494 Aug 1 '14 at 5:03
• I did not even attempt to use it because i know that fact. That what I meant when i said it wont work with floor and ceiling. – The Byzantine Aug 1 '14 at 15:46