Checking variables in an expression

*To*: mathgroup at smc.vnet.net*Subject*: [mg112461] Checking variables in an expression*From*: Ignacio Plazeta <Ignacio.Plazeta at speednet.es>*Date*: Thu, 16 Sep 2010 06:00:15 -0400 (EDT)

Dear Friends I need a function myCheck[] returning the list of variable in expr not listed in vars. Es. -------------------------------------------------- expr = a + Cos[b] + c[t] - c'[t] + d ^ p - c; vars = {a , b , c, c[t] , c'[t] , d , p}; myCheck[ expr , vars ] {} because only variables in vars are in expr -------------------------------------------------- expr = a + Cos[b] + c[t] - c'[t] + d ^ p - c + w + w[t]; vars = {a , b , c, c[t] , c'[t] , d , p}; myCheck[ expr , vars ] {w , w[t]} because w and w[t] are in expr but not in vars -------------------------------------------------- I have tryed the childish: Remove[a, b, c, d, e, f, g, expr, vars] expr = a + b + c + d + e + f + g; vars = {a, b, c, d, e}; myRules = (Rule[#, ""]) & /@ vars res = expr //. myRules; but it dosn't work really fine because I don't know how to remove integers, Rational[""/""] etc. from res Any hints is greatly appreciated. Warmest regards. Ignacio