Difficulties in patterns matching
- To: mathgroup at smc.vnet.net
- Subject: [mg3675] Difficulties in patterns matching
- From: nader at math.chalmers.se (Nader Tajvidi)
- Date: Fri, 5 Apr 1996 02:51:52 -0500
- Organization: Dept. of Mathematics, Chalmers, Sweden
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I spent some time to get a grip on the following patterns matching problem but to no avail. Consider the following expression. test = (2*Sum[(gamma*x[i])/(sigma^2*(1 - (gamma*x[i])/sigma)), {i, 1, n}])/ gamma^3 + (-1 + gamma^(-1))* Sum[(2*gamma*x[i]^3)/(sigma^4*(1 - (gamma*x[i])/sigma)^3) + (2*x[i]^2)/(sigma^3*(1 - (gamma*x[i])/sigma)^2), {i, 1, n}] - (2*Sum[(gamma*x[i]^2)/(sigma^3*(1 - (gamma*x[i])/sigma)^2) + x[i]/(sigma^2*(1 - (gamma*x[i])/sigma)), {i, 1, n}])/gamma^2 I would like to apply the following transformation rules to the above expression. 1) Sum[x[i]/(1-gamma x[i]/sigma),{i,1,n}]-> n f1[gamma,sigma] 2) Sum[x[i]^2/(1-gamma x[i]/sigma)^2,{i,1,n}]-> n f2[gamma,sigma] 3) And generally for different m's: Sum[x[i]^m/(1-gamma x[i]/sigma)^m,{i,1,n}]-> n fm[gamma,sigma] There are lots of such expressions and the main problem is that I can't define a general transformation rule which can handle for example rule no 1 for all different coefficients of x[i] in the numerator of expressions and also for different coefficients of (1-gamma x[i]/sigma) in the denominator of expressions. This means that the first sum in "test" should be transformed to n gamma f1[gamma,sigma] /sigma^2 These rules should also handle sums like Sum[x[i]+y[i],{i,n}]=Sum[x[i],{i,n}]+Sum[y[i],{i,n}]. Thanks in advance for any advice you can give. Regards, Nader Tajvidi ==== [MESSAGE SEPARATOR] ====