Convert imaginary exponentials into sine and cosine

19 views
Skip to first unread message

Laurent

unread,
Jul 4, 2009, 11:20:42 AM7/4/09
to sage-support
Hello all

When computing an exponential of matrix, I get complicate expressions,
for example :

var('x')
A=matrix( [ [0,1],[-1,0] ] )
(x*A).exp()

produces a matrix of things like :

1/2*(e^(2*I*x) + 1)*e^(-I*x)

Of course, that is equal to cos(x), as expected.

My question is : how to make Sage produce an output under a real form,
i.e. using cos(x) and sin(x) instead of combinations of imaginary
exponentials ?

I already tried to add this :
assume(imag_part(x)==0)

Any ideas ?

Thanks and have a good WE
Laurent

Reply all
Reply to author
Forward
0 new messages