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


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

Re: Derivatives in replacement rules

From Rodrigo Murta <murta@rodrigomurta.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Derivatives in replacement rules
Date 2012-04-02 08:24 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jlbnn6$434$1@smc.vnet.net> (permalink)
References <jl3v1b$3mi$1@smc.vnet.net>

Show all headers | View raw


On Mar 30, 6:39 am, Yi Wang <tririverwan...@gmail.com> wrote:
> Hi, all,
>
> When I am using the following replacement rule:
>
> b[t] c[t] a'[t] /. b_ a_'[t] -> D[b, t]
>
> I would expect to get D[b[t]c[t], t] = b'[t]c[t] + c'[t]b[t]. However,
> I got 0 actually. To debug, when I set
>
> b[t] c[t] a'[t] /. b_ a_'[t] -> b
>
> I get b[t] c[t]. Thus pattern matching works and it appears D[b,t]
> should be non-zero.
>
> Any ideas how I can get D[b[t]c[t], t] in the above pattern
> replacement? Thanks!

Hi Yi
Use the dalayed rule :> instead of ->

b[t] c[t] a'[t] /. x_ a_'[t] :> D[x, t]

and you will get your expected result

Best regards!
Murta

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


Thread

Derivatives in replacement rules Yi Wang <tririverwangyi@gmail.com> - 2012-03-30 09:39 +0000
  Re: Derivatives in replacement rules Rodrigo Murta <murta@rodrigomurta.com> - 2012-04-02 08:24 +0000

csiph-web