Checking variables in an expression
- To: mathgroup at smc.vnet.net
- Subject: [mg112454] Checking variables in an expression
- From: Ignacio Plazeta <Ignacio.Plazeta at speednet.es>
- Date: Thu, 16 Sep 2010 05:58:57 -0400 (EDT)
Dear Friends
While having the lunch break I thought up this trick
that, may be, substantially solves (making use of Complement ...)
the problem I posed in my previous post.
Do you see any fault or improvement ? Thanks !
myChecker[myExp_] := Module [{tmp},
myF[myArg_] := Module [{tmp2},
tmp2 = {};
Scan[(AppendTo[tmp2, Apply[List, #]]) &, myArg];
tmp2 = Flatten[tmp2, Infinity] // Union;
Return[tmp2];
];
tmp = FixedPoint[myF, myExp];
tmp = Select[tmp, (Head[#] === Symbol) &];
Return[tmp];
]
myChecker[a + b]
myChecker[2 a^ 3 b]
Best Reagards
Ignacio