# HG changeset patch # User Jay Belanger # Date 1108495637 0 # Node ID 1697c06499c829dfc80ee0ba3801764657530d0a # Parent 5af1fe16a166a8333dfa4f3de3aa81cbe06ef650 Add simplification rules for calcFunc-sec, calcFunc-csc, calcFunc-cot. diff -r 5af1fe16a166 -r 1697c06499c8 lisp/calc/calc-units.el --- a/lisp/calc/calc-units.el Tue Feb 15 19:26:49 2005 +0000 +++ b/lisp/calc/calc-units.el Tue Feb 15 19:27:17 2005 +0000 @@ -1241,6 +1241,45 @@ (eq (nth 1 (nth 2 rad)) 'rad) (list 'calcFunc-tan (nth 1 rad)))))) +(math-defsimplify calcFunc-sec + (and math-simplifying-units + (math-units-in-expr-p (nth 1 math-simplify-expr) nil) + (let ((rad (math-simplify-units + (math-evaluate-expr + (math-to-standard-units (nth 1 math-simplify-expr) nil)))) + (calc-angle-mode 'rad)) + (and (eq (car-safe rad) '*) + (math-realp (nth 1 rad)) + (eq (car-safe (nth 2 rad)) 'var) + (eq (nth 1 (nth 2 rad)) 'rad) + (list 'calcFunc-sec (nth 1 rad)))))) + +(math-defsimplify calcFunc-csc + (and math-simplifying-units + (math-units-in-expr-p (nth 1 math-simplify-expr) nil) + (let ((rad (math-simplify-units + (math-evaluate-expr + (math-to-standard-units (nth 1 math-simplify-expr) nil)))) + (calc-angle-mode 'rad)) + (and (eq (car-safe rad) '*) + (math-realp (nth 1 rad)) + (eq (car-safe (nth 2 rad)) 'var) + (eq (nth 1 (nth 2 rad)) 'rad) + (list 'calcFunc-csc (nth 1 rad)))))) + +(math-defsimplify calcFunc-cot + (and math-simplifying-units + (math-units-in-expr-p (nth 1 math-simplify-expr) nil) + (let ((rad (math-simplify-units + (math-evaluate-expr + (math-to-standard-units (nth 1 math-simplify-expr) nil)))) + (calc-angle-mode 'rad)) + (and (eq (car-safe rad) '*) + (math-realp (nth 1 rad)) + (eq (car-safe (nth 2 rad)) 'var) + (eq (nth 1 (nth 2 rad)) 'rad) + (list 'calcFunc-cot (nth 1 rad)))))) + (defun math-remove-units (expr) (if (math-check-unit-name expr)