0
$\begingroup$

As the title suggests, I am interested in how to perform multiple collection of terms. This means that for a given expression a*x*b + c*x^2*d+a*x*k, I want to collect first in powers of x and for each factor of of a power of x to collect again in terms of another variable. In the previous example this translates to (a(b+k))*x+c*d*x^2. Any ideas?

$\endgroup$
  • 1
    $\begingroup$ Doesn't Collect[expr, {x, a}] do what you want? $\endgroup$ – Carl Woll Mar 20 at 14:50
0
$\begingroup$

I actually solved it:

myexpression//Collect[#,{myoutermostparameters},Collect[#,{myinnermostparameters}]&]&

This gives the proper nested factorisation for any parameters needed.

$\endgroup$

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.