Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2014

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simple question

  • To: mathgroup at
  • Subject: [mg132212] Re: Simple question
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Sat, 18 Jan 2014 05:00:46 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

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.


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.
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

  • Prev by Date: Re: School project - NEED HELP!
  • Next by Date: Unnecessary parentheses around TagBox for MakeBoxes?
  • Previous by thread: Re: Simple question
  • Next by thread: School project - NEED HELP!