# Re: exponential rule application

```John Albert Horst wrote:
>
> I'm trying to compute the following exponential of a matrix with
> elements that are constants:
>
> A={{0,1},{-1,0}};
> MatrixExp[A*t]
>
> The answer can be shown to be {{Cos[t], Sin[t]},{-Sin[t],Cos[t]}} by
> using the definition of the matrix exponential and expanding a few
> terms in the series.  However, MatrixExp[A*t]//Simplify returns the
> following expression:
>
> {{(1/2*(1 + E^(2*I*t)))/E^(-(-I*t)),
>    (-(1/2)*I*(-1 + E^(2*I*t)))/E^(-(-I*t))},
>   {(1/2*I*(-1 + E^(2*I*t)))/E^(-(-I*t)),
>    (1/2*(1 + E^(2*I*t)))/E^(-(-I*t))}}
>
> Clearly, we need to apply the simple rule that
>
> complexExpRule=Exp[a_*I*theta_]->Cos[a*theta]+I*Sin[a*theta]
>
> However, I can't seem to make this rule simplify the output of
> MatrixExp[A*t].  For example, the following simple expression,
> Exp[2*I*t]/.complexExpRule, returns, Exp[2*I*t], instead of,
> Cos[2*t]+I*Sin[2*t].  Curiously, Exp[r*I*t]/.complexExpRule, returns,
> Cos[r*t]+I*Sin[r*t], as we would hope.

John:

In[1]:=
FullForm[2*I*t ]

Out[1]//FullForm=
Times[Complex[0,2],t]

So maybe

In[2]:=
complexExpRule=Exp[Complex[0,a_]*theta_]->Cos[a*theta]+I*Sin[a*theta];

In[3]:=
Exp[2*I*t]/.complexExpRule

Out[3]=
Cos[2 t]+I Sin[2 t]

OK
Now for the matrix

In[4]:=
M={{(1/2*(1 + E^(2*I*t)))/E^(-(-I*t)),
(-(1/2)*I*(-1 + E^(2*I*t)))/E^(-(-I*t))},
{(1/2*I*(-1 + E^(2*I*t)))/E^(-(-I*t)),
(1/2*(1 + E^(2*I*t)))/E^(-(-I*t))}};

In[5]:=
Simplify[M/.complexExpRule]

Out[5]=
{{Cos[t],Sin[t]},{-Sin[t],Cos[t]}}

In[6]:=
Simplify[ExpToTrig[M]]

Out[6]=
{{Cos[t],Sin[t]},{-Sin[t],Cos[t]}}

In[7]:=
Simplify[ComplexExpand[M]]

Out[7]=
{{Cos[t],Sin[t]},{-Sin[t],Cos[t]}}
--
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642

```

• Prev by Date: dummy indices / variables (was my own sum)
• Next by Date: Re: Question about Mathematica
• Prev by thread: Re: exponential rule application
• Next by thread: Re: TeXForm, OutputForm questions ?