kill(all);

calculus :integration by parts : version 1.0
peter.vlasschaert@gmail.com,12/08/2019.

load : packages
=============

load(lrats);

Integration by parts 
===============

d(f*g)=f*dg/dx+g*df/dx
var : x ' example of variable'
f : f(var)
g:g(var)
algo :
====
=>   integrate(f(var)*dg/dvar,var,a,b)  =[f(b)*g(b)]-[f(a)*g(a)] - integrate(df/dvar*g,var,a,b)

F1:Partial Integration : values
----------------------------------------

integrpart(f,m,var,a,b):=block([g],
    g:integrate(m,var),
    m1:'lratsubst([var=b],f*g) - 'lratsubst([var=a],f*g),
    m2:m1-'integrate(g*diff(f,var),var,a,b) )$    

m:dummy variable

p1:integrpart(y^2,exp(4*y),y,0,1);

p1a:ev(p1,nouns),ratsimp;

p2:integrpart(exp(4*y),y^2,y,0,1);

p2a:ev(p2,nouns),ratsimp;

F2:Partial Integration : (s)ymbolic
----------------------------------------------

integrparts(f,m,var):=block([g],
    g:integrate(m,var),
    m1:f*g,
    m2:m1-'integrate(g*diff(f,var),var) )$    

p1b:integrparts(y^2,exp(4*y),y);
p2b:integrparts(exp(4*y),y^2,y);