1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
5 (defmfun $desolve
(eqns vars
)
6 (let (teqns tvars ovar
(lvar ($gensym
)) (flag nil
) ($dispflag nil
))
8 (merror (intl:gettext
"desolve(<eqn>,<depvar>): dependent variable <depvar> cannot be a mapatom, found: ~M") vars
))
10 (setq eqns
(list '(mlist) eqns
))
11 (setq vars
(list '(mlist) vars
))
13 (setq ovar
(maref vars
1))
14 (unless (= ($length ovar
) 1)
15 (merror (intl:gettext
"desolve: more than one independent variable: ~M") ovar
))
16 (setq ovar
(simplify ($inpart ovar
1)))
18 (simplify (map1 (lambda (z) (simplify ($laplace z ovar lvar
))) eqns
)))
20 (simplify (map1 (lambda (z) (simplify `((%laplace
) ,z
,ovar
,lvar
))) vars
)))
22 (let ((errcatch (cons bindlist loclist
))
23 (ret (errset (simplify ($solve teqns tvars
)))))
27 (when (or (like teqns
'((mlist)))
28 (like teqns
(list '(mlist) '((mlist)))))
29 ;; NOT CLEAR WHAT IS THE PROBLEM. SHOULD BE MORE EXPLICIT.
30 (merror (intl:gettext
"desolve: can't handle this case.")))
31 (setq teqns
(simplify ($first teqns
)))
33 (setq teqns
(simplify ($first teqns
))))
35 (simplify (map1 (lambda (z) (simplify ($ilt z lvar ovar
))) teqns
)))
36 (if (and flag
(= ($length tvars
) 1))