> (DEFUN SINH^N (%N V)
> (M* (m^ -1 (// %n 2))
> (SC^N %N V (COND ((ODDP %N) '(%SINH))
> ('(%COSH)))
> (NOT (ODDP %N))
> (M^ -1 (M+ (// %N 2) 'K)))))
>
> For odd n this is still more complicated than necessary, though.
Here is a somewhat simplified version:
(defun sinh^n (%n v)
(if (oddp %n)
(sc^n %n v '(%sinh) nil (m^ -1 'k))
(let ((w (if (zerop (mod %n 4)) 1 -1)))
(m* w (sc^n %n v '(%cosh) t (m* w (m^ -1 'k)))))))
I don't simplify the (m^ -1 'k) stuff because
1) SIMPEXPT does a reasonable job at it
2) I think the sum in SC^N should be rewritten in a more Horner like
way (or does DOSUM perform such an optimization?), in which case
the (m^ -1 'k) won't matter.
Objections to committing it?
Wolfgang