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


Groups > comp.soft-sys.math.mathematica > #9310 > unrolled thread

Derivatives in replacement rules

Started byYi Wang <tririverwangyi@gmail.com>
First post2012-03-30 09:39 +0000
Last post2012-04-02 08:24 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  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

#9310 — Derivatives in replacement rules

FromYi Wang <tririverwangyi@gmail.com>
Date2012-03-30 09:39 +0000
SubjectDerivatives in replacement rules
Message-ID<jl3v1b$3mi$1@smc.vnet.net>
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!

[toc] | [next] | [standalone]


#9349

FromRodrigo Murta <murta@rodrigomurta.com>
Date2012-04-02 08:24 +0000
Message-ID<jlbnn6$434$1@smc.vnet.net>
In reply to#9310
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web