3 (defun $lexicographique?
($a $b
)
4 (2lexinv_type1 (cddr $a
) (cddr $b
)))
6 (defun $longueur?
($a $b
)
7 (longueur?
(cddr $a
) (cddr $b
)))
9 (defun longueur?
(tt1 t2
)
10 (let ((l1 (longueur tt1
)) (l2 (longueur t2
))) ; longueur est dans util.lsp
15 ; on a un polynome ordonne' mais dont les monomes sont eventuellement
16 ; egaux. Il s'agit d'additionner les coefficients concerne's.
17 ; le polynome est sous sa representation distribue'e en macsyma :
18 ; ((mlist simp) ((mlist simp) coe e1 e2 ... en) ....)
20 (defun $simplifie_dist
($polynome
)
21 (simplifie_dist (cadr $polynome
) (cdr $polynome
))
24 (defun simplifie_dist (polynome $monome
)
25 (if (null (cddr polynome
)) nil
26 (let (($mon2
(cadr polynome
)))
27 (if (not (equal (cddr $mon2
) (cddr $monome
)))
28 (simplifie_dist (cdr polynome
) $mon2
)
29 (progn (rplaca (cdr $monome
)
30 (+ (cadr $monome
) (cadr $mon2
)))
31 (rplacd polynome
(cddr polynome
))
32 (simplifie_dist polynome $monome
))))))
34 (defun $insert
($monome $polynome
)
35 (insert $monome $polynome
)
38 (defun insert ($monome polynome
)
39 (if (null (cdr polynome
)) (rplacd polynome
(list $monome
))
40 (let (($mon2
(cadr polynome
)))
41 (cond ((equal (cddr $mon2
) (cddr $monome
))
42 (let ((coe (+ (cadr $monome
) (cadr $mon2
))))
44 (rplacd polynome
(cddr polynome
))
45 (rplaca (cdr $mon2
) coe
))))
46 (($longueur? $monome $mon2
)
47 (insert $monome
(cdr polynome
)))
49 (cons $monome
(cdr polynome
))))))))