MAPLE- Developed in a Fourier Basis - Simplifying commands

37 Views Asked by At

After a succession of simplifying commands, I am trying to have a truncated serie Fourier of the expression T3. I get this kind of result T33 :

[1] : http://s15.postimg.org/kf2sjvpff/Screen_Shot_2014_12_21_at_14_41_53.png "result"

I would like to know how I can developed T33 in a basis of the form : $(cos(ul_1+vl_2),sin(kl_1+pl_2))_{u,v,k,p}$. I don't want to have some omega, Omega in the sinus or cosinus arguments (I want to "split" each sinus, cosinus functions of T33)

Besides if you have any comment about my code, please tell me ;)

I am very grateful for your help

1

There are 1 best solutions below

0
On

One way to go about this is via judicious calls to the frontend command.

In the first call to frontend below, explicitly mentioned subexpressions identical in type to cos(l[1]), sin(l[2], etc, are not frozen and so combine. And also in the first call, other terms such as those containing omega and Omega, are frozen and so don't combine.

In the second call to frontend below, I switch the roles of l[1], l[2] and omega[2], Omega[1], etc.

The first frontend call acts on the expanded version of T, in which all the sin & cos function calls have been expand, leaving just those call on individual names, so that the respective freezing (or not) can be leveraged.

T := cos( -l[1] -2*omega[2] +2*Omega[1] -l[2] )
     + sin( -l[1] -2*omega[2] +2*Omega[1] -2*l[2] ):

eT := expand(T):

newT := frontend(combine,[eT],
                 [{`+`,`*`,
                   specfunc({l[1],l[2]},
                            {cos,sin})},
                  {}]):

newesT := frontend(combine,[newT],
                   [{`+`,`*`,
                     'specfunc'({omega[1],omega[2],
                                 Omega[1],Omega[2]},
                                {cos,sin})},
                    {}]):

newesT;

        cos(l[1] + l[2]) cos(2 Omega[1] - 2 omega[2])

           + sin(l[1] + l[2]) sin(2 Omega[1] - 2 omega[2])

           - sin(2 l[2] + l[1]) cos(2 Omega[1] - 2 omega[2])

           + cos(2 l[2] + l[1]) sin(2 Omega[1] - 2 omega[2])

There are other ways to get similar effects. I wouldn't be surprised if applyrule might also be able to get there, with some ingenious rule. Or you could freeze and thaw terms explicitly, rather than try and juggle that via frontend.

By the way, it's very awkward to have to type in your code, based upon an image. Your code is just plaintext 1D Maple Notation, so you could have inserted it directly here (4 spaces indentation to get a code block). And you forgot to provide the values for some of the names used in your code (you could have first lprinted them in Maple). Hence I have to cook up what I hope is a helpful example for you.