Ask Your Question
1

Factoring expression involving exponentials

asked 2015-10-08 10:34:33 +0100

mforets gravatar image

I've got a complicated expression, which looks like: e(4ik+3iω+ip)−e(4ik+2iω+2ip)−e(4ik+2iω)+e(4ik+iω+ip)+2e(2ik+4iω+ip)−e(2ik+3iω+2ip)−e(2ik+3iω) + ...

How would you do to factor the exponentials with the same power of k, i.e. e(4ik)(...) + e(2ik)(...) and so on?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2015-10-11 22:46:40 +0100

mforets gravatar image

Using both ideas we can formulate a complete answer (assume that expr(k) is the expression in terms of phases in powers of k that we want to factor):

f1(k) = expr(-I*log(k)); f1
g1(k) = f1.canonicalize_radical(); g1
g1(k).coefficient(k,4)
edit flag offensive delete link more
1

answered 2015-10-10 23:54:33 +0100

updated 2015-10-10 23:56:57 +0100

Maybe by a change of variables:

sage: var('k,w,p')

sage: expr(k,w,p)=exp(4ik+3iw+ip)-exp(4ik+2iw+2ip)-exp(4ik+2iw)+exp(4ik+iw+ip)+2exp(2ik+4iw+ip)-
exp(2
ik+3iw+2ip)-exp(2ik+3i*w)

sage: f(k,w,p)=expr(log(k),log(w),log(p))

sage: g(k,w,p)=f.canonicalize_radical()

sage: g(exp(k),exp(w),exp(p)).factor()

edit flag offensive delete link more

Comments

This answer was useful, thanks. But at the end factor doesn't work as expected (it just leds to the original expression). We can use instead use the coefficient function to conclude.

mforets gravatar imagemforets ( 2015-10-11 22:42:31 +0100 )edit
1

answered 2015-10-08 16:21:53 +0100

fidbc gravatar image

I would probably try using the factor method.

sage: var('x,y,z')
(x, y, z)
sage: expr=exp(4*x-2*y+4*z)+exp(4*x-3*y+5*z)
sage: expr.factor()
(e^y + e^z)*e^(4*x - 3*y + 4*z)

Perhaps the manual will contain useful info on that as well.

edit flag offensive delete link more

Comments

Thanks, but you can see this doesn't do the job: the goal was to collect the terms in exp(4x), and so on (try adding for instance exp(2x-3y+5z) and factoring, it does something correct but is not what I need). I thought it'd be useful a previous step transforming the exp(2x) into z and exp(4x) into z^2, etc and then factoring, but I am not able to get the substitution done..

mforets gravatar imagemforets ( 2015-10-08 23:07:46 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-10-08 10:34:33 +0100

Seen: 700 times

Last updated: Oct 11 '15