# Singular

#### D.15.1.1 chinrempoly

Procedure from library `algemodstd.lib` (see algemodstd_lib).

Usage:
chinrempoly(l, m); l list, m list

Return:
a polynomial (resp. ideal) which is congruent to l[i] modulo m[i] for all i

Note:
The procedure applies chinese remaindering to the first argument w.r.t. the moduli given in the second. The elements in the first list must be of same type which can be polynomial or ideal. The moduli must be of type polynomial. Elements in the second list must be distinct and co-prime.

Example:
 ```LIB "algemodstd.lib"; ring rr=97,x,dp; poly f=x^7-7*x + 3; ideal J=factorize(f,1); J; ==> J[1]=x+37 ==> J[2]=x3+9x2+20x-20 ==> J[3]=x3-46x2+17x-8 list m=J[1..ncols(J)]; list l= x^2+2*x+3, x^2+5, x^2+7; ideal I=chinrempoly(l,m); I; ==> I[1]=-44x6-36x5-45x4+12x3-36x2+25x-32 ring s=0,x,dp; list m= x^2+2*x+3, x^3+5, x^4+x^3+7; list l=x^3 + 2, x^4 + 7, x^5 + 11; ideal I=chinrempoly(l,m); I; ==> I[1]=18113/107610x8+5826/17935x7-5257/107610x6+3975/7174x5+246151/107610x\ 4+131573/53805x3-910/633x2-36239/21522x+146695/7174 int p=prime(536546513); ring r = p, (x,y,a), (dp(2),dp(1)); poly minpolynomial = a^2+1; ideal kf=factorize(minpolynomial,1);//return factors without multiplicity kf; ==> kf[1]=a+222052315 ==> kf[2]=a-222052315 ideal k=(a+1)*x2+y, 3x-ay+ a+2; option(redSB); ideal k1=k,kf[1]; ideal k2 =k,kf[2]; k1=std(k1); k2=std(k2); list l=k1,k2; list m=kf[1..ncols(kf)]; ideal I=chinrempoly(l,m); I=simplify(I,2); I; ==> I[1]=x-178848838ya+178848838a-178848837 ==> I[2]=y2-268273248ya+268273250y-4a-3 ```