Let's make some matrices.

We can easily compute a kernel, image or `cokernel`.

Every module is represented internally as a submodule of a quotient module. Such modules often appear in computations, for example, when taking the direct sum of a quotient module and a submodule.

We may use subquotient to make such modules directly, although it's usually more convenient to use other operations. The first argument is the matrix whose columns are the generators, and the second argument is the matrix whose columns are the relations.

i1 : R = ZZ/101[a..c]; |

i2 : f = vars R o2 = | a b c | 1 3 o2 : Matrix R <--- R |

i3 : ker f o3 = image {1} | -b 0 -c | {1} | a -c 0 | {1} | 0 b a | 3 o3 : R-module, submodule of R |

i4 : coker f o4 = cokernel | a b c | 1 o4 : R-module, quotient of R |

i5 : image f o5 = image | a b c | 1 o5 : R-module, submodule of R |

i6 : image f ++ coker f o6 = subquotient (| a b c 0 |, | 0 0 0 |) | 0 0 0 1 | | a b c | 2 o6 : R-module, subquotient of R |

i7 : M = subquotient(f, matrix {{a}}) o7 = subquotient (| a b c |, | a |) 1 o7 : R-module, subquotient of R |

i8 : prune M o8 = cokernel {1} | a -c 0 | {1} | 0 b a | 2 o8 : R-module, quotient of R |