Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16428

Re: Simple question

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Simple question
Date Thu, 16 Jan 2014 06:52:04 +0000 (UTC)
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <lb7vik$3td$1@smc.vnet.net> (permalink)
References <20140115091656.DEBE169F0@smc.vnet.net>
Lines 44
Organization Time-Warner Telecom
NNTP-Posting-Date 16 Jan 2014 06:57:19 GMT
NNTP-Posting-Host 941e5eea.news.twtelecom.net
X-Trace DXC=O52>QCXe@Jl492K3\KHl;kC_A=>8kQj6m;[h;PUXBgbd27hNd_eWRHdEFiONJ7[Gof`<c]W?jj>Xa
X-Complaints-To abuse@twtelecom.net
Xref csiph.com comp.soft-sys.math.mathematica:16428

Show key headers only | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Simple question Bob Hanlon <hanlonr357@gmail.com> - 2014-01-16 06:52 +0000

csiph-web