The problem is the log(exp(I*omega*t_r/2))
term. SymPy is not reducing this to I*omega*t_r/2
. SymPy doesn't simplify this because in general, log(exp(x)) != x
, but rather log(exp(x)) = x + 2*pi*I*n
for some integer n
. But in this case, if you replace log(exp(I*omega*t_r/2))
with omega*t_r/2
or omega*t_r/2 + 2*pi*I*n
, it will be the same, because it will just add a 2*pi*I*n
inside the sin
.
I couldn't figure out any functions that force this simplification, but the easiest way is to just do a substitution:
In [18]: print(simplify(f.subs(t,sln[1]).subs(log(exp(I*omega*t_r/2)), I*omega*t_r/2)))
p0*(omega*t_r - 2*sin(omega*t_r/2))/(omega**2*t_r)
That looks like the answer you are looking for, except for the absolute value (I'm not sure where they should come from).