emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-alg.el


From: Jay Belanger
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-alg.el
Date: Tue, 15 Feb 2005 14:23:46 -0500

Index: emacs/lisp/calc/calc-alg.el
diff -c emacs/lisp/calc/calc-alg.el:1.12 emacs/lisp/calc/calc-alg.el:1.13
*** emacs/lisp/calc/calc-alg.el:1.12    Tue Nov 30 17:00:26 2004
--- emacs/lisp/calc/calc-alg.el Tue Feb 15 19:23:46 2005
***************
*** 746,751 ****
--- 746,800 ----
                     (list '* (list 'calcFunc-sin (list '* (1- n) a))
                           (list 'calcFunc-sin a))))))))
  
+ (math-defsimplify calcFunc-sec
+   (or (and (math-looks-negp (nth 1 math-simplify-expr))
+          (list 'calcFunc-sec (math-neg (nth 1 math-simplify-expr))))
+       (and (eq calc-angle-mode 'rad)
+          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+            (and n
+                 (math-div 1 (math-known-sin (car n) (nth 1 n) 120 300)))))
+       (and (eq calc-angle-mode 'deg)
+          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+            (and n
+                   (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 
300)))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
+            (math-div 
+             1
+             (list 'calcFunc-sqrt 
+                   (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+            (math-div 
+             1
+             (nth 1 (nth 1 math-simplify-expr))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
+            (list 'calcFunc-sqrt
+                  (math-add 1 
+                            (math-sqr (nth 1 (nth 1 math-simplify-expr))))))))
+ 
+ (math-defsimplify calcFunc-csc
+   (or (and (math-looks-negp (nth 1 math-simplify-expr))
+          (math-neg (list 'calcFunc-csc (math-neg (nth 1 
math-simplify-expr)))))
+       (and (eq calc-angle-mode 'rad)
+          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+            (and n
+                   (math-div 1 (math-known-sin (car n) (nth 1 n) 120 0)))))
+       (and (eq calc-angle-mode 'deg)
+          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+            (and n
+                   (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 
0)))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
+          (math-div 1 (nth 1 (nth 1 math-simplify-expr))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+            (math-div 
+             1
+             (list 'calcFunc-sqrt (math-sub 1 (math-sqr 
+                                               (nth 1 (nth 1 
math-simplify-expr)))))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
+          (math-div (list 'calcFunc-sqrt
+                          (math-add 1 (math-sqr 
+                                         (nth 1 (nth 1 math-simplify-expr)))))
+                      (nth 1 (nth 1 math-simplify-expr))))))
+ 
  (defun math-should-expand-trig (x &optional hyperbolic)
    (let ((m (math-is-multiple x)))
      (and math-living-dangerously
***************
*** 827,832 ****
--- 876,903 ----
               (math-div (list 'calcFunc-sin (nth 1 math-simplify-expr))
                         (list 'calcFunc-cos (nth 1 math-simplify-expr))))))))
  
+ (math-defsimplify calcFunc-cot
+   (or (and (math-looks-negp (nth 1 math-simplify-expr))
+          (math-neg (list 'calcFunc-cot (math-neg (nth 1 
math-simplify-expr)))))
+       (and (eq calc-angle-mode 'rad)
+          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+            (and n
+                   (math-div 1 (math-known-tan (car n) (nth 1 n) 120)))))
+       (and (eq calc-angle-mode 'deg)
+          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+            (and n
+                   (math-div 1 (math-known-tan (car n) (nth 1 n) '(frac 2 
3))))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
+          (math-div (list 'calcFunc-sqrt
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))
+                      (nth 1 (nth 1 math-simplify-expr))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+          (math-div (nth 1 (nth 1 math-simplify-expr))
+                      (list 'calcFunc-sqrt
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
+          (math-div 1 (nth 1 (nth 1 math-simplify-expr))))))
+ 
  (defun math-known-tan (plus n mul)
    (setq n (math-mul n mul))
    (and (math-num-integerp n)
***************
*** 930,935 ****
--- 1001,1058 ----
               (math-div (list 'calcFunc-sinh (nth 1 math-simplify-expr))
                         (list 'calcFunc-cosh (nth 1 math-simplify-expr))))))))
  
+ (math-defsimplify calcFunc-sech
+   (or (and (math-looks-negp (nth 1 math-simplify-expr))
+          (list 'calcFunc-sech (math-neg (nth 1 math-simplify-expr))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+          math-living-dangerously
+            (math-div 
+             1
+             (list 'calcFunc-sqrt 
+                   (math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 
1))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+          math-living-dangerously
+            (math-div 1 (nth 1 (nth 1 math-simplify-expr))) 1)
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+          math-living-dangerously
+            (list 'calcFunc-sqrt
+                  (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr))))))))
+ 
+ (math-defsimplify calcFunc-csch
+   (or (and (math-looks-negp (nth 1 math-simplify-expr))
+          (math-neg (list 'calcFunc-csch (math-neg (nth 1 
math-simplify-expr)))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+          math-living-dangerously
+            (math-div 1 (nth 1 (nth 1 math-simplify-expr))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+          math-living-dangerously
+            (math-div 
+             1
+             (list 'calcFunc-sqrt 
+                   (math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 
1))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+          math-living-dangerously
+          (math-div (list 'calcFunc-sqrt
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))
+                      (nth 1 (nth 1 math-simplify-expr))))))
+ 
+ (math-defsimplify calcFunc-coth
+   (or (and (math-looks-negp (nth 1 math-simplify-expr))
+          (math-neg (list 'calcFunc-coth (math-neg (nth 1 
math-simplify-expr)))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+          math-living-dangerously
+          (math-div (list 'calcFunc-sqrt
+                          (math-add (math-sqr (nth 1 (nth 1 
math-simplify-expr))) 1))
+                      (nth 1 (nth 1 math-simplify-expr))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+          math-living-dangerously
+          (math-div (nth 1 (nth 1 math-simplify-expr))
+                      (list 'calcFunc-sqrt
+                          (math-sub (math-sqr (nth 1 (nth 1 
math-simplify-expr))) 1))))
+       (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+          math-living-dangerously
+          (math-div 1 (nth 1 (nth 1 math-simplify-expr))))))
+ 
  (math-defsimplify calcFunc-arcsin
    (or (and (math-looks-negp (nth 1 math-simplify-expr))
           (math-neg (list 'calcFunc-arcsin (math-neg (nth 1 
math-simplify-expr)))))
***************
*** 1043,1050 ****
--- 1166,1178 ----
                           (math-equal-int (nth 2 a) 2)
                           (or (and (eq (car-safe (nth 1 a)) 'calcFunc-sinh)
                                    (list 'calcFunc-cosh (nth 1 (nth 1 a))))
+                                (and (eq (car-safe (nth 1 a)) 'calcFunc-csch)
+                                   (list 'calcFunc-coth (nth 1 (nth 1 a))))
                               (and (eq (car-safe (nth 1 a)) 'calcFunc-tan)
                                    (list '/ 1 (list 'calcFunc-cos
+                                                    (nth 1 (nth 1 a)))))
+                              (and (eq (car-safe (nth 1 a)) 'calcFunc-cot)
+                                   (list '/ 1 (list 'calcFunc-sin
                                                     (nth 1 (nth 1 a)))))))))
               (and (eq (car-safe (nth 1 math-simplify-expr)) '^)
                    (list '^




reply via email to

[Prev in Thread] Current Thread [Next in Thread]