This function is written to solve Diophantine equation. this equation should be in the form of C = A*E + F ;where C and A are the polynomials according to your variable (for example s in laplace domain or z in z-transform domain) and n is the order E plus one (order{E} = n-1).
please contact me for any question or suggestion.