next up previous contents index
suivant: Cyclotomic polynomial : cyclotomic monter: Arithmetic and polynomials précédent: Solving au+bv=c over polynomials:   Table des matières   Index

Chinese remainders : chinrem

chinrem takes two lists as argument, each list being made of 2 polynomials (either expressions or as a list of coefficients in decreassing order). If the polynomials are expressions, an optionnal third argument may be provided to specify the main variable, by default x is used. chinrem([A,R],[B,Q]) returns the list of two polynomials P and S such that :

S = R.Q,    P = A(mod R), P = B(mod Q)

If R and Q are coprime, a solution P always exists and all the solutions are congruent modulo S=R*Q. For example, assume we want to solve :

$\displaystyle \tt\left\{ \begin{array}{rlr} P(x)=&x\ &\bmod\ (x^2+1)\\
P(x)=&x-1\ &\bmod\ (x^2-1) \end{array}\right.$

Input :
Output :
or :
Output :
hence P(x) = - $\displaystyle {\frac{{x^2-2.x+1}}{{2}}}$ ( mod x4 - 1)
Another example, input :
Output :
or :
Output :

giac documentation written by Renée De Graeve and Bernard Parisse