Improve the translation of notequal
[maxima.git] / src / desoln.lisp
blobd2a1e0d02dd791e505ac7840c7ae65f611d20eac
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 (declare (special $dispflag))
8 (if ($mapatom vars)
9 (merror (intl:gettext "desolve(<eqn>,<depvar>): dependant variable <depvar> cannot be a mapatom, found: ~M") vars))
10 (unless ($listp vars)
11 (setq eqns (list '(mlist) eqns))
12 (setq vars (list '(mlist) vars))
13 (setq flag t))
14 (setq ovar (maref vars 1))
15 (unless (= ($length ovar) 1)
16 (merror (intl:gettext "desolve: more than one independent variable: ~M") ovar))
17 (setq ovar (simplify ($inpart ovar 1)))
18 (setq teqns
19 (simplify (map1 (lambda (z) (simplify ($laplace z ovar lvar))) eqns)))
20 (setq tvars
21 (simplify (map1 (lambda (z) (simplify `((%laplace) ,z ,ovar ,lvar))) vars)))
22 (setq teqns
23 (let ((errcatch (cons bindlist loclist))
24 (ret (errset (simplify ($solve teqns tvars)))))
25 (when (null ret)
26 (errlfun1 errcatch))
27 (cons '(mlist) ret)))
28 (when (or (like teqns '((mlist)))
29 (like teqns (list '(mlist) '((mlist)))))
30 ;; NOT CLEAR WHAT IS THE PROBLEM. SHOULD BE MORE EXPLICIT.
31 (merror (intl:gettext "desolve: can't handle this case.")))
32 (setq teqns (simplify ($first teqns)))
33 (unless (like flag t)
34 (setq teqns (simplify ($first teqns))))
35 (setq teqns
36 (simplify (map1 (lambda (z) (simplify ($ilt z lvar ovar))) teqns)))
37 (if (and flag (= ($length tvars) 1))
38 (maref teqns 1)
39 teqns)))