RE: Modifying arguments of sub-parts of an expression
- To: mathgroup at smc.vnet.net
- Subject: [mg38864] RE: [mg38838] Modifying arguments of sub-parts of an expression
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 16 Jan 2003 03:21:05 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Gareth,
Here is one method...
brule = Gamma[x_?(¬ FreeQ[#, b] &)] :> Gamma[x /. b -> b + 1]
expr = Gamma[a]*Gamma[b]/Beta[a, b]*Gamma[a + b];
expr /. brule
(Gamma[a]*Gamma[1 + b]*Gamma[1 + a + b])/Beta[a, b]
expr2 = 10*Gamma[a]*
Gamma[3 + b]^2*(2*Gamma[1 + a]^2*Gamma[4 + b]*Gamma[3 + a +
b]*Gamma[a]*
Gamma[3 + b]*Gamma[4 + a + b])/(Beta[a, b]^3*Gamma[3 + a + b]^2*
Gamma[4 + a + b]*Gamma[5 + a + b]);
expr2 /. brule
(20*Gamma[a]^2*Gamma[1 + a]^2*Gamma[4 + b]^3*
Gamma[5 + b])/(Beta[a, b]^3*Gamma[4 + a + b]*
Gamma[6 + a + b])
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Gareth J. Russell [mailto:gjr2008 at columbia.edu]
To: mathgroup at smc.vnet.net
Hi,
I have an expression such as
Gamma[a]*Gamma[b]/Beta[a, b]*Gamma[a + b]
I want to make a new expression where for every subexpression with head
Gamma, if the arguments include b, each b is replaced by 1 + b. So, the
output from the above expression should be
Gamma[a]*Gamma[1 + b]/Beta[a, b]*Gamma[1 + a + b]
I would like to make a named function that performs this operation on an
input expression of arbitrary complexity. An example of a more complicated
input expression is given below:
10*Gamma[a]*Gamma[3 + b]^2*(2*Gamma[1 + a]^2*Gamma[4 +
b]*Gamma[3 + a + b]*Gamma[a]*Gamma[3 + b]*Gamma[4 + a + b])/(
Beta[a, b]^3*Gamma[3 + a + b]^2*Gamma[4 + a + b]*Gamma[5 + a + b])
I've tried, but I just can't seem to get the hang of functions that operate
on other functions...
Thanks
Gareth
Columbia University