For example a vector:
vec={l (Cos[φ1[t]] + Cos[φ2[t]] +
Cos[φ3[t]] + Cos[φ4[t]] +
Cos[φ5[t]] + Cos[φ6[t]] +
Cos[φ7[t]] + Cos[φ8[t]] +
1/2 Cos[φ9[t]]),
l (-Sin[φ1[t]] - Sin[φ2[t]] -
Sin[φ3[t]] - Sin[φ4[t]] -
Sin[φ5[t]] + Sin[φ6[t]] +
Sin[φ7[t]] + Sin[φ8[t]] +
1/2 Sin[φ9[t]])}
And I want to use Taylor Expansion on ALL Cos
and Sin
terms (up to first order). So I want to use something like Series[Cos[x],{x,1}]
but I don't want to write that for every variable, because there can be $n$ variables where $n$ is defined by the user.
So is there a more compact and faster way or do I really have to Taylor expand one term at once for all of them?
vec /. {(a : Cos | Sin)[x_] :> Normal@Series[a[x], {x, 0, 1}]}
. (I assumed you wanted to expand about0
in each case, but if not, change the0
to something else.) $\endgroup$t=0
? If so, could just doSeries[vec, {t, 0, 2}]
. $\endgroup$