Mercurial > emacs
comparison lisp/calc/calcalg2.el @ 60083:c96f8fda0cfb
Add derivative and integration rules for calcFunc-sec, calcFunc-csc,
calcFunc-cot, calcFunc-sech, calcFunc-csch, calcFunc-coth.
(math-do-integral-methods): Add to checks for when to use
substitutions.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Tue, 15 Feb 2005 19:27:47 +0000 |
parents | f4f966b4564d |
children | bb2dd3519754 7e3f621f1dd4 |
comparison
equal
deleted
inserted
replaced
60082:1697c06499c8 | 60083:c96f8fda0cfb |
---|---|
410 (function (lambda (u) (math-to-radians-2 | 410 (function (lambda (u) (math-to-radians-2 |
411 (math-div 1 (math-sqr | 411 (math-div 1 (math-sqr |
412 (math-normalize | 412 (math-normalize |
413 (list 'calcFunc-cos u)))))))) | 413 (list 'calcFunc-cos u)))))))) |
414 | 414 |
415 (put 'calcFunc-sec\' 'math-derivative-1 | |
416 (function (lambda (u) (math-to-radians-2 | |
417 (math-mul | |
418 (math-normalize | |
419 (list 'calcFunc-sec u)) | |
420 (math-normalize | |
421 (list 'calcFunc-tan u))))))) | |
422 | |
423 (put 'calcFunc-csc\' 'math-derivative-1 | |
424 (function (lambda (u) (math-neg | |
425 (math-to-radians-2 | |
426 (math-mul | |
427 (math-normalize | |
428 (list 'calcFunc-csc u)) | |
429 (math-normalize | |
430 (list 'calcFunc-cot u)))))))) | |
431 | |
432 (put 'calcFunc-cot\' 'math-derivative-1 | |
433 (function (lambda (u) (math-neg | |
434 (math-to-radians-2 | |
435 (math-div 1 (math-sqr | |
436 (math-normalize | |
437 (list 'calcFunc-sin u))))))))) | |
438 | |
415 (put 'calcFunc-arcsin\' 'math-derivative-1 | 439 (put 'calcFunc-arcsin\' 'math-derivative-1 |
416 (function (lambda (u) | 440 (function (lambda (u) |
417 (math-from-radians-2 | 441 (math-from-radians-2 |
418 (math-div 1 (math-normalize | 442 (math-div 1 (math-normalize |
419 (list 'calcFunc-sqrt | 443 (list 'calcFunc-sqrt |
438 | 462 |
439 (put 'calcFunc-tanh\' 'math-derivative-1 | 463 (put 'calcFunc-tanh\' 'math-derivative-1 |
440 (function (lambda (u) (math-div 1 (math-sqr | 464 (function (lambda (u) (math-div 1 (math-sqr |
441 (math-normalize | 465 (math-normalize |
442 (list 'calcFunc-cosh u))))))) | 466 (list 'calcFunc-cosh u))))))) |
467 | |
468 (put 'calcFunc-sech\' 'math-derivative-1 | |
469 (function (lambda (u) (math-neg | |
470 (math-mul | |
471 (math-normalize (list 'calcFunc-sech u)) | |
472 (math-normalize (list 'calcFunc-tanh u))))))) | |
473 | |
474 (put 'calcFunc-csch\' 'math-derivative-1 | |
475 (function (lambda (u) (math-neg | |
476 (math-mul | |
477 (math-normalize (list 'calcFunc-csch u)) | |
478 (math-normalize (list 'calcFunc-coth u))))))) | |
479 | |
480 (put 'calcFunc-tanh\' 'math-derivative-1 | |
481 (function (lambda (u) (math-neg | |
482 (math-div 1 (math-sqr | |
483 (math-normalize | |
484 (list 'calcFunc-sinh u)))))))) | |
443 | 485 |
444 (put 'calcFunc-arcsinh\' 'math-derivative-1 | 486 (put 'calcFunc-arcsinh\' 'math-derivative-1 |
445 (function (lambda (u) | 487 (function (lambda (u) |
446 (math-div 1 (math-normalize | 488 (math-div 1 (math-normalize |
447 (list 'calcFunc-sqrt | 489 (list 'calcFunc-sqrt |
1051 ;; If function has sines and cosines, try tan(x/2) substitution. | 1093 ;; If function has sines and cosines, try tan(x/2) substitution. |
1052 (and (let ((p (setq rat-in (math-expr-rational-in math-integ-expr)))) | 1094 (and (let ((p (setq rat-in (math-expr-rational-in math-integ-expr)))) |
1053 (while (and p | 1095 (while (and p |
1054 (memq (car (car p)) '(calcFunc-sin | 1096 (memq (car (car p)) '(calcFunc-sin |
1055 calcFunc-cos | 1097 calcFunc-cos |
1056 calcFunc-tan)) | 1098 calcFunc-tan |
1099 calcFunc-sec | |
1100 calcFunc-csc | |
1101 calcFunc-cot)) | |
1057 (equal (nth 1 (car p)) math-integ-var)) | 1102 (equal (nth 1 (car p)) math-integ-var)) |
1058 (setq p (cdr p))) | 1103 (setq p (cdr p))) |
1059 (null p)) | 1104 (null p)) |
1060 (or (and (math-integ-parts-easy math-integ-expr) | 1105 (or (and (math-integ-parts-easy math-integ-expr) |
1061 (math-integ-try-parts math-integ-expr t)) | 1106 (math-integ-try-parts math-integ-expr t)) |
1066 (and (let ((p rat-in)) | 1111 (and (let ((p rat-in)) |
1067 (while (and p | 1112 (while (and p |
1068 (memq (car (car p)) '(calcFunc-sinh | 1113 (memq (car (car p)) '(calcFunc-sinh |
1069 calcFunc-cosh | 1114 calcFunc-cosh |
1070 calcFunc-tanh | 1115 calcFunc-tanh |
1116 calcFunc-sech | |
1117 calcFunc-csch | |
1118 calcFunc-coth | |
1071 calcFunc-exp)) | 1119 calcFunc-exp)) |
1072 (equal (nth 1 (car p)) math-integ-var)) | 1120 (equal (nth 1 (car p)) math-integ-var)) |
1073 (setq p (cdr p))) | 1121 (setq p (cdr p))) |
1074 (null p)) | 1122 (null p)) |
1075 (or (and (math-integ-parts-easy math-integ-expr) | 1123 (or (and (math-integ-parts-easy math-integ-expr) |
1617 (math-defintegral calcFunc-tan | 1665 (math-defintegral calcFunc-tan |
1618 (and (equal u math-integ-var) | 1666 (and (equal u math-integ-var) |
1619 (math-neg (math-from-radians-2 | 1667 (math-neg (math-from-radians-2 |
1620 (list 'calcFunc-ln (list 'calcFunc-cos u)))))) | 1668 (list 'calcFunc-ln (list 'calcFunc-cos u)))))) |
1621 | 1669 |
1670 (math-defintegral calcFunc-sec | |
1671 (and (equal u math-integ-var) | |
1672 (math-from-radians-2 | |
1673 (list 'calcFunc-ln | |
1674 (math-add | |
1675 (list 'calcFunc-sec u) | |
1676 (list 'calcFunc-tan u)))))) | |
1677 | |
1678 (math-defintegral calcFunc-csc | |
1679 (and (equal u math-integ-var) | |
1680 (math-from-radians-2 | |
1681 (list 'calcFunc-ln | |
1682 (math-sub | |
1683 (list 'calcFunc-csc u) | |
1684 (list 'calcFunc-cot u)))))) | |
1685 | |
1686 (math-defintegral calcFunc-cot | |
1687 (and (equal u math-integ-var) | |
1688 (math-from-radians-2 | |
1689 (list 'calcFunc-ln (list 'calcFunc-sin u))))) | |
1690 | |
1622 (math-defintegral calcFunc-arcsin | 1691 (math-defintegral calcFunc-arcsin |
1623 (and (equal u math-integ-var) | 1692 (and (equal u math-integ-var) |
1624 (math-add (math-mul u (list 'calcFunc-arcsin u)) | 1693 (math-add (math-mul u (list 'calcFunc-arcsin u)) |
1625 (math-from-radians-2 | 1694 (math-from-radians-2 |
1626 (list 'calcFunc-sqrt (math-sub 1 (math-sqr u))))))) | 1695 (list 'calcFunc-sqrt (math-sub 1 (math-sqr u))))))) |
1647 (list 'calcFunc-sinh u))) | 1716 (list 'calcFunc-sinh u))) |
1648 | 1717 |
1649 (math-defintegral calcFunc-tanh | 1718 (math-defintegral calcFunc-tanh |
1650 (and (equal u math-integ-var) | 1719 (and (equal u math-integ-var) |
1651 (list 'calcFunc-ln (list 'calcFunc-cosh u)))) | 1720 (list 'calcFunc-ln (list 'calcFunc-cosh u)))) |
1721 | |
1722 (math-defintegral calcFunc-sech | |
1723 (and (equal u math-integ-var) | |
1724 (list 'calcFunc-arctan (list 'calcFunc-sinh u)))) | |
1725 | |
1726 (math-defintegral calcFunc-csch | |
1727 (and (equal u math-integ-var) | |
1728 (list 'calcFunc-ln (list 'calcFunc-tanh (math-div u 2))))) | |
1729 | |
1730 (math-defintegral calcFunc-coth | |
1731 (and (equal u math-integ-var) | |
1732 (list 'calcFunc-ln (list 'calcFunc-sinh u)))) | |
1652 | 1733 |
1653 (math-defintegral calcFunc-arcsinh | 1734 (math-defintegral calcFunc-arcsinh |
1654 (and (equal u math-integ-var) | 1735 (and (equal u math-integ-var) |
1655 (math-sub (math-mul u (list 'calcFunc-arcsinh u)) | 1736 (math-sub (math-mul u (list 'calcFunc-arcsinh u)) |
1656 (list 'calcFunc-sqrt (math-add (math-sqr u) 1))))) | 1737 (list 'calcFunc-sqrt (math-add (math-sqr u) 1))))) |