Let #f(x) = e^x cos(x)#

Successive derivatives look like this:

#{:(f^((0))(x) = e^x cos x, f^((0))(0) = color(blue)(1)),
(f^((1))(x) = e^x (cos x - sin x), f^((1))(0) = color(blue)(1)),
(f^((2))(x) = -2e^x sin x, f^((2))(0) = color(blue)(0)),
(f^((3))(x) = -2e^x(cos x + sin x), f^((3))(0) = color(blue)(-2)),
(f^((4))(x) = -4e^x cos x, f^((4))(0) = -4),
(f^((5))(x) = -4e^x(cos x - sin x), f^((5))(0) = -4),
(f^((6))(x) = 8e^x sin x, f^((6))(0) = 0),
(f^((7))(x) = 8e^x(cos x + sin x), f^((7))(0) = 8):}#

So we have a pattern that repeats every #4# derivatives, but multiplied by a factor of #-4# each time.

The general formula for a Taylor series at #0# is:

#f(x) = sum_(n=0)^oo f^((n))(0)/(n!) x^n#

In our case, capture the recurring pattern as follows:

#f(x) = sum_(k=0)^oo (-4)^k(x^(4k)/((4k)!) + x^(4k+1)/((4k+1)!) -(2x^(4k+3))/((4k+3)!) )#