From 7a91562ff0ea0033add100295a52ded5a8be0d9b Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sat, 23 Feb 2013 19:05:13 -0600 Subject: [PATCH] * calc/calc-ext.el (math-to-radians-2, math-from-radians-2): Add option to force `pi' to remain symbolic. * calc/calcalg2.el (calcFunc-sin, calcFunc-cos, calcFunc-tan) (calcFunc-cot, calcFunc-csc, calcFunc-sec, calcFunc-arcsin) (calcFunc-arccos, calcFunc-arctan): Use symbolic `pi' in the derivatives, when necessary. --- lisp/ChangeLog | 9 +++++++++ lisp/calc/calc-math.el | 8 ++++---- lisp/calc/calcalg2.el | 18 +++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1897e48d715..d596d4f6fb1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2013-02-24 Jay Belanger + + * calc/calc-ext.el (math-to-radians-2, math-from-radians-2): + Add option to force `pi' to remain symbolic. + * calc/calcalg2.el (calcFunc-sin, calcFunc-cos, calcFunc-tan) + (calcFunc-cot, calcFunc-csc, calcFunc-sec, calcFunc-arcsin) + (calcFunc-arccos, calcFunc-arctan): Use symbolic `pi' in the + derivatives, when necessary. + 2013-02-23 Peter Kleiweg * progmodes/ps-mode.el (ps-mode-version): Bump to 1.1i. diff --git a/lisp/calc/calc-math.el b/lisp/calc/calc-math.el index 94b3f645785..3b845f563a1 100644 --- a/lisp/calc/calc-math.el +++ b/lisp/calc/calc-math.el @@ -777,18 +777,18 @@ If this can't be done, return NIL." (math-to-hms a 'rad)) (t a))) -(defun math-to-radians-2 (a) ; [N N] +(defun math-to-radians-2 (a &optional force-symbolic) ; [N N] (cond ((eq (car-safe a) 'hms) (math-from-hms a 'rad)) ((memq calc-angle-mode '(deg hms)) - (if calc-symbolic-mode + (if (or calc-symbolic-mode force-symbolic) (math-div (math-mul a '(var pi var-pi)) 180) (math-mul a (math-pi-over-180)))) (t a))) -(defun math-from-radians-2 (a) ; [N N] +(defun math-from-radians-2 (a &optional force-symbolic) ; [N N] (cond ((memq calc-angle-mode '(deg hms)) - (if calc-symbolic-mode + (if (or calc-symbolic-mode force-symbolic) (math-div (math-mul 180 a) '(var pi var-pi)) (math-div a (math-pi-over-180)))) (t a))) diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 58a82bcf143..cd962e7dbed 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el @@ -401,18 +401,18 @@ (put 'calcFunc-sin\' 'math-derivative-1 (function (lambda (u) (math-to-radians-2 (math-normalize - (list 'calcFunc-cos u)))))) + (list 'calcFunc-cos u)) t)))) (put 'calcFunc-cos\' 'math-derivative-1 (function (lambda (u) (math-neg (math-to-radians-2 (math-normalize - (list 'calcFunc-sin u))))))) + (list 'calcFunc-sin u)) t))))) (put 'calcFunc-tan\' 'math-derivative-1 (function (lambda (u) (math-to-radians-2 (math-sqr (math-normalize - (list 'calcFunc-sec u))))))) + (list 'calcFunc-sec u))) t)))) (put 'calcFunc-sec\' 'math-derivative-1 (function (lambda (u) (math-to-radians-2 @@ -420,7 +420,7 @@ (math-normalize (list 'calcFunc-sec u)) (math-normalize - (list 'calcFunc-tan u))))))) + (list 'calcFunc-tan u))) t)))) (put 'calcFunc-csc\' 'math-derivative-1 (function (lambda (u) (math-neg @@ -429,32 +429,32 @@ (math-normalize (list 'calcFunc-csc u)) (math-normalize - (list 'calcFunc-cot u)))))))) + (list 'calcFunc-cot u))) t))))) (put 'calcFunc-cot\' 'math-derivative-1 (function (lambda (u) (math-neg (math-to-radians-2 (math-sqr (math-normalize - (list 'calcFunc-csc u)))))))) + (list 'calcFunc-csc u))) t))))) (put 'calcFunc-arcsin\' 'math-derivative-1 (function (lambda (u) (math-from-radians-2 (math-div 1 (math-normalize (list 'calcFunc-sqrt - (math-sub 1 (math-sqr u))))))))) + (math-sub 1 (math-sqr u))))) t)))) (put 'calcFunc-arccos\' 'math-derivative-1 (function (lambda (u) (math-from-radians-2 (math-div -1 (math-normalize (list 'calcFunc-sqrt - (math-sub 1 (math-sqr u))))))))) + (math-sub 1 (math-sqr u))))) t)))) (put 'calcFunc-arctan\' 'math-derivative-1 (function (lambda (u) (math-from-radians-2 - (math-div 1 (math-add 1 (math-sqr u))))))) + (math-div 1 (math-add 1 (math-sqr u))) t)))) (put 'calcFunc-sinh\' 'math-derivative-1 (function (lambda (u) (math-normalize (list 'calcFunc-cosh u))))) -- 2.39.2