Use code in this down to “------”. Use routines matpak and trnxx.

(define (Ffield T q) (let* ((f ((T 'gfip) q))(fops ((T 'fops) f))(i->p (T 'i->p)) (f* (car fops))(f/ (cadr fops)) (zer (i->p 0)) (p+ (T 'p+)) (p- (T 'p-))) (matpak zer (lambda(x) (veq x zer)) (i->p 1) p+ (lambda (a b) (p+ a (p- b))) f* f/)))Now

(define (rm T q n) (let ((i->p (T 'i->p))(sz (expt (T 'ch) q))) (DoL n (lambda (d) (DoL n (lambda (d) (i->p (inexact->exact (floor (* (random) sz))))))))))We use

(define (mtt p q n) (let* ((T (gpa p))(m (rm T q n))(mt (Ffield T q)) (minv (cadr mt))(mmul (car mt))(ic (mmul m (minv m cc)))) (list (tmz ic) m ic)))

In the code above we use `cc` below which depends on the definitions of `exit` and `mer`.

(define cc (mer "Singular:"))