Mercurial > emacs
comparison lisp/calc/calc-alg.el @ 90105:7e3f621f1dd4
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96
Move Gnus images into etc/images
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15
Update from CVS: lisp/imap.el (imap-log): Doc fix.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16
Merge from emacs--cvs-trunk--0
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 18 Feb 2005 00:41:50 +0000 |
parents | f2ebccfa87d4 7796027f64bd |
children | 62afea0771d8 |
comparison
equal
deleted
inserted
replaced
90104:a01e7a9f1659 | 90105:7e3f621f1dd4 |
---|---|
744 (list '* (list 'calcFunc-cos (list '* (1- n) a)) | 744 (list '* (list 'calcFunc-cos (list '* (1- n) a)) |
745 (list 'calcFunc-cos a)) | 745 (list 'calcFunc-cos a)) |
746 (list '* (list 'calcFunc-sin (list '* (1- n) a)) | 746 (list '* (list 'calcFunc-sin (list '* (1- n) a)) |
747 (list 'calcFunc-sin a)))))))) | 747 (list 'calcFunc-sin a)))))))) |
748 | 748 |
749 (math-defsimplify calcFunc-sec | |
750 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | |
751 (list 'calcFunc-sec (math-neg (nth 1 math-simplify-expr)))) | |
752 (and (eq calc-angle-mode 'rad) | |
753 (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi var-pi)))) | |
754 (and n | |
755 (math-div 1 (math-known-sin (car n) (nth 1 n) 120 300))))) | |
756 (and (eq calc-angle-mode 'deg) | |
757 (let ((n (math-integer-plus (nth 1 math-simplify-expr)))) | |
758 (and n | |
759 (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 300))))) | |
760 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin) | |
761 (math-div | |
762 1 | |
763 (list 'calcFunc-sqrt | |
764 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))))) | |
765 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos) | |
766 (math-div | |
767 1 | |
768 (nth 1 (nth 1 math-simplify-expr)))) | |
769 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan) | |
770 (list 'calcFunc-sqrt | |
771 (math-add 1 | |
772 (math-sqr (nth 1 (nth 1 math-simplify-expr)))))))) | |
773 | |
774 (math-defsimplify calcFunc-csc | |
775 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | |
776 (math-neg (list 'calcFunc-csc (math-neg (nth 1 math-simplify-expr))))) | |
777 (and (eq calc-angle-mode 'rad) | |
778 (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi var-pi)))) | |
779 (and n | |
780 (math-div 1 (math-known-sin (car n) (nth 1 n) 120 0))))) | |
781 (and (eq calc-angle-mode 'deg) | |
782 (let ((n (math-integer-plus (nth 1 math-simplify-expr)))) | |
783 (and n | |
784 (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 0))))) | |
785 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin) | |
786 (math-div 1 (nth 1 (nth 1 math-simplify-expr)))) | |
787 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos) | |
788 (math-div | |
789 1 | |
790 (list 'calcFunc-sqrt (math-sub 1 (math-sqr | |
791 (nth 1 (nth 1 math-simplify-expr))))))) | |
792 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan) | |
793 (math-div (list 'calcFunc-sqrt | |
794 (math-add 1 (math-sqr | |
795 (nth 1 (nth 1 math-simplify-expr))))) | |
796 (nth 1 (nth 1 math-simplify-expr)))))) | |
797 | |
749 (defun math-should-expand-trig (x &optional hyperbolic) | 798 (defun math-should-expand-trig (x &optional hyperbolic) |
750 (let ((m (math-is-multiple x))) | 799 (let ((m (math-is-multiple x))) |
751 (and math-living-dangerously | 800 (and math-living-dangerously |
752 m (or (and (integerp (car m)) (> (car m) 1)) | 801 m (or (and (integerp (car m)) (> (car m) 1)) |
753 (equal (car m) '(frac 1 2))) | 802 (equal (car m) '(frac 1 2))) |
825 (math-div (math-sub 1 (list 'calcFunc-cos (nth 1 m))) | 874 (math-div (math-sub 1 (list 'calcFunc-cos (nth 1 m))) |
826 (list 'calcFunc-sin (nth 1 m))) | 875 (list 'calcFunc-sin (nth 1 m))) |
827 (math-div (list 'calcFunc-sin (nth 1 math-simplify-expr)) | 876 (math-div (list 'calcFunc-sin (nth 1 math-simplify-expr)) |
828 (list 'calcFunc-cos (nth 1 math-simplify-expr)))))))) | 877 (list 'calcFunc-cos (nth 1 math-simplify-expr)))))))) |
829 | 878 |
879 (math-defsimplify calcFunc-cot | |
880 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | |
881 (math-neg (list 'calcFunc-cot (math-neg (nth 1 math-simplify-expr))))) | |
882 (and (eq calc-angle-mode 'rad) | |
883 (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi var-pi)))) | |
884 (and n | |
885 (math-div 1 (math-known-tan (car n) (nth 1 n) 120))))) | |
886 (and (eq calc-angle-mode 'deg) | |
887 (let ((n (math-integer-plus (nth 1 math-simplify-expr)))) | |
888 (and n | |
889 (math-div 1 (math-known-tan (car n) (nth 1 n) '(frac 2 3)))))) | |
890 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin) | |
891 (math-div (list 'calcFunc-sqrt | |
892 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))) | |
893 (nth 1 (nth 1 math-simplify-expr)))) | |
894 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos) | |
895 (math-div (nth 1 (nth 1 math-simplify-expr)) | |
896 (list 'calcFunc-sqrt | |
897 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))))) | |
898 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan) | |
899 (math-div 1 (nth 1 (nth 1 math-simplify-expr)))))) | |
900 | |
830 (defun math-known-tan (plus n mul) | 901 (defun math-known-tan (plus n mul) |
831 (setq n (math-mul n mul)) | 902 (setq n (math-mul n mul)) |
832 (and (math-num-integerp n) | 903 (and (math-num-integerp n) |
833 (setq n (math-mod (math-trunc n) 120)) | 904 (setq n (math-mod (math-trunc n) 120)) |
834 (if (> n 60) | 905 (if (> n 60) |
927 (if (equal (car m) '(frac 1 2)) | 998 (if (equal (car m) '(frac 1 2)) |
928 (math-div (math-sub (list 'calcFunc-cosh (nth 1 m)) 1) | 999 (math-div (math-sub (list 'calcFunc-cosh (nth 1 m)) 1) |
929 (list 'calcFunc-sinh (nth 1 m))) | 1000 (list 'calcFunc-sinh (nth 1 m))) |
930 (math-div (list 'calcFunc-sinh (nth 1 math-simplify-expr)) | 1001 (math-div (list 'calcFunc-sinh (nth 1 math-simplify-expr)) |
931 (list 'calcFunc-cosh (nth 1 math-simplify-expr)))))))) | 1002 (list 'calcFunc-cosh (nth 1 math-simplify-expr)))))))) |
1003 | |
1004 (math-defsimplify calcFunc-sech | |
1005 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | |
1006 (list 'calcFunc-sech (math-neg (nth 1 math-simplify-expr)))) | |
1007 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh) | |
1008 math-living-dangerously | |
1009 (math-div | |
1010 1 | |
1011 (list 'calcFunc-sqrt | |
1012 (math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))) | |
1013 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh) | |
1014 math-living-dangerously | |
1015 (math-div 1 (nth 1 (nth 1 math-simplify-expr))) 1) | |
1016 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh) | |
1017 math-living-dangerously | |
1018 (list 'calcFunc-sqrt | |
1019 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr)))))))) | |
1020 | |
1021 (math-defsimplify calcFunc-csch | |
1022 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | |
1023 (math-neg (list 'calcFunc-csch (math-neg (nth 1 math-simplify-expr))))) | |
1024 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh) | |
1025 math-living-dangerously | |
1026 (math-div 1 (nth 1 (nth 1 math-simplify-expr)))) | |
1027 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh) | |
1028 math-living-dangerously | |
1029 (math-div | |
1030 1 | |
1031 (list 'calcFunc-sqrt | |
1032 (math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))) | |
1033 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh) | |
1034 math-living-dangerously | |
1035 (math-div (list 'calcFunc-sqrt | |
1036 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))) | |
1037 (nth 1 (nth 1 math-simplify-expr)))))) | |
1038 | |
1039 (math-defsimplify calcFunc-coth | |
1040 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | |
1041 (math-neg (list 'calcFunc-coth (math-neg (nth 1 math-simplify-expr))))) | |
1042 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh) | |
1043 math-living-dangerously | |
1044 (math-div (list 'calcFunc-sqrt | |
1045 (math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)) | |
1046 (nth 1 (nth 1 math-simplify-expr)))) | |
1047 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh) | |
1048 math-living-dangerously | |
1049 (math-div (nth 1 (nth 1 math-simplify-expr)) | |
1050 (list 'calcFunc-sqrt | |
1051 (math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))) | |
1052 (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh) | |
1053 math-living-dangerously | |
1054 (math-div 1 (nth 1 (nth 1 math-simplify-expr)))))) | |
932 | 1055 |
933 (math-defsimplify calcFunc-arcsin | 1056 (math-defsimplify calcFunc-arcsin |
934 (or (and (math-looks-negp (nth 1 math-simplify-expr)) | 1057 (or (and (math-looks-negp (nth 1 math-simplify-expr)) |
935 (math-neg (list 'calcFunc-arcsin (math-neg (nth 1 math-simplify-expr))))) | 1058 (math-neg (list 'calcFunc-arcsin (math-neg (nth 1 math-simplify-expr))))) |
936 (and (eq (nth 1 math-simplify-expr) 1) | 1059 (and (eq (nth 1 math-simplify-expr) 1) |
1041 (math-equal-int b 1)) | 1164 (math-equal-int b 1)) |
1042 (eq (car-safe a) '^) | 1165 (eq (car-safe a) '^) |
1043 (math-equal-int (nth 2 a) 2) | 1166 (math-equal-int (nth 2 a) 2) |
1044 (or (and (eq (car-safe (nth 1 a)) 'calcFunc-sinh) | 1167 (or (and (eq (car-safe (nth 1 a)) 'calcFunc-sinh) |
1045 (list 'calcFunc-cosh (nth 1 (nth 1 a)))) | 1168 (list 'calcFunc-cosh (nth 1 (nth 1 a)))) |
1169 (and (eq (car-safe (nth 1 a)) 'calcFunc-csch) | |
1170 (list 'calcFunc-coth (nth 1 (nth 1 a)))) | |
1046 (and (eq (car-safe (nth 1 a)) 'calcFunc-tan) | 1171 (and (eq (car-safe (nth 1 a)) 'calcFunc-tan) |
1047 (list '/ 1 (list 'calcFunc-cos | 1172 (list '/ 1 (list 'calcFunc-cos |
1173 (nth 1 (nth 1 a))))) | |
1174 (and (eq (car-safe (nth 1 a)) 'calcFunc-cot) | |
1175 (list '/ 1 (list 'calcFunc-sin | |
1048 (nth 1 (nth 1 a))))))))) | 1176 (nth 1 (nth 1 a))))))))) |
1049 (and (eq (car-safe (nth 1 math-simplify-expr)) '^) | 1177 (and (eq (car-safe (nth 1 math-simplify-expr)) '^) |
1050 (list '^ | 1178 (list '^ |
1051 (nth 1 (nth 1 math-simplify-expr)) | 1179 (nth 1 (nth 1 math-simplify-expr)) |
1052 (math-div (nth 2 (nth 1 math-simplify-expr)) 2))) | 1180 (math-div (nth 2 (nth 1 math-simplify-expr)) 2))) |