A question on exponentialize and demoivre



Dear Stavros,

Many thanks for your prompt reply and advice. Excellent idea!
Now my ode is being solved in terms of the hyperbolic cosine
and sine functions:

(C1) ode : 'diff(x,t,2)-x = 0$
(C2) subst(t=t/%i,demoivre(subst(t=%i*t,ode2(ode,x,t)))), ratsimp;
(D2)    x = (%K1 - %K2) SINH(t) + (%K2 + %K1) COSH(t)

and this result is completely satisfactory for me.

Many sincere thanks again and best regards,

Nikos

----- Original Message ----- 
> --- "Stavros Macrakis" <stavros.macrakis@verizon.net> wrote:


> > What should I do, please, for the transformation of an expression
> > containing exponentials to hyperbolic sines and cosines?
> ...
> > I would prefer to use an existing Maxima command (such
> > as demoivre) avoiding to prepare my own simplification
> > rules for the second case (that finally leading to hyperbolic
> > functions).
> 
> The simplest way to do this is probably with a change of variable from
> x->%i*x, then demoivre, then the reverse transformation.  This even
> catches cases where the hyperbolic functions are not completely obvious,
> e.g.:
> 
>                                 2 x           - 2 x
>                               %E        x   %E        1
> (D13)                         ----- - %E  + ------- + -
>                                 4              4      2
> 
> (C14) subst(%i*x,x,%);
>                            2 %I x              - 2 %I x
>                          %E           %I x   %E           1
> (D14)                    -------- - %E     + ---------- + -
>                             4                    4        2
> 
> (C15) demoivre(%);
> 
>       %I SIN(2 x) + COS(2 x)   COS(2 x) - %I SIN(2 x)
> 1
> (D15) ---------------------- + ---------------------- - %I SIN(x) -
> COS(x) + -
>                 4                        4
> 2
> 
> (C16) subst(x/%i,x,%);
> 
>         SINH(2 x) + COSH(2 x)   COSH(2 x) - SINH(2 x)
> 1
> (D16)   --------------------- + --------------------- - SINH(x) -
> COSH(x) + -
>                   4                       4
> 2
> ...
> 
> (C19) ratsimp(d16);
>                         COSH(2 x) - 2 SINH(x) - 2 COSH(x) + 1
> (D19)                   -------------------------------------
>                                           2