kill(all)$

calculus, Leibniz's rule for differentiation under the integral sign (two variable),version 1.0
peter.vlasschaert@gmail.com,16/08/2019

load :packages

info:https://en.wikipedia.org/wiki/Leibniz_integral_rule
calculus :Leibniz's rule for differentiation under the integral sign, named after Gottfried Leibniz.
========================================================================
study
--------
example :https://www.youtube.com/watch?v=746dhtCNwvo
========================================================================

load(lrats);

p1:g(x) =integrate(sin(x*t),t,x,x^2);

p1a:rhs(p1);

p1b:'integrate(sin(x*t),t,x,x^2) = p1a;

p2:'diff(lhs(p1b),x)=diff(lhs(p1b),x);

info :

example :https://www.youtube.com/watch?v=746dhtCNwvo
---------------------------------------------------------------------------------

pp:'integrate(t*cos(x*t),t,x^2,x)=integrate(t*cos(x*t),t,x^2,x);

ppa:lhs(pp)=ratsimp(rhs(pp));

how to get this result manuel
----------------------------------------
combination : polynomial multiplied by geometric function
under the integral sign.

solution : integration by parts
======================

see:website
calculus: (important topics) :3e)Integration by parts Calculus.

method :manual  (integrate(t*cos(t*x),t,x^2,x))
----------------------
rule :d(f*g) = f*dg+g*df

f=t                             => df = dt         (derivative)
dg = cos(x*t)*dt       =>  g = integrate(cos(x*t),t)

pp1:g = 'integrate(cos(x*t),t);

how to solve : t*x =v  => dv = x*dt
x= constant

menu : Calculus:Change variable

pp2:changevar(rhs(pp1), v=x*t, v, t);

pp3:pp2=ev(pp2,nouns);

final result :manuel
--------------------------

pp4:rhs(pp1) =subst([v=x*t],rhs(pp3));

control result :  maxima
--------------------------------

pp5:lhs(pp4) = ev(lhs(pp4),nouns);

1e) step : f*g
------------------
a = x^2 , b = x

pp6a:  f=t;
pp6b: g = rhs(pp5);

pp6c:pp6a*pp6b;

rem : (f*g)[b] -(f*g)[a]

pp6d:f*g =lratsubst([t=x],rhs(pp6c)) -lratsubst([t=x^2],rhs(pp6c)) ;

2e) step: g*df
-------------------
g,df : ' see above'
a = x^2 , b = x

pp7:g*df = integrate(rhs(pp6b),t,a,b);

pp7a1:[a=x^2,b=x];

pp7a2:lhs(pp7) =lratsubst(pp7a1,rhs(pp7));

3e)step : f*dg
=>  f*dg = f*g-g*df
from : d(f*g) =f*dg+g*df
---------------------------------

pp8:lhs(pp) =rhs(pp6d) -rhs(pp7a2);

pp8a:lhs(pp8) =ratsimp(rhs(pp8));

control result :manuel.
=================

manual :before use ' is' command 'maxima'
=> always : ratsimp both sides

is(rhs(ppa)=rhs(pp8a));

result : direct Maxima output
======================

p2a:expand(p2);

p2b:lhs(p2a) = ev(rhs(p2a),nouns);

p2c:lhs(p2b)=ratsimp(rhs(p2b));

Mathematics: 
==========

a) method : process for evaluation
---------------

1e) data : from integral.
--------------------------------

how to get result:: leibniz rule ,differentayion under integral sign with variable range: x to x^2

p3:args(lhs(p2b));

p3a:p3[1];
p3b:p3[2];

p3c:args(p3a);

p3c1:insideintegr = p3c[1];
p3c2:[a=p3c[3],b=p3c[4]];

p3c3:integrvar = p3c[2];

p3c4:[g(x) =p3c[3],h(x)=p3c[4]];

combination data :p3c2 &  p3c4
--------------------------------------------

p3c5:flatten([p3c2,p3c4]);

2e) leibniz rule 2
-----------------------

p4a:'diff('integrate(f(x,t),t,h(x),g(x)) ,x)= diff('integrate(f(x,t),t,h(x),g(x)) ,x);

→1e) step f(x,t), input 'p4a'
---------------------------------

p4a1:f(x,t) = p3c[1];
p4a2:lratsubst([p4a1],p4a);

→2e) rhs 'p4a'
------------------

p4a3a:f(x,h(x)) =lratsubst([t=p3c[3]],lhs(p4a1));
p4a3b:f(x,g(x)) =lratsubst([t=p3c[4]],lhs(p4a1));

p4a4:f(x,t):= sin(t*x);
p4a4:p4a2;

p4a5:lhs(p4a4)=ev(rhs(p4a4),nouns);

→3e) input :h(x),g(x)
--------------------------

p4a6:lratsubst(p3c4,p4a5);

→4e) final result
----------------------

p4a7:ratsimp(p4a6);

p4a8:lhs(p4a7) =ev(rhs(p4a7),nouns);

b) method : fun ction 'leibnizrule2,two variables'
---------------------------------------------------------------

function : two variable   ( = leibnzrule2 )
===============================

leibnizrule2(f1,varintegra,vardiff,h,g) :=  block([],
   m1:lratsubst([varintegra=g],f1)*diff(g,x),
   m2:lratsubst([varintegra=h],f1)*diff(h,x),
   m3a:diff(f1,vardiff),
   m3:integrate(m3a,varintegra,h,g),
    m:m1-m2+m3);

function : not allowed to use , h(x),g(x), => only single variables for arguments

p5:leibnizrule2(sin(x*t),t,x,x^2,x) ;

p5a:ratsimp(p5);

check :function 'good'
------------------------------
result :rhs(p4a8) ? p5a

is(rhs(p4a8)=p5a);

rem :

representation: leibnizrule2
=====================

process of evaluation  =>
f(x,t) = sin(x*t)
[g(x)=x,h(x)=x^2]

p111:'diff('integrate(f(x,t),t,h(x),g(x)) ,x)= diff('integrate(f(x,t),t,h(x),g(x)) ,x);