MathGroup Archive 2002

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

Search the Archive

MonomialQ

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33542] MonomialQ
  • From: Detlef Mueller <dmueller at mathematik.uni-kassel.de>
  • Date: Fri, 29 Mar 2002 06:13:46 -0500 (EST)
  • Organization: University of Kassel - Germany
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

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,..vn.
(this is sometimes called "term").

Similar to the build in Function PolynomialQ.

Say 

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
MonomialQ[(a+b)(a+c)-(a^2+bc),{a}]->True

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*...an^kn, a1,..an Symbols or Constants, 
k1..kn non negative integers?

Greetings,
  Detlef


  • 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