Coefficient2
Coefficient2[exp, form1, form2, ...]
is like Coefficient, but it also allows to extracts coefficients of form1, form2, ...
sequentially. To specify the power in formi
, write it as {var,pow}
.
To keep the prefactor whose coefficient you extracted you need to set the option Prefactor
to True
.
See also
Overview, Cases2.
Examples
ex = y0 + ep y1 + a4 (1/ep x1 + x2 + x3 ep) + a4^2 (1/ep^2 z1 + 1/ep z2 + z3 + x4 ep)
a42(ep2z1+epx4+epz2+z3)+a4(epx1+epx3+x2)+epy1+y0
epx1+epx3+x2
ep2z1+epx4+epz2+z3
Coefficient2[ex, {a4, 2}]
ep2z1+epx4+epz2+z3
Coefficient2[ex, {a4, 2}, {ep, -1}]
z2
Coefficient2[ex, {a4, 2}, ep]
x4
Coefficient2[ex, a4, 2, ep]
x4
Coefficient2[ex, {a4, 1}, {ep, 0}]
x2
x3
Coefficient2[ex, {a4, 1}, {ep, 0}, Prefactor -> True]
a4x2