Modulus differentiation For a Java project, I need to find a way to compute the derivate of a modulus function like
$$f(x) = g(x) \pmod{h(x)}$$
for any value of $x$.
I know that the modulus function is discontinuous.
If there is no way to compute that, do you have any suggestion to obtain a coherent result?
 A: You can write $f$ as :
$$f(x) = g(x)-\left\lfloor\frac{g(x)}{h(x)}\right\rfloor h(x)  = g(x)-k(x) h(x) $$
With $k(x)=\left\lfloor\frac{g(x)}{h(x)}\right\rfloor$ being a piece-wise constant function. Thus your derivative will only exist on the intervals where $k$ is constant (and where $k'=0$) :
$$f'(x) = g'(x)-\left\lfloor\frac{g(x)}{h(x)}\right\rfloor h'(x)  = g'(x)-k(x) h'(x) $$
On the points of discontinuity of $k$ (ie between the intervals), the derivative cannot be defined, which is normal since the function is discontinuous.
EDIT :
Apparently you want to apply modulo in the polynomial ring, but then your problem is not clearly explained then. Are your polynomial with constant coefficient ? If yes, then you have :
$$f(X) = g(X)-q(X) h(X)$$
Where $q$ is the quotient of $g$ by $h$, and $f$ is the remainder. By using Euclid algorithm, you can compute the remainder $f$, then derive it like usual. More info here on polynomial division : http://en.wikipedia.org/wiki/Polynomial_long_division
If however you have non constant polynomial, things get more tricky, if the coefficient are all continuous function, I suspect you will have "piece wise defined" quotient and remainder, but I'm not sure it will be easy to compute where and how their value changes.
