       Re: Separating constants from nonconstants in an expression

• To: mathgroup at smc.vnet.net
• Subject: [mg52434] Re: [mg52423] Separating constants from nonconstants in an expression
• From: yehuda ben-shimol <benshimo at bgu.ac.il>
• Date: Sat, 27 Nov 2004 01:40:29 -0500 (EST)
• References: <200411261120.GAA05129@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```The simplest way I can think of (there are few ways to do that) is as
follows

expr := (4 Pi k1 x k2 y)/(12 k3 t k4 u)

Coefficient[expr/.{t->1/w,u->1/z},x y w z]

notice that neither
Coefficient[expr, x y /u /t ] nor
Coefficient[expr, x y /(u t)] work

Another way is
Fold[Coefficient,expr,{x,y,1/u,1/t}]

yehuda

Nicolas Girard wrote:

>Hi,
>given any expression like
>
>  expr := (4 Pi k1 x k2 y)/(12 k3 t k4 u)
>
>and knowing that k1...k4 are constants, how could I separate these terms
>from the non constant ones, i.e. ending up with
>
>  Pi k1 k2   x y
>  -------- . ---
>  3 k3 k4    t u
>
>? I've looked into the manual & browsed this newsgroup, but didn't find a
>clue...
>