2
$\begingroup$

I have the following expression

a + b + c + x + y + z + r*E^m + s/E^m + t*E^n + u/E^n

I want to extract the coefficients of exponential terms as well as the constants as a whole.

My output should be something like

{a + b + c + x + y + z,r,s,t,u}

I tried with

Coefficient[a + b + c + x + y + z + r*E^m + s/E^m + t*E^n + u/E^n,{E^m,E^-m,E^n,E^-n}]

But it only gave

{r, s, t, u}
$\endgroup$
3
$\begingroup$

Straight from the documentation:

Coefficient[expr,form,0] picks out terms that are not proportional to form.

Coefficient[a + b + c + x + y + z + r*E^m + s/E^m + t*E^n + u/E^n,E,{0,m,-m,n,-n}] // Print
(* {a + b + c + x + y + z, r, s, t, u} *)

Try it online!

$\endgroup$
  • $\begingroup$ Thanks. It has worked. $\endgroup$ – Soumyajit Roy Jun 29 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.