# Singular

#### D.4.2.5 alg_kernel

Procedure from library `algebra.lib` (see algebra_lib).

Usage:
alg_kernel(phi,pr[,s,c]); phi map to basering, pr preimage ring, s string (name of kernel in pr), c integer.

Return:
a string, the kernel of phi as string.
If, moreover, a string s is given, the algorithm creates, in the preimage ring pr the kernel of phi with name s.
Three different algorithms are used depending on c = 1,2,3. If c is not given or c=0, a heuristically best method is chosen. (algorithm 1 uses the preimage command)

Note:
Since the kernel of phi lives in pr, it cannot be returned to the basering. If s is given, the user has access to it in pr via s. The basering may be a quotient ring.

Example:
 ```LIB "algebra.lib"; ring r = 0,(a,b,c),ds; ring s = 0,(x,y,z,u,v,w),dp; ideal I = x-w,u2w+1,yz-v; map phi = r,I; // a map from r to s: alg_kernel(phi,r); // a,b,c ---> x-w,u2w+1,yz-v ==> 0 ring S = 0,(a,b,c),ds; ring R = 0,(x,y,z),dp; qring Q = std(x-y); ideal i = x, y, x2-y3; map phi = S,i; // a map to a quotient ring alg_kernel(phi,S,"ker",3); // uses algorithm 3 ==> a-b,b^3-b^2+c setring S; // you have access to kernel in preimage ker; ==> ker[1]=a-b ==> ker[2]=c-b2+b3 ```