Function: math-trig-rewrite
math-trig-rewrite is a byte-compiled function defined in
calc-alg.el.gz.
Signature
(math-trig-rewrite FN)
Documentation
Rewrite trigonometric functions in terms of sines and cosines.
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-alg.el.gz
;;; Rewrite the trig functions in a form easier to simplify.
(defun math-trig-rewrite (fn)
"Rewrite trigonometric functions in terms of sines and cosines."
(cond
((not (consp fn))
fn)
((eq (car-safe fn) 'calcFunc-sec)
(list '/ 1 (cons 'calcFunc-cos (math-trig-rewrite (cdr fn)))))
((eq (car-safe fn) 'calcFunc-csc)
(list '/ 1 (cons 'calcFunc-sin (math-trig-rewrite (cdr fn)))))
((eq (car-safe fn) 'calcFunc-tan)
(let ((newfn (math-trig-rewrite (cdr fn))))
(list '/ (cons 'calcFunc-sin newfn)
(cons 'calcFunc-cos newfn))))
((eq (car-safe fn) 'calcFunc-cot)
(let ((newfn (math-trig-rewrite (cdr fn))))
(list '/ (cons 'calcFunc-cos newfn)
(cons 'calcFunc-sin newfn))))
(t
(mapcar #'math-trig-rewrite fn))))