I have expression involving Cos of some parameters. I would like to replace those Cos by their infinite series each time they do appear.
I tried the following which doesn't work:
zz^2*Cos[3*zz + 8] + Cos[5 yy] /.
Cos[x_] -> Series[Cos[x_], {x, 0, Infinity}]
Indeed I read in the documentation that x_ should stand for any pattern that we decide to name x. I am not sure to understand why this code is not valid.
How can I replace the Cos here by their infinite series each time they do appear (my real problem contains longer expressions).
expr /. Cos[arg_] :> Series[Cos[arg], {zz, 0, Infinity}]
. (Note thatPattern
should not appear in the right-hand side of theRule
.) $\endgroup$Infinity
with a positive integer. $\endgroup$