MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Trig Simplifications

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3710] Re: Trig Simplifications
  • From: Harald Berndt <haraldb at nature.berkeley.edu>
  • Date: Wed, 10 Apr 1996 02:11:54 -0400
  • Organization: University of California Forest Prodcts Lab
  • Sender: owner-wri-mathgroup at wolfram.com

Alexander Casti wrote:
> 
> Basically my question is how to get mathematica to write
> 
> Exp[I x] in place of Cos[x] + I Sin[x]
> 
> Suppose I have the expression
> 
> In[1]: f[x_]= Cos[x] + I Sin[x] - Cos[2 X] + I Sin[2 X]
> 
> I would like mathematica to simplify this into
> 
> f[x_]= Exp[I X] - Exp[2 I X]
> 
> I tried the substitution command
> 
> In[2]: % ./ Cos[X]+I Sin[X]-> Exp[I X] and it returned
> Out[2]: E^{I X}  - Cos[2 X] + I Sin[2 X]
> 
I believe you don't really want what you've written out, because:
Cos[x] + I Sin[x] - Cos[2 X] + I Sin[2 X] == Exp[I X] - Exp[- 2 I X].

That sign error is one part of the problem: one needs two replacement 
rules,

	Cos[t_]+I Sin[t_]-> Exp[I t]

and

	Cos[t_]-I Sin[t_]-> Exp[-I t].

Using Pattern[t, Blank[]] (the t_) will take care of the different 
variable names x and 2 X, but there are still two substitutions 
required. One needs to use ReplaceRepeated[] (//.).

Cos[x] + I Sin[x] + Cos[2 X] + I Sin[2 X]//.Cos[t_]+I Sin[t_]-> Exp[
I t]

will work and so will

Cos[x] + I Sin[x] - Cos[2 X] + I Sin[2 X]//.{Cos[t__]+I Sin[t__]-> 
Exp[I t], -(Cos[t_]-I Sin[t_])-> -Exp[- I t]}

This still seems clumsy and I hope someone will suggest a more 
efficient way of writing this.
-- 
______________________________________________________________________
Harald Berndt,                                University of California
Research Specialist                         Forest Products Laboratory

Phone:	510-215-4224                                FAX:			510-215-4299

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: MathLink and C++ (can mathlink handle C++?)
  • Next by Date: patterns
  • Previous by thread: Re: Trig Simplifications
  • Next by thread: ReadList Expression: (Q)