MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive


  • To: mathgroup at
  • Subject: [mg33542] MonomialQ
  • From: Detlef Mueller <dmueller at>
  • Date: Fri, 29 Mar 2002 06:13:46 -0500 (EST)
  • Organization: University of Kassel - Germany
  • Sender: owner-wri-mathgroup at


I want to test, wether an expression is a Monomial 
with respect to a List of Variables.
Here a Monomial is defined as some coefficient 
multiplied by a product of powers of the 
Variables: c*v1^p1*... vn^pn, 
where c must not depend on any of v1,
(this is sometimes called "term").

Similar to the build in Function PolynomialQ.


MonomialQ[(a b)^3/(b c),{a,b}] -> True
MonomialQ[(a b)^3/(b c),{a,c}] -> False
MonomialQ[(a b)^3/(b c)-c,{a,b}] -> False
MonomialQ[(a+b)(a+c),{a}] -> False

My current Implementation is

MonomialQ[a_,L_List] :=    
    PolynomialQ[a, L] &&               (* must be Polynomial and *)
      Head[Expand[a, x_ /; MemberQ[L, x]]] =!= Plus; 

Maybe, there is no better way, but I wonder, if
the Expand with Pattern is a good Idea here.

Since in most Cases "a" _is_ in fact a Monomial
in simple power-product-form, and since this is 
an often used Function, using "Expand" might be 
nearly every time an Overkill.

Maybe there is a quick "pretest", checking
for the "simple power-product-form"
a = a1^k1*^kn, a1, Symbols or Constants, non negative integers?


  • Prev by Date: Mathlink formulas return different results
  • Next by Date: Automatic restart
  • Previous by thread: Mathlink formulas return different results
  • Next by thread: Re: MonomialQ