comparison lisp/calc/calc-rules.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 0d8b17d428b5
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; calc-rules.el --- rules for simplifying algebraic expressions in Calc 1 ;;; calc-rules.el --- rules for simplifying algebraic expressions in Calc
2 2
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
4 ;; 2005 Free Software Foundation, Inc.
4 5
5 ;; Author: David Gillespie <daveg@synaptics.com> 6 ;; Author: David Gillespie <daveg@synaptics.com>
6 ;; Maintainers: D. Goel <deego@gnufans.org> 7 ;; Maintainer: Jay Belanger <belanger@truman.edu>
7 ;; Colin Walters <walters@debian.org>
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
10 10
11 ;; GNU Emacs is distributed in the hope that it will be useful, 11 ;; GNU Emacs is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY. No author or distributor 12 ;; but WITHOUT ANY WARRANTY. No author or distributor
26 ;;; Commentary: 26 ;;; Commentary:
27 27
28 ;;; Code: 28 ;;; Code:
29 29
30 ;; This file is autoloaded from calc-ext.el. 30 ;; This file is autoloaded from calc-ext.el.
31
31 (require 'calc-ext) 32 (require 'calc-ext)
32
33 (require 'calc-macs) 33 (require 'calc-macs)
34
35 (defun calc-Need-calc-rules () nil)
36
37 34
38 (defun calc-compile-rule-set (name rules) 35 (defun calc-compile-rule-set (name rules)
39 (prog2 36 (prog2
40 (message "Preparing rule set %s..." name) 37 (message "Preparing rule set %s..." name)
41 (math-read-plain-expr rules t) 38 (math-read-plain-expr rules t)
155 (1 - tan(a) tan(b)), 152 (1 - tan(a) tan(b)),
156 tan(select(2 a)) := 2 tan(select(a)) / (1 - tan(a)^2), 153 tan(select(2 a)) := 2 tan(select(a)) / (1 - tan(a)^2),
157 tan(select(n a)) := (tan((n-1) select(a)) + tan(a)) / 154 tan(select(n a)) := (tan((n-1) select(a)) + tan(a)) /
158 (1 - tan((n-1) a) tan(a)) 155 (1 - tan((n-1) a) tan(a))
159 :: integer(n) :: n > 2, 156 :: integer(n) :: n > 2,
157 cot(select(a + b)) := (cot(select(a)) cot(b) - 1) /
158 (cot(a) + cot(b)),
160 sinh(select(a + b)) := sinh(select(a)) cosh(b) + cosh(a) sinh(b), 159 sinh(select(a + b)) := sinh(select(a)) cosh(b) + cosh(a) sinh(b),
161 cosh(select(a + b)) := cosh(select(a)) cosh(b) + sinh(a) sinh(b), 160 cosh(select(a + b)) := cosh(select(a)) cosh(b) + sinh(a) sinh(b),
162 tanh(select(a + b)) := (tanh(select(a)) + tanh(b)) / 161 tanh(select(a + b)) := (tanh(select(a)) + tanh(b)) /
163 (1 + tanh(a) tanh(b)), 162 (1 + tanh(a) tanh(b)),
163 coth(select(a + b)) := (coth(select(a)) coth(b) + 1) /
164 (coth(a) + coth(b)),
164 x && select(a || b) := (x && select(a)) || (x && b), 165 x && select(a || b) := (x && select(a)) || (x && b),
165 select(a || b) && x := (select(a) && x) || (b && x), 166 select(a || b) && x := (select(a) && x) || (b && x),
166 ! select(a && b) := (!a) || (!b), 167 ! select(a && b) := (!a) || (!b),
167 ! select(a || b) := (!a) && (!b) ]")) 168 ! select(a || b) := (!a) && (!b) ]"))
168 169
271 fceil(select(x)) := -ffloor(select(-x)), 272 fceil(select(x)) := -ffloor(select(-x)),
272 exp(select(x)) := 1 / exp(select(-x)), 273 exp(select(x)) := 1 / exp(select(-x)),
273 sin(select(x)) := -sin(select(-x)), 274 sin(select(x)) := -sin(select(-x)),
274 cos(select(x)) := cos(select(-x)), 275 cos(select(x)) := cos(select(-x)),
275 tan(select(x)) := -tan(select(-x)), 276 tan(select(x)) := -tan(select(-x)),
277 sec(select(x)) := sec(select(-x)),
278 csc(select(x)) := -csc(select(-x)),
279 cot(select(x)) := -cot(select(-x)),
276 arcsin(select(x)) := -arcsin(select(-x)), 280 arcsin(select(x)) := -arcsin(select(-x)),
277 arccos(select(x)) := 4 arctan(1) - arccos(select(-x)), 281 arccos(select(x)) := 4 arctan(1) - arccos(select(-x)),
278 arctan(select(x)) := -arctan(select(-x)), 282 arctan(select(x)) := -arctan(select(-x)),
279 sinh(select(x)) := -sinh(select(-x)), 283 sinh(select(x)) := -sinh(select(-x)),
280 cosh(select(x)) := cosh(select(-x)), 284 cosh(select(x)) := cosh(select(-x)),
281 tanh(select(x)) := -tanh(select(-x)), 285 tanh(select(x)) := -tanh(select(-x)),
286 sech(select(x)) := sech(select(-x)),
287 csch(select(x)) := -csch(select(-x)),
288 coth(select(x)) := -coth(select(-x)),
282 arcsinh(select(x)) := -arcsinh(select(-x)), 289 arcsinh(select(x)) := -arcsinh(select(-x)),
283 arctanh(select(x)) := -arctanh(select(-x)), 290 arctanh(select(x)) := -arctanh(select(-x)),
284 select(x) = a := select(-x) = -a, 291 select(x) = a := select(-x) = -a,
285 select(x) != a := select(-x) != -a, 292 select(x) != a := select(-x) != -a,
286 select(x) < a := select(-x) > -a, 293 select(x) < a := select(-x) > -a,
436 :: let(cons(fvh,fvt), 443 :: let(cons(fvh,fvt),
437 solve(pv, table(fitparam(j), j, 1, 444 solve(pv, table(fitparam(j), j, 1,
438 hasfitparams(pv)))), 445 hasfitparams(pv)))),
439 fitparam(n) = x := x ]")) 446 fitparam(n) = x := x ]"))
440 447
448 (provide 'calc-rules)
449
450 ;;; arch-tag: 0ed54a52-38f3-4ed7-9ca7-b8ecf8f2febe
441 ;;; calc-rules.el ends here 451 ;;; calc-rules.el ends here