ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 24 Jul 2016 09:06:51 -0500Changing order of factors affects sympy expansionhttp://ask.sagemath.org/question/34204/changing-order-of-factors-affects-sympy-expansion/there is a strange behaviour when using sympy inside sage:
from sympy import Symbol, exp, I
import sympy
x = Symbol("x", real=True)
then, asking for ```exp(I*8*x).expand(complex=True)``` I get
I*sin(8*x) + cos(8*x)
that's ok. however, asking for ```exp(8*I*x).expand(complex=True)```, I get
I*exp(-8*im(x))*sin(8*re(x)) + exp(-8*im(x))*cos(8*re(x))
Why in the second case it forgets that $x$ is real? Is this behaviour expected?
this was causing me real trouble in another context, since I was calling functions from a package that itself uses sympy, and they didn't work unless some special ordering of the arguments was given.
I'm on SMC with sagemath kernel 6.10. I've checked in [Live SymPy](http://live.sympy.org/), the 1st result is obtained in both cases.
mforetsSun, 24 Jul 2016 09:06:51 -0500http://ask.sagemath.org/question/34204/