Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2014

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

Search the Archive

Re: Simple question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132202] Re: Simple question
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Thu, 16 Jan 2014 01:53:44 -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
  • References: <20140115091656.DEBE169F0@smc.vnet.net>

Actually you do want to use ReplaceAll, you just don't want to manually
enumerate all of the rules.


expr = K11 Ue + (K12 - K21) Uex + K22 Uexx +
   (K23 + K32) Uexy + (K13 - K31) Uey + K33 Ueyy;


expr2 = expr /. ((# -> D[U[x, y, z, t],
        Sequence @@ (ToExpression@
           Characters@StringDrop[ToString@#, 2])]) & /@
    Select[Variables[expr],
     StringMatchQ[ToString[#], "Ue*"] &])



Bob Hanlon




On Wed, Jan 15, 2014 at 4:16 AM, KFUPM <hussain.alqahtani at gmail.com> wrote:

> 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 ReplaceAll commands, 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
>
>




  • Prev by Date: Re: Elasticity functions for Bezier and rectangular forms
  • Next by Date: Re: Vertices of a polyhedron
  • Previous by thread: Simple question
  • Next by thread: Re: Simple question