Given a function #f(x)#, its Maclaurin series will be as follows:
#f(x) = f(0) + f'(0)x + f''(0)x^2/(2!) + f'''(0)x^3/(3!) + ...#
In order to find the Maclaurin series, we have to calculate the coefficients #a_n = f^((n))(0)/(n!)# and #f(0)#.
i) Calculating f(0)
#f(0) = e^0cos(0) = 1#.
ii) #a_n# coefficients
First derivative
#f^((1))(x) = 3e^(3x)cosx - e^(3x)sinx #.
#f^((1))(x) = e^(3x)(3cosx - sinx)#.
Then:
#a_1 = f^((1))(0)/(1!) = 3/(1!)#.
We proceed to calculate the next derivatives.
#f^((2))(x) = 3e^(3x)(3cosx - sinx) - e^(3x)(3sinx + cosx)#;
#f^((2))(x) = e^(3x)(9cosx - 3sinx - 3sinx - cosx)#;
#f^((2))(x) = e^(3x)(8cosx - 6 sinx)#;
#f^((2))(x) = 2e^(3x)(4cosx - 3sinx)#.
Then:
#a_2 = f^((2))(0)/(2!) = 8/(2!)#.
Third derivative.
#f^((3))(x) = 6e^(3x)(4cosx - 3sinx) - 2e^(3x)(4sinx + 3cosx)#;
#f^((3))(x) = 2e^(3x)(12cosx - 9sinx - 4sinx - 3cosx)#;
#f^((3))(x) = 2e^(3x)(9cosx - 13sinx)#.
Then:
#a_3 = f^((3))(0)/(3!) = 18/(3!)#.
Fourth derivative.
#f^((4))(x) = 6e^(3x)(9cosx - 13sinx) - 2e^(3x)(9sinx + 13cosx)#;
#f^((4))(x) = 2e^(3x)(27cosx - 39sinx - 9sinx - 13cosx)#;
#f^((4))(x) = 2e^(3x)(15cosx - 48sinx)#;
#f^((4))(x) = 6e^(3x)(5cosx - 16sinx)#.
Then:
#a_4 = f^((4))(0)/(4!) = 30/(4!)#.
Writting our series:
#f(x) = 1 + 3/(1!)x + 8/(2!)x^2 + 18/(3!)x^3 + 30/(4!)x^4 + ...#
I am sorry, but I was not able to identify a clear pattern to write it as a general sum. But I hope I could help you somehow, anyway!
By the way, you could continue this calculation until the order you want.