Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Joe Riel Newsgroups: comp.soft-sys.math.maple Subject: Re: Differentiating with respect to an expression Date: Tue, 11 Nov 2014 18:00:54 -0800 Organization: A noiseless patient Spider Lines: 56 Message-ID: <87a93xkwix.fsf@san.rr.com> References: <87sihpl61w.fsf@san.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="15591ad2607da309a0d1a78a1d632bc7"; logging-data="22139"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vmts9tAONiXdBWWSDT7RN" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:4p42Kl0B9QStP5fUl0Xxb+ELP7o= sha1:+tGrekuXmczct7F8DRhE1thpXRw= Xref: csiph.com comp.soft-sys.math.maple:1018 rouben@shadow.(none) (Rouben Rostamian) writes: > In article , > Nasser M. Abbasi wrote: >>On 11/11/2014 5:39 PM, none Rouben Rostamian wrote: >> >>> Thanks much, Joe, this is exactly what I was hoping for. >>> I had no idea about frontend() or the Physics package. >>> >>> This brings up a somewhat related question. Doing >>> frontend(int, [x(t)^2, x(t)]); >>> we get x(t)^3/3, which is fine. The following, however, >>> issues an Error message: >>> frontend(int, [x(t)^2, x(t)=a..b]); >>> >>> Is there a way to get that to work too? >>> >>> Rouben >>> >> >>I do not use frontend() either. But if all else fails, you >>can simply use calculus >> >>------------------------------ >>restart; >>f := frontend(int,[x(t)^2, x(t)]); >>f := unapply(f,t); >>limit(f(t),t=b)-limit(f(t),t=a); >>------------------------- >> >> (1/3)*x(b)^3-(1/3)*x(a)^3 > > Hi Nasser, that's good but it's not exactly what > I had asked. Your result integrates over t=a..b. > I wanted x(t)=a..b, but that's easy to fix: > f := frontend(int,[x(t)^2, x(t)]); > eval(f, x(t)=b) - eval(f, x(t)=a); > > This technique, however, does not work in a more complex case. > For instance, let's write x' and x'' for the first and second > derivatives of x. We want to integrate x'' * x' * x^2 with > respect to x. So we do: > > frontend(int, [diff(x(t),t,t)*diff(x(t),t)*x(t)^2, x(t)]); > > and we get the expected 1/3 * x'' * x' * x^3. > > Now, how do we do the corresponding definite integral > where x(t)=a..b ? The expected answer is > 1/3 * x''(t) * x'(t) * (b^3 - a^3). frontend(int, [diff(x(t),t,t)*diff(x(t),t)*x(t)^2, x(t)=a..b], [{`+`,`*`,`^`,`=`,`..`},{}]); 1/3*diff(x(t),`$`(t,2))*diff(x(t),t)*(-a^3+b^3) -- Joe Riel