sage: n = var('n')
sage: assume(n, 'integer')
sage: exp(I*n*pi).simplify_exp()
e^(I*pi*n)
Is there a way to get Sage/Maxima to turn that into cos(n*x)? It seems
like the integer assumption isn't filtering through.
Dan
--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------
sage: n = var('n')
> sage: assume(n, 'integer')
> sage: exp(I*n*pi).simplify_exp()
> e^(I*pi*n)
This workaround works :
sage: n = var('n')
sage: assume(n, 'integer')
sage: A=exp(I*n*pi)
sage: Abis=A.real_part()+I*A.imag_part() <--- this is the stupid part !!
sage: Abis.simplify_trig()
(-1)^n
Have a nice day
Laurent
That's a nice tip. I found a way to access rectform() "directly":
sage: A = exp(I*pi*n)
sage: A.maxima_methods().rectform()
(-1)^n
That's good enough for what I need. Thanks!