SetDirectory["c:\\myDirectory"]

<< continuous1DHomotopyOperator.m

Expression to be integrated:

integral  =  u[1][x, t]*D[u[2][x, t], {x, 3}]^3*
        Cos[u[x][x, t]]

integrand  =  D[integral,  x]

Integrate[integrand,  x]

myIntegral  =  -3 Cos[u[1][x, t]] * u[2][x, t]^2 + 
        Cos[u[1][x, t]]* D[u[1][x, t],  x]^2 + 
        4 D[u[2][x, t],  x]^2

myIntegrand  =  D[myIntegral,  x]

Mathematica cannot evaluate the integral:

mathintegral = Integrate[myIntegrand,x]

Integral computed by hand (integralByHand):

integralByHand = -3*Cos[u[1][x,t]]*u[2][x,t]^2+
             Cos[u[1][x,t]]*D[u[1][x,t],x]^2+
             4*D[u[2][x,t],x]^2

myIntegrand - D[integralByHand, x] should be zero... (testMyIntegralByHand):

testMyIntegralByHand = Factor[myIntegrand - D[integralByHand,x]]

Application of Homotopy Operator

Format: 
  continuousHomotopyOperator[expression, head of dependent variable, number of dependent variables, independent variable]

(* Note that t is parameter is this computation. It relates to time in
    my application: computation of densities and fluxes of PDEs in (1+1) dimensions *)

homotopyIntegral = continuousHomotopyOperator[myIntegrand,u,2,x]

myIntegrand - D[homotopyIntegral,x] should be zero... (testHomotopy):

testHomotopy = Factor[myIntegrand - D[homotopyIntegral,x]]

Difference of my integral and homotopy integral should be zero..."

testdiff = Factor[integralByHand - homotopyIntegral]