Test Cases comparing Mathematica' s Integrate to the Homotopy Operator
Notebook last modified on 26 May, 10:00 by DP

SetDirectory["d:\\poole\\07-20-09\\\
HomotopyIntegrator"]

Get["HomotopyIntegrator.m"]

HomotopyIntegrator[ f, {independent variables} ] integrates by parts an exact expression, f,  involving unspecified functions of one independent variable or inverts the divergence of an exact expression with two or three indepdentent variables.  {independent variables}  can have up to three variables.

HomotopyIntegrator[ f, {independent variables} , {parameters} ] will evaluate a nonexact expression, f, with parameters for condidtions on the parameters that may make the expression exact.  HomotopyIntegrator will evaluate only parameters given in {parameters}.

HomotopyIntegrator[ f, {independent variables} , {parameters}, Options ] allows certain options.
Options for Homotopy Integrator:
Verbose -> True will provide a running dialog of the progress as a function is evaluated by HomotopyIntegrator.
printStandAloneOutput -> False suppresses all intermediate output, including the final result.

One-Dimensional Examples

The set of examples given below are all one-dimensional examples of expressions containing unspecified functions that Mathematica cannot integrate.  For each example, an expression is given and its derivative is found.  Then both Integrate and HomotopyIntegrator attempt to integrate the derivative.

Test No. 1  on x-derivative of  cos(u(x)) (((((∂u(x))/(∂x))))^2)+(((((∂v(x))/(∂x))))^2)-v(x) cos(u(x)).

testExpression[1] = 
      D[v[x], x]^2 + D[u[x], x]^2*Cos[u[x]] - v[x]*Cos[u[x]]

testExpressionDerivative[1] = D[testExpression[1], x]

Using Mathematica's Integrate function

resultIntegrate[1] = 
      Integrate[testExpressionDerivative[1], x]

resultIntegrate[1] - testExpression[1]

Integration with homotopy operator

resultHomotopy[1] = 
      HomotopyIntegrator[testExpressionDerivative[1], x]

Factor[resultHomotopy[1] - testExpression[1]]

Test No. 2 on x-derivative of  (Sqrt[((∂u(x))/(∂x)) (((∂^6) u(x))/(∂(x^6)))])

testExpression[2] = Sqrt[D[u[x], x]*D[u[x], {x, 6}]]

testExpressionDerivative[2] = D[testExpression[2], x]

Using Mathematica's Integrate function

resultIntegrate[2] = 
      Integrate[testExpressionDerivative[2], x]

resultIntegrate[2] - testExpression[2]

Integration with homotopy operator

resultHomotopy[2] = 
      HomotopyIntegrator[testExpressionDerivative[2], x]

resultHomotopy[2] - testExpression[2]

Test No. 3 on the x-derivative of  (1/(Sqrt[f(x) ((∂f(x))/(∂x))]))

testExpression[3] = 1/Sqrt[f[x]*D[f[x], x]]

testExpressionDerivative[3] = D[testExpression[3], x]

Using Mathematica's Integrate function

resultIntegrate[3] = 
      Integrate[testExpressionDerivative[3], x]

resultIntegrate[3] - testExpression[3]

Integration with homotopy operator

resultHomotopy[3] = 
      HomotopyIntegrator[testExpressionDerivative[3], x]

Factor[resultHomotopy[3] - testExpression[3]]

Test No. 4  on the x-derivative of  3 cos(((∂u(x))/(∂x))) ((u(x))^(3/2))

testExpression[4] = 3*Cos[D[u[x], x]]*u[x]^(3/2)

testExpressionDerivative[4] = D[testExpression[4], x]

Using Mathematica's Integrate function

resultIntegrate[4] = 
      Integrate[testExpressionDerivative[4], x]

resultIntegrate[4] - testExpression[4]

Integration with homotopy operator

resultHomotopy[4] = 
      HomotopyIntegrator[testExpressionDerivative[4], x]

resultHomotopy[4] - testExpression[4]

Test No. 5  on the x-derivative of  sin(u(x)) (((∂^2) v(x))/(∂(x^2)))-(((∂^3) v(x))/(∂(x^3)))

testExpression[5] = 
      Sin[u[x]]*D[v[x], {x, 2}] - D[v[x], {x, 3}]

testExpressionDerivative[5] = D[testExpression[5], x]

Using Mathematica's Integrate function

resultIntegrate[5] = 
      Integrate[testExpressionDerivative[5], x]

resultIntegrate[5] - testExpression[5]

Integration with homotopy operator

resultHomotopy[5] = 
      HomotopyIntegrator[testExpressionDerivative[5], x]

resultHomotopy[5] - testExpression[5]

Test No. 6 on the x-derivative of  (1-((∂u(x))/(∂x))) cos(u(x))-(cos^3)(u(x)) ((∂v(x))/(∂x))

testExpression[6] = (1 - D[u[x], x])*Cos[u[x]] - 
        Cos[u[x]]^3*D[v[x], x]

testExpressionDerivative[6] = D[testExpression[6], x]

Using Mathematica's Integrate function

resultIntegrate[6] = 
      Integrate[testExpressionDerivative[6], x]

resultIntegrate[6] - testExpression[6]

Integration with homotopy operator

resultHomotopy[6] = 
      HomotopyIntegrator[testExpressionDerivative[6], x]

TrigReduce[resultHomotopy[6] - testExpression[6]]

Test No. 7 on the x-derivative of (((∂((f(x))/∂)x))^2) cos f(
            x)  -  g(x) cos f(x)  +  
        c ∂((g(x))/∂)x, where c is a constant

testExpression[7] = 
      D[f[x], x]^2*Cos[f[x]] - g[x]*Cos[f[x]] + c*D[g[x], x]

testExpressionDerivative[7] = D[testExpression[7], x]

Using Mathematica's Integrate function

resultIntegrate[7] = 
      Integrate[testExpressionDerivative[7], x]

resultIntegrate[7] - testExpression[7]

Integration with homotopy operator

resultHomotopy[7] = 
      HomotopyIntegrator[testExpressionDerivative[7], x]

Factor[resultHomotopy[7] - testExpression[7]]

Test No. 8 on the x-derivative of \(TraditionalForm\`4 \((∂\(v(x)\)\/∂x)\)\^2 + \((∂\(u(x)\)\/∂x)\)\^2\ cos\ \(u(x)\)\  - 
        3 \(\( v\^2\)(x)\)\ cos\ \(u(x)\)\)

testExpression[8] = 
      4*D[v[x], x]^2 + D[u[x], x]^2*Cos[u[x]] - 
        3  v[x]^2*Cos[u[x]]

testExpressionDerivative[8] = D[testExpression[8], x]

Mathematica's Integrate - generally works in expressions with a rational form, but not for the one below.

resultIntegrate[8] = 
      Integrate[testExpressionDerivative[8], x]

resultIntegrate[8] - testExpression[8]

Integration with homotopy operator

resultHomotopy[8] = 
      HomotopyIntegrator[testExpressionDerivative[8], x]

Factor[resultHomotopy[8] - testExpression[8]]

Test No. 9 - works in both functions on the x-derivative of (((∂^2) u(x))/(∂(x^2))) ((((((∂^7) u(x))/(∂(x^7)))))^2) ((u(x))^5)+(((∂^4) u(x))/(∂(x^4))) ((((((∂^3) u(
                        1) (x))/(\(∂x\^3\)))))^2) u(x)+((∂u(x))/(∂x)) (((∂^5) u(x))/(∂(x^5)))

\(testExpression[9] = 
      D[u[x], x]*D[u[x], {x, 5}]\  + \ 
        u[x]*D[\(u[1]\)[x], {x, 3}]^2*D[u[x], {x, 4}]\  + \ 
\ 
        u[x]^5*D[u[x], {x, 7}]^2*D[u[x], {x, 2}]\)

testExpressionDerivative[9] = D[testExpression[9], x]

Mathematica's Integrate - generally works with expressions in a polynomial form.

resultIntegrate[9] = 
      Integrate[testExpressionDerivative[9], x]

resultIntegrate[9] - testExpression[9]

Integration with homotopy operator

resultHomtopy[9] = 
      HomotopyIntegrator[testExpressionDerivative[9], x]

resultHomtopy[9] - testExpression[9]

Test No. 10 - works in both functions on the x-deirvative of  (((((∂^6) u(x))/(∂(x^6))) ((∂u(x))/(∂x)))/(u(x)))+(((((∂^3) u(x))/(∂(x^3))) u(x))/(((∂^2) u(x))/(∂(x^2))))

testExpression[10] = 
      u[x]*D[u[x], {x, 3}]/D[u[x], {x, 2}] + 
        D[u[x], x]*D[u[x], {x, 6}]/u[x]

testExpressionDerivative[10] = D[testExpression[10], x]

Mathematica's Integrate - generally works in expressions with a rational form.

resultIntegrate[10] = 
      Integrate[testExpressionDerivative[10], x]

resultIntegrate[10] - testExpression[10]

Integration with homotopy operator

resultHomotopy[10] = 
      HomotopyIntegrator[testExpressionDerivative[10], x]

resultHomotopy[10] - testExpression[10]