aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2005-02-15 19:27:17 +0000
committerJay Belanger2005-02-15 19:27:17 +0000
commit40b444acab7a616650166acccdba7b0c75f0e701 (patch)
tree1c3d7a538b7206b8308a99e62e27316227ea1ed8
parent6735a29b343972d958c9c03a2b29e56aa1a69bd8 (diff)
downloademacs-40b444acab7a616650166acccdba7b0c75f0e701.tar.gz
emacs-40b444acab7a616650166acccdba7b0c75f0e701.zip
Add simplification rules for calcFunc-sec, calcFunc-csc, calcFunc-cot.
-rw-r--r--lisp/calc/calc-units.el39
1 files changed, 39 insertions, 0 deletions
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index e8a3abfe958..4b3c284ddad 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -1241,6 +1241,45 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
1241 (eq (nth 1 (nth 2 rad)) 'rad) 1241 (eq (nth 1 (nth 2 rad)) 'rad)
1242 (list 'calcFunc-tan (nth 1 rad)))))) 1242 (list 'calcFunc-tan (nth 1 rad))))))
1243 1243
1244(math-defsimplify calcFunc-sec
1245 (and math-simplifying-units
1246 (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
1247 (let ((rad (math-simplify-units
1248 (math-evaluate-expr
1249 (math-to-standard-units (nth 1 math-simplify-expr) nil))))
1250 (calc-angle-mode 'rad))
1251 (and (eq (car-safe rad) '*)
1252 (math-realp (nth 1 rad))
1253 (eq (car-safe (nth 2 rad)) 'var)
1254 (eq (nth 1 (nth 2 rad)) 'rad)
1255 (list 'calcFunc-sec (nth 1 rad))))))
1256
1257(math-defsimplify calcFunc-csc
1258 (and math-simplifying-units
1259 (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
1260 (let ((rad (math-simplify-units
1261 (math-evaluate-expr
1262 (math-to-standard-units (nth 1 math-simplify-expr) nil))))
1263 (calc-angle-mode 'rad))
1264 (and (eq (car-safe rad) '*)
1265 (math-realp (nth 1 rad))
1266 (eq (car-safe (nth 2 rad)) 'var)
1267 (eq (nth 1 (nth 2 rad)) 'rad)
1268 (list 'calcFunc-csc (nth 1 rad))))))
1269
1270(math-defsimplify calcFunc-cot
1271 (and math-simplifying-units
1272 (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
1273 (let ((rad (math-simplify-units
1274 (math-evaluate-expr
1275 (math-to-standard-units (nth 1 math-simplify-expr) nil))))
1276 (calc-angle-mode 'rad))
1277 (and (eq (car-safe rad) '*)
1278 (math-realp (nth 1 rad))
1279 (eq (car-safe (nth 2 rad)) 'var)
1280 (eq (nth 1 (nth 2 rad)) 'rad)
1281 (list 'calcFunc-cot (nth 1 rad))))))
1282
1244 1283
1245(defun math-remove-units (expr) 1284(defun math-remove-units (expr)
1246 (if (math-check-unit-name expr) 1285 (if (math-check-unit-name expr)