/usr/share/maxima/5.32.1/src/elim.lisp is in maxima-src 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
(in-package :maxima)
(defmfun $eliminate (eqns vars)
(let ((sv nil)
(l ($length eqns))
(flag nil)
($dispflag nil))
(declare (special $dispflag))
(unless (and ($listp eqns) ($listp vars))
(merror (intl:gettext "eliminate: arguments must both be lists.")))
(when (> ($length vars) l)
(merror (intl:gettext "eliminate: more variables than equations.")))
(when (= l 1)
(merror (intl:gettext "eliminate: can't eliminate from only one equation.")))
(when (= ($length vars) l)
(setq vars ($reverse vars))
(setq sv (maref vars 1))
(setq vars ($reverse (simplify ($rest vars))))
(setq flag t))
(setq eqns (simplify (map1 (getopr 'meqhk) eqns)))
(dolist (v (cdr vars))
(let ((teqns '((mlist))))
(do ((j 1 (1+ j)))
((or (> j l) (not ($freeof v (simplify ($first eqns))))))
(setq teqns ($cons (simplify ($first eqns)) teqns))
(setq eqns (simplify ($rest eqns))))
(cond ((like eqns '((mlist)))
(setq eqns teqns))
(t
(setq teqns ($append teqns (simplify ($rest eqns))))
(setq eqns (simplify ($first eqns)))
(decf l)
(let ((se '((mlist))))
(dotimes (j l) ;maxima starts indices with 1, therefore the 1+
(setq se ($cons (simplify ($resultant eqns (maref teqns (1+ j)) v)) se)))
(setq eqns se))))))
(if flag
(list '(mlist) ($rhs (simplify (mfuncall '$ev (simplify ($last (simplify ($solve (maref eqns 1) sv)))) '$eval))))
eqns)))
(add2lnc '$eliminate $props)
|