Re: Question : How to force ( Exp[I x]/2+Exp[-I x]/2=cos(x) ) ?

• To: mathgroup at smc.vnet.net
• Subject: [mg3403] Re: Question : How to force ( Exp[I x]/2+Exp[-I x]/2=cos(x) ) ?
• From: ianc (Ian Collier)
• Date: Mon, 4 Mar 1996 02:34:44 -0500
• Organization: Wolfram Research, Inc.
• Sender: owner-wri-mathgroup at wolfram.com

```In article <4hbgms\$4uu at dragonfly.wolfram.com>, yjtsai at leland.Stanford.EDU
(Yeou-Jyh Tsai) wrote:

> Hello,
>
>         I use Mathematica's MatrixExp to generate the symbolic form of
> a matrix's exponential. It gives me lots of
>           I x     -I x          -I x      I x
>          E      E            I E        IE
>         ---   + ------ and  -------- - -----
>          2         2            2        2
> which should be converted to Cos[x] and Sin[x], respectively. Does anyone
> know how to do this ?
>
> Thanks a lot!
>
> Yeou-Jyh Tsai
> tsai at relgyro.stanford.edu

You can use the function ComplexToTrig, which is defined in
Algebra`Trigonometry`one of the standard packages distributed
with Mathematica. For example:

In[1]:=
Needs[ "Algebra`Trigonometry`" ]

In[2]:=
ComplexToTrig[ Exp[I x]/2+Exp[-I x]/2 ]

Out[2]=
Cos[x] - I Sin[x]   Cos[x] + I Sin[x]
----------------- + -----------------
2                   2

In[3]:=
Together[ % ]
Out[3]=
Cos[x]

I hope this helps.

--Ian

-----------------------------------------------------------
Ian Collier
Wolfram Research, Inc.
-----------------------------------------------------------
tel:(217)-398-0700   fax:(217)-398-0747    ianc at wolfram.com