Rename *ll* and *ul* to ll and ul in strictly-in-interval
[maxima.git] / src / desoln.lisp
blob707843a2f999968a6711b6a2716916c1a1acb7e1
1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
3 (in-package :maxima)
5 (defmfun $desolve (eqns vars)
6 (let (teqns tvars ovar (lvar ($gensym)) (flag nil) ($dispflag nil))
7 (if ($mapatom vars)
8 (merror (intl:gettext "desolve(<eqn>,<depvar>): dependent variable <depvar> cannot be a mapatom, found: ~M") vars))
9 (unless ($listp vars)
10 (setq eqns (list '(mlist) eqns))
11 (setq vars (list '(mlist) vars))
12 (setq flag t))
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)))
17 (setq teqns
18 (simplify (map1 (lambda (z) (simplify ($laplace z ovar lvar))) eqns)))
19 (setq tvars
20 (simplify (map1 (lambda (z) (simplify `((%laplace) ,z ,ovar ,lvar))) vars)))
21 (setq teqns
22 (let ((errcatch (cons bindlist loclist))
23 (ret (errset (simplify ($solve teqns tvars)))))
24 (when (null ret)
25 (errlfun1 errcatch))
26 (cons '(mlist) ret)))
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)))
32 (unless (like flag t)
33 (setq teqns (simplify ($first teqns))))
34 (setq teqns
35 (simplify (map1 (lambda (z) (simplify ($ilt z lvar ovar))) teqns)))
36 (if (and flag (= ($length tvars) 1))
37 (maref teqns 1)
38 teqns)))