I have a table as

{0, 1/4 (Cos[(3 t)/4] – Cos[(5 t)/4] +

I (-Sin[(3 t)/4] – Sin[(5 t)/4])),

1/4 (Cos[(3 t)/4] – Cos[(5 t)/4] +

I (-Sin[(3 t)/4] – Sin[(5 t)/4])), 0,

1/4 (Cos[(3 t)/4] – Cos[(5 t)/4] +

I (-Sin[(3 t)/4] – Sin[(5 t)/4])), 0, 0, 0,

1/4 (Cos[(3 t)/4] + 3 Cos[(5 t)/4] +

I (-Sin[(3 t)/4] + 3 Sin[(5 t)/4]))}

The desire shape of this table will be as bellow, (of course, I created that manually)

=================

1

Look up TrigToExp[].

– J. M.♦

Jul 18 ’15 at 13:07

1

In this very speicifc case, you can do TrigToExp[4 #]/4 & /@ your data. But how to make that constant multiplication term move automatically?

– kirma

Jul 18 ’15 at 13:10

@kirma, I could not understand your question, but your code was very useful, even to factorize the multiplication factor (1/4) of all terms.

– Irreversible

Jul 18 ’15 at 13:23

3

@kirma, that’s where FactorTerms[] ought to be useful.

– J. M.♦

Jul 18 ’15 at 13:28

1

So to put my and @Guesswhoitis. ‘s answers together, you want to first apply TrigToExp on your data, then FactorTerms (both of these thread over lists automatically).

– kirma

Jul 18 ’15 at 14:59

=================

1 Answer

1

=================

Collecting together the advice given in comments to the question by kirma and Guesswhoitis, the answer is

expr =

{0, 1/4 (Cos[(3 t)/4] – Cos[(5 t)/4] + I (-Sin[(3 t)/4] – Sin[(5 t)/4])),

1/4 (Cos[(3 t)/4] – Cos[(5 t)/4] + I (-Sin[(3 t)/4] – Sin[(5 t)/4])), 0,

1/4 (Cos[(3 t)/4] – Cos[(5 t)/4] + I (-Sin[(3 t)/4] – Sin[(5 t)/4])), 0, 0, 0,

1/4 (Cos[(3 t)/4] + 3 Cos[(5 t)/4] + I (-Sin[(3 t)/4] + 3 Sin[(5 t)/4]))};

FactorTerms[TrigToExp[expr]]