Mercurial > emacs
comparison lisp/calc/calcalg2.el @ 90044:cb7f41387eb3
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-70
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-669
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 12 Nov 2004 02:53:04 +0000 |
parents | 68c22ea6027c 771eb065ad11 |
children | b637c617432f |
comparison
equal
deleted
inserted
replaced
90043:e24e2e78deda | 90044:cb7f41387eb3 |
---|---|
736 (setcar expr (nth 1 (nth 2 (car expr)))) | 736 (setcar expr (nth 1 (nth 2 (car expr)))) |
737 (math-replace-integral-parts (cons 'foo expr))) | 737 (math-replace-integral-parts (cons 'foo expr))) |
738 (setcar (cdr cur-record) 'cancelled))) | 738 (setcar (cdr cur-record) 'cancelled))) |
739 (math-replace-integral-parts (car expr))))))) | 739 (math-replace-integral-parts (car expr))))))) |
740 | 740 |
741 (defvar math-linear-subst-tried t | |
742 "Non-nil means that a linear substitution has been tried.") | |
743 | |
741 (defun math-do-integral (expr) | 744 (defun math-do-integral (expr) |
742 (let (t1 t2) | 745 (let ((math-linear-subst-tried nil) |
746 t1 t2) | |
743 (or (cond ((not (math-expr-contains expr math-integ-var)) | 747 (or (cond ((not (math-expr-contains expr math-integ-var)) |
744 (math-mul expr math-integ-var)) | 748 (math-mul expr math-integ-var)) |
745 ((equal expr math-integ-var) | 749 ((equal expr math-integ-var) |
746 (math-div (math-sqr expr) 2)) | 750 (math-div (math-sqr expr) 2)) |
747 ((eq (car expr) '+) | 751 ((eq (car expr) '+) |
975 (let ((so-far math-integ-var-list-list) | 979 (let ((so-far math-integ-var-list-list) |
976 rat-in) | 980 rat-in) |
977 | 981 |
978 ;; Integration by substitution, for various likely sub-expressions. | 982 ;; Integration by substitution, for various likely sub-expressions. |
979 ;; (In first pass, we look only for sub-exprs that are linear in X.) | 983 ;; (In first pass, we look only for sub-exprs that are linear in X.) |
980 (or (if math-enable-subst | 984 (or (math-integ-try-linear-substitutions expr) |
981 (math-integ-try-substitutions expr) | 985 (math-integ-try-substitutions expr) |
982 (math-integ-try-linear-substitutions expr)) | |
983 | 986 |
984 ;; If function has sines and cosines, try tan(x/2) substitution. | 987 ;; If function has sines and cosines, try tan(x/2) substitution. |
985 (and (let ((p (setq rat-in (math-expr-rational-in expr)))) | 988 (and (let ((p (setq rat-in (math-expr-rational-in expr)))) |
986 (while (and p | 989 (while (and p |
987 (memq (car (car p)) '(calcFunc-sin | 990 (memq (car (car p)) '(calcFunc-sin |
1187 (math-simplify-extended | 1190 (math-simplify-extended |
1188 (math-expr-subst temp math-integ-var u))))) | 1191 (math-expr-subst temp math-integ-var u))))) |
1189 | 1192 |
1190 ;;; Look for substitutions of the form u = a x + b. | 1193 ;;; Look for substitutions of the form u = a x + b. |
1191 (defun math-integ-try-linear-substitutions (sub-expr) | 1194 (defun math-integ-try-linear-substitutions (sub-expr) |
1195 (setq math-linear-subst-tried t) | |
1192 (and (not (Math-primp sub-expr)) | 1196 (and (not (Math-primp sub-expr)) |
1193 (or (and (not (memq (car sub-expr) '(+ - * / neg))) | 1197 (or (and (not (memq (car sub-expr) '(+ - * / neg))) |
1194 (not (and (eq (car sub-expr) '^) | 1198 (not (and (eq (car sub-expr) '^) |
1195 (integerp (nth 2 sub-expr)))) | 1199 (integerp (nth 2 sub-expr)))) |
1196 (math-expr-contains sub-expr math-integ-var) | 1200 (math-expr-contains sub-expr math-integ-var) |