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


Groups > comp.soft-sys.math.maple > #1011

Re: Differentiating with respect to an expression

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Joe Riel <joer@san.rr.com>
Newsgroups comp.soft-sys.math.maple
Subject Re: Differentiating with respect to an expression
Date Tue, 11 Nov 2014 14:35:07 -0800
Organization A noiseless patient Spider
Lines 48
Message-ID <87sihpl61w.fsf@san.rr.com> (permalink)
References <m3u1gm$7ir$1@news.albasani.net>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx02.eternal-september.org; posting-host="15591ad2607da309a0d1a78a1d632bc7"; logging-data="19311"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/nAZoGmGWfjc/pN6WfDoOR"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:b4sIpLQw8wQNh8ASaRahxsETuQ4= sha1:rBo+NsvUrYi2L9wtVz2eqZnlHMs=
Xref csiph.com comp.soft-sys.math.maple:1011

Show key headers only | View raw


rouben@shadow.(none) (Rouben Rostamian) writes:

> The following issue comes up quite often in the context of
> analytical mechanics.  I have a clunky solution for it.
> I wonder if there is a clever way.
>
> Let's say we have L = x^2 + x'^2 * x''^2, where x is a function of t,
> and in the usual mathematical notation, x' and x'' are the first and
> second derivatives of x.
>
> We want to compute the derivative of L with respect to x'.  The
> answer should be 2*x'*x''^2.  Here is the way I do it in Maple:
>
> restart;
> L := x(t)^2 + diff(x(t),t)^2 * diff(x(t),t,t)^2;
> subs(diff(x(t),t,t)=Z2, diff(x(t),t)=Z1, %);
> diff(%, Z1);
> subs(Z1=diff(x(t),t), Z2=diff(x(t),t,t), %);
>
> The L shown above is simple enough so that we don't need a
> CAS to compute the derivative.  The L in a real example will
> be the result of a long chain of calculations, will depend on
> several functions and their derivatives, and will take up a
> couple of screenfuls.
>
> If there is a clever way to compute that derivative, I would
> like to know.

A low-level way to do this is with frontend:

frontend(diff, [L,diff(x(t),t)]);
       2*diff(x(t),t)*diff(diff(x(t),t),t)^2

An alternative method is to use the Physics package:

with(Physics):

diff(L, diff(x(t),t));
       2*diff(x(t),t)*diff(diff(x(t),t),t)^2

# alternatively, with Physics

diff(L, D(x)(t));
     2*D(x)(t)*`@@`(D,2)(x)(t)^2


-- 
Joe Riel

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Differentiating with respect to an expression rouben@shadow.(none) (Rouben Rostamian) - 2014-11-11 22:10 +0000
  Re: Differentiating with respect to an expression Joe Riel <joer@san.rr.com> - 2014-11-11 14:35 -0800
    Re: Differentiating with respect to an expression rouben@shadow.(none) (Rouben Rostamian) - 2014-11-11 23:39 +0000
      Re: Differentiating with respect to an expression "Nasser M. Abbasi" <nma@12000.org> - 2014-11-11 18:50 -0600
        Re: Differentiating with respect to an expression "Nasser M. Abbasi" <nma@12000.org> - 2014-11-11 19:44 -0600
        Re: Differentiating with respect to an expression rouben@shadow.(none) (Rouben Rostamian) - 2014-11-12 01:55 +0000
          Re: Differentiating with respect to an expression Joe Riel <joer@san.rr.com> - 2014-11-11 18:00 -0800
            Re: Differentiating with respect to an expression Joe Riel <joer@san.rr.com> - 2014-11-11 18:03 -0800
              Re: Differentiating with respect to an expression rouben@shadow.(none) (Rouben Rostamian) - 2014-11-12 02:44 +0000
                Re: Differentiating with respect to an expression Joe Riel <joer@san.rr.com> - 2014-11-11 19:16 -0800
                Re: Differentiating with respect to an expression rouben@shadow.(none) (Rouben Rostamian) - 2014-11-12 04:53 +0000
      Re: Differentiating with respect to an expression Joe Riel <joer@san.rr.com> - 2014-11-11 17:45 -0800
        Re: Differentiating with respect to an expression Joe Riel <joer@san.rr.com> - 2014-11-11 17:52 -0800
        Re: Differentiating with respect to an expression rouben@shadow.(none) (Rouben Rostamian) - 2014-11-12 02:03 +0000

csiph-web