The demoivre function only looks for *complex* exponentials. If you want to
convert real exponentials to hyperbolic functions, there are two approaches
I can think of:
/* Use pattern matching */
(%i1) matchdeclare([any1],true)$
(%i2) defrule(hyperbolicize,%e^any1,sinh(any1)+cosh(any1))$
(%i3) apply1(exp(x),hyperbolicize);
(%o3) sinh(x)+cosh(x)
(%i4) applyb1(exp(x),hyperbolicize);
(%o4) (sinh(1)+cosh(1))^x -- correct but probably not what
you want
(%i5) apply2(exp(x),hyperbolicize);
(%o5) sinh(x)+cosh(x)
/* Take advantage of demoivre */
(%i1) hyperbolicize(ex,vars) :=
subst( map(lambda([q],q=-%i*q),vars),
demoivre( subst( map(lambda([q],q=%i*q),vars),
ex ) ) )$
(%i2) hyperbolicize(exp(x),[x]);
(%o2) sinh(x)+cosh(x)
You could of course simply use listofvars(ex) instead of having an explicit
vars argument, but:
(%i3) hyperbolicize(exp(x*p)+exp(p),[x]);
(%o3) sinh(p*x)+cosh(p*x)+%e^p
(%i4) hyperbolicize(exp(x*p)+exp(p),[p]);
(%o4) sinh(p*x)+cosh(p*x)+sinh(p)+cosh(p)
(%i5) hyperbolicize(exp(x*p)+exp(p),[x,p]);
(%o5) %e^(p*x)+sinh(p)+cosh(p)
On Sun, Apr 11, 2010 at 10:18, Raoul <raoulb at bluewin.ch> wrote:
> Hi all,
>
>
> This works fine:
>
> (%i10) exponentialize(cos(x));
> (%o10) (%e^(%i*x)+%e^-(%i*x))/2
>
> (%i11) demoivre(%);
> (%o11) cos(x)
>
> but this does not:
>
> (%i12) exponentialize(cosh(x));
> (%o12) (%e^x+%e^-x)/2
>
> (%i13) demoivre(%);
> (%o13) (%e^x+%e^-x)/2
>
> Is there a function that can do what demoivre does
> for trigonometric function?
>
>
> -- Raoul
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>