SetDirectory["c:\\myDirectory"]

<< continuous1DHomotopyOperator.m

Print["START OF DEMO 1"];

integrand = 3*Sin[u[1][x,t]]*u[2][x,t]^2*D[u[1][x,t],x]-
            Sin[u[1][x,t]]*D[u[1][x,t],x]^3-
            6*Cos[u[1][x,t]]*u[2][x,t]*D[u[2][x,t],x]+
            2*Cos[u[1][x,t]]*D[u[1][x,t],x]*D[u[1][x,t],{x,2}]+
            8*D[u[2][x,t],x]*D[u[2][x,t],{x,2}];

Print["Expression to be integrated: "];

Print[integrand];

mathintegral = Integrate[integrand,x]

Print["Mathematica cannot evaluate the integral: "];

Print[mathintegral];

(* Pause[6] *)

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

Print["Integral computed by hand (myintegral): "];

Print[myintegral];

testmyintegral = Factor[integrand - D[myintegral,x]];

Print["integrand - D[myintegral,x] should be zero... test (myintegral):"];

Print[testmyintegral];

(* Pause[7] *)

(* Application of Homotopy Operator *)

homotopyintegral = continuousHomotopyOperator[integrand,u,2,x]

testhomotopy = Factor[integrand - D[homotopyintegral,x]];

Print["integrand - D[homotopyintegral,x] should be zero... (test homotopy):"];

Print[testhomotopy];

testdiff = Factor[myintegral-homotopyintegral];

Print["Difference of my integral and homotopy integral should be zero..."];

Print["(testdiff):"];

Print[testdiff];

Print["END OF DEMO 1"]