Re: Simple question

*To*: mathgroup at smc.vnet.net*Subject*: [mg132212] Re: Simple question*From*: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>*Date*: Sat, 18 Jan 2014 05:00:46 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net

Dear All I have a long expression. Below is just a short part of it: K11 Ue + (K12 - K21) Uex + K22 Uexx + (K23 + K32) Uexy + (K13 - K31) Uey + K33 Ueyy I want to replace Ue->U[x,y,z,t]. and Uex->D[U[x,y,z,t],x] and Uexy->D[U[x,y,z,t],{x,y}] and so on. I want to make a command to scan the expression and do the conversion autmatically. I don't want to use Replace or ReplaceAllcommands, because as I said, the command is very long and I have so many functions to deal with. Many thanks in advance for your help. HMQ Hi, It is not quite clear, why you do not want the classic replacement. From your question I have the impression that it is mainly the length of the replacement operator that you do not like. If I am right, you might overcome this by collecting all rules into one list and giving it a name as well as giving a name to your expression to be transformed. This is the list of rules: listOfRules = {Ue -> U[x, y, z, t], Uex -> D[U[x, y, z, t], x] , Uexy -> D[U[x, y, z, t], {x, y}], Uexx -> D[U[x, y, z, t], {x, y}], Uey -> D[U[x, y, z, t], y], Uexy -> D[U[x, y, z, t], {x, y}], Ueyy -> D[U[x, y, z, t], {y, y}]}; It may be as long as you need. Here is your expression: f = K11 Ue + (K12 - K21) Uex + K22 Uexx + (K23 + K32) Uexy + (K13 - K31) Uey + K33 Ueyy; And here is a rather short replacement command: f /. listOfRules Try it. Have fun. Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu