Skip to main content
1 of 2

Selecting only the quartic terms from an expession

I am trying to create a function that returns a list with every quartic term (in total, meaning that \[CapitalPhi]1^2 * \[CapitalPhi]2 ^2 would count).

what I have is :

    QuarticTerms[potential_, fields_] := 
  Module[{quarticTerms}, 
   quarticTerms = 
    Select[List @@ Expand[potential], 
     Total[Exponent[#, fields]] == 4 &];
   Return[quarticTerms];];

and the expression I am using is:

potential = 
  m11^2  Abs[\[CapitalPhi]1]^2 + m22^2  Abs[\[CapitalPhi]2]^2 - 
   m12^2  (Conjugate[\[CapitalPhi]1]  \[CapitalPhi]2 + 
      Conjugate[\[CapitalPhi]2]  \[CapitalPhi]1) + 
   1/2  \[Lambda]1  Abs[\[CapitalPhi]1]^4 + 
   1/2  \[Lambda]2  Abs[\[CapitalPhi]2]^4 + \[Lambda]3  Abs[\
\[CapitalPhi]1]^2  Abs[\[CapitalPhi]2]^2 + \[Lambda]4  Abs[\
\[CapitalPhi]1*\[CapitalPhi]2]^2 + 
   1/2  \[Lambda]5  ((Conjugate[\[CapitalPhi]1]  \[CapitalPhi]2)^2 + \
(Conjugate[\[CapitalPhi]2]  \[CapitalPhi]1)^2) + 
   1/2  mS^2  Abs[\[CapitalPhi]S]^2 + 
   1/8  \[Lambda]6  Abs[\[CapitalPhi]S]^4 + 
   1/2  \[Lambda]7  Abs[\[CapitalPhi]1]^2  Abs[\[CapitalPhi]S]^2 + 
   1/2  \[Lambda]8  Abs[\[CapitalPhi]2]^2  Abs[\[CapitalPhi]S]^2;

It always returns an empty list. Is the function poorly defined or is it due to the complexity of the expression?