Another rewriting question (with exp(%i*%pi*n))



On Thu, May 23, 2013 at 7:31 AM, Rupert Swarbrick <rswarbrick at gmail.com>wrote:

>  exp(%i*n*2*%pi + %i*%pi*x)


The %emode simplifications are pretty simple-minded, it seems.  In
particular, ex: exp(2*n*%pi*%i), where n is declared integer, doesn't
simplify, though its rectform does.

Here's one simple trick that might help:

declare(n,integer)$
ex: exp(%i*n*2*%pi + %i*%pi*x)$
subst(xj=x/%i,ratsimp(exponentialize(subst(x=xj*%i,demoivre(ex)))));


The ratsimp may (or may not) change the form of your expression in ways you
don't want, though.

                -s