# Question:how to prevent Maple from auto re-write of complex exponentials?

## Question:how to prevent Maple from auto re-write of complex exponentials?

I have this (which finds each Fourier term of a sequence)

term := proc(lst,k::integer)
local n;
n := nops(lst);
seq(lst[m+1]*exp(-I * 2*Pi/n *(k*m)),m=0..n-1);
end proc;

Now I call it as

term([1,2,3],1);

and it returns

So it evaluated and convert the exp(-I * 2*Pi/n *(k*m)) terms. I wanted to keep these as is, so I can compare result with textbook. Then do simplify if I wanted to above output.

I can do that if I use small pi instead of large Pi, like this

term := proc(lst,k::integer)
local n;
n := nops(lst);
seq(lst[m+1]*exp(-I * 2*pi/n *(k*m)),m=0..n-1);
end proc;

and now r:=term([1,2,3],1); return

Which is what I wanted, but with Pi instead of pi.  now how would I evaluate the above?

I tried to use subs to replace small pi with large Pi, but it does not work

subs(pi=Pi,r); #error

Then I tried eval, which worked

eval(r,pi=Pi);

So, I can use the above method.

My question is: Is the above a common way to handle such case? Is there another way to use Pi but at the same time prevent Maple from automatic simplification of the exp() terms?

﻿