I'm trying to get mathematicas series function for Sin[x]
to output a result that look like this:
$\sin x=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n+1) !} x^{2 n+1}$
I referred to ybeltukov's answer and used his code. https://mathematica.stackexchange.com/a/71593/69835
Clear["Global`*"];
series[expr_, x_, x0_] :=
Defer[expr = Sum[#, {n, 0, \[Infinity]}]] &[
FullSimplify@
SeriesCoefficient[expr, {x, x0, n},
Assumptions -> {n >= 0}] (x - x0)^n]
series[Sin[x], x, 0]
$\operatorname{Sin}[x]=\sum_{n=0}^{\infty} \frac{i i^{n}\left(-1+(-1)^{n}\right) x^{n}}{2 n !}$
However, the result contains some complex numbers.
How to get the result in real number form
$\sin x=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n+1) !} x^{2 n+1}$ ?