# Singular

#### D.4.7.10 homology

Procedure from library `homolog.lib` (see homolog_lib).

Usage:
homology(A,B,M,N);

Compute:
Let M and N be submodules of R^m and R^n presenting M'=R^m/M, N'=R^n/N (R=basering) and let A,B matrices inducing maps
 ``` R^k --A--> R^m --B--> R^n. ```
Compute a presentation of the module
 ``` ker(B)/im(A) := ker(M'/im(A) --B--> N'/im(BM)+im(BA)). ```
If B induces a map M'-->N' (i.e BM=0) and if im(A) is contained in ker(B) (that is, BA=0) then ker(B)/im(A) is the homology of the complex
 ``` R^k--A-->M'--B-->N'. ```

Return:
module H, a presentation of ker(B)/im(A).

Note:
homology returns a free module of rank m if ker(B)=im(A).

Example:
 ```LIB "homolog.lib"; ring r; ideal id=maxideal(4); qring qr=std(id); module N=maxideal(3)*freemodule(2); module M=maxideal(2)*freemodule(2); module B=[2x,0],[x,y],[z2,y]; module A=M; module H=homology(A,B,M,N); H=std(H); // dimension of homology: dim(H); ==> 0 // vector space dimension: vdim(H); ==> 19 ring s=0,x,ds; qring qs=std(x4); module A=[x]; module B=A; module M=[x3]; module N=M; homology(A,B,M,N); ==> _[1]=gen(1) ```