Prev: Using "If" and "NDSolve" together
Next: DynamicModule not saving reliably a variable between sessions
From: Leonid Shifrin on 24 Jan 2010 05:39 Here is a 2-step process which does it: In[1]:= Clear[n, x, step1, step2]; In[2]:= step1 = FullSimplify[ComplexExpand[(Cos[x] + I*Sin[x])^n], Assumptions -> {Element[n, Integers], Element[x, Reals]}] Out[2]= Cos[n Arg[E^(I x)]] + Sinh[n Log[E^(I x)]] In[3]:= step2 = step1 /. {Arg[Exp[I*x_]] :> x, Log[Exp[I*x_]] :> I*x } Out[3]= Cos[n x] + I Sin[n x] The second step is manual and is correct under an assumption that -Pi<x<=Pi, which we can safely take given that the original function is periodic. Perhaps there are shorter and completely automatic ways based only on built-in rules but I did not find them. Regards, Leonid On Sat, Jan 23, 2010 at 4:36 AM, Arnold <sender999ster(a)gmail.com> wrote: > How by means of Mathematica to transform (Cos [x] +I* Sin [x]) ^n in Cos > [n*x] +I*Sin [n*x]? > > Thanks. > >
From: Peter Breitfeld on 24 Jan 2010 05:42 Arnold wrote: > How by means of Mathematica to transform (Cos [x] +I* Sin [x]) ^n in > Cos [n*x] +I*Sin [n*x]? > > Thanks. > (Cos[x] + I*Sin[x])^n // FullSimplify // PowerExpand // ExpToTrig -- _________________________________________________________________ Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
From: David Park on 24 Jan 2010 05:45 Doing it in steps: (Cos[x] + I*Sin[x])^n; % // TrigToExp Simplify[%, n \[Element] Integers] % // ExpToTrig (1/2 (-E^(-I x) + E^(I x)) + 1/2 (E^(-I x) + E^(I x)))^n E^(I n x) Cos[n x] + I Sin[n x] David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: Arnold [mailto:sender999ster(a)gmail.com] How by means of Mathematica to transform (Cos [x] +I* Sin [x]) ^n in Cos [n*x] +I*Sin [n*x]? Thanks.
From: Bob Hanlon on 24 Jan 2010 05:43 expr = (Cos[x] + I*Sin[x])^n; expr // FullSimplify // PowerExpand // ExpToTrig Cos[n*x] + I*Sin[n*x] FullSimplify[expr, Element[n, Integers]] // ExpToTrig Cos[n*x] + I*Sin[n*x] Bob Hanlon ---- Arnold <sender999ster(a)gmail.com> wrote: ============= How by means of Mathematica to transform (Cos [x] +I* Sin [x]) ^n in Cos [n*x] +I*Sin [n*x]? Thanks.
From: Andrzej Kozlowski on 25 Jan 2010 05:08 On 24 Jan 2010, at 11:39, Sjoerd C. de Vries wrote: > Hi Arnold, > > ExpToTrig[PowerExpand[FullSimplify[(Cos[x] + I*Sin[x])^n]]] > > but this is actually only true for n integer OR x positive reals. Actually, it's true for any n (so all those assumptions Element[n,Integers] various people have posted are not needed). For example: FullSimplify[ ComplexExpand[(Cos[x] + I*Sin[x])^(3/2), TargetFunctions -> {Re, Im, Abs}], -Pi < x <= Pi] // ExpToTrig cos((3 x)/2)+I sin((3 x)/2) Is quite correct as is FullSimplify[ ComplexExpand[(Cos[x] + I*Sin[x])^(I), TargetFunctions -> {Re, Im, Abs}], -Pi < x <= Pi] // ExpToTrig cosh(x)-sinh(x) In full generality: FullSimplify[ ComplexExpand[(Cos[x] + I*Sin[x])^n, TargetFunctions -> {Re, Im, Abs}], -Pi < x <= Pi] // ExpToTrig cos(n x)+I sin(n x) Andrzej Kozlowski > > Cheers -- Sjoed > > On Jan 23, 2:35 pm, Arnold <sender999s...(a)gmail.com> wrote: >> How by means of Mathematica to transform (Cos [x] +I* Sin [x]) ^n in Cos[n*x] +I*Sin [n*x]? >> >> Thanks. > >
First
|
Prev
|
Pages: 1 2 Prev: Using "If" and "NDSolve" together Next: DynamicModule not saving reliably a variable between sessions |