4 | | sage: _ =var('A,B,C,D') |

5 | | sage: S = matrix([[1+3*A,3*B],[3*C,1+3*D]]) |

6 | | sage: R = Zmod(9) |

7 | | sage: g = matrix(R,2,[[2,1],[2,6]]) |

8 | | sage: gi = matrix(R,2,[[6,8],[7,2]]) |

9 | | sage: g*S*gi |

10 | | [ 6*B + 3*D + 1 3*A + 3*B + 6*C + 6*D] |

11 | | [ 0*A + 0*D 3*A + 0*D + 1] |

| 4 | sage: _ = var('A,B,C,D') |

| 5 | sage: (B + 3*D)*Zmod(9)(6) |

| 6 | 0*D |

13 | | |

14 | | ~~While we have (look at the second line):~~ |

15 | | |

16 | | ~~{{{~~ |

17 | | ~~sage: P.<A,B,C,D> = ZZ[]~~ |

18 | | ~~sage: S = matrix([[1+3*A,3*B],[3*C,1+3*D]])~~ |

19 | | ~~sage: R = Zmod(9)~~ |

20 | | ~~sage: g = matrix(R,2,[[2,1],[2,6]])~~ |

21 | | ~~sage: gi = matrix(R,2,[[6,8],[7,2]])~~ |

22 | | ~~sage: g*S*gi~~ |

23 | | ~~[ 6*B + 3*D + 1 3*A + 3*B + 6*C + 6*D]~~ |

24 | | ~~[ 6*B 3*A + 3*B + 1]~~ |

25 | | ~~}}}~~ |