Risch and Parallel Risch Algorithms.

Authors: Luis A. Medina and Sasha Pavlyk

Upload Packages

<<AlgebraicPrelim.m
<<Misc.m
<<RationalIntegration.m
<<RischDE.m
<<ParametricProblems.m
<<CoupledDESystem.m
<<SymbolicIntBook.m
<<pmint.m

Risch Algorithm for Rational Functions

Hermite Reduction

R =((1-(x^2)+3 (x^3)+4 (x^4))/(-3+(x^2)));

HermiteReduce[R,x]

D[11 x+((3 (x^2))/2)+((4 (x^3))/3),x]+((34+9 x)/(-3+(x^2)))//Together

R=(((x^7)-24(x^4)-4(x^2)+8x-8)/((x^8)+6(x^6)+12(x^4)+8(x^2)));

HermiteReduce[R,x]

D[(3/(2+(x^2)))+((4+8 (x^2))/(4 x+4 (x^3)+(x^5))),x]+(1/x)//Together

R=(1/(2(x^2)+4));

HermiteReduce[R,x]

Lazard - Rioboo - Trager Algorithm for the transendental part

R1=((2+4 (x^2))/(5 x-(x^2)+4 (x^3)));

IntRationalLogPart[Numerator[R1],Denominator[R1],x]

D[%,x]//Simplify

Integration of Rational function

R1 = ((-4+4 x+4 (x^2)-4 (x^3)+3 (x^4))/(1+x+4 (x^2)));

IntegrateRationalFunction[((-4+4 x+4 (x^2)-4 (x^3)+3 (x^4))/(1+x+4 (x^2))),x]

D[%,x]//Simplify

R2 = ((-4+19 x+20 (x^2)+14 (x^3)+3 (x^4)-17 (x^5)-6 (x^6)+20 (x^7)+6 (x^8)+9 (x^9)+8 (x^10))/(6 x-12 (x^2)+15 (x^3)-4 (x^4)+6 (x^5)-5 (x^6)-14 (x^8)+12 (x^10)+7 (x^13)));

IntegrateRationalFunction[R2,x]

Simplify[%]

D[%,x]//Simplify

IntegrateRationalFunction[(1/(2(x^2)+4)),x]

D[%,x]//Simplify

Risch Algorithm for Transendental Monomial Extensions

Modules

Splitting Factorization

p1 =-1+2 x+4 (t^5) (x^4)+t (1-4 x-4 (x^2))+(t^3) (-3 (x^2)+2 (x^3))+(t^2) (2 x+7 (x^2)+2 (x^3))+(t^4) (-4 (x^3)-4 (x^4));

SplitFactor[p1,{x,t},{1,-(t^2)-(3/(2x))t+(1/(2x))}]

Collect[Expand[Times@@ % ], t]

p2 = (x^2)(t^3)+3x (t^2)+5;

SplitFactor[p2,{x,t},{1,1+(t^2)}]

Split Squarefree Factorization

p1 = 4(x^4)(t^5)-4(x^3)(x+1)(t^4)+(x^2)(2x-3)(t^3)+x(2(x^2)+7x+2)(t^2)-(4(x^2)+4x-1)t +2x-1;

SplitSquarefreeFactor[p1,{x,t},{1,-(t^2)-(3/(2x))t+(1/(2x))}]

{NN, S} =SplitSquarefreeFactor[(t/(x^2)),{x,t},{1,t}]

SubResultant@@{t^3-t x^2,-t+2 t^2-x^2-(-2 t x+(3 t^2-x^2)/x) z,t}

Canonical Representation

f1 =((x-t)/(t^2));

CanonicalRepresentation[f1,{x,t},{1,-(t^2)-(3/(2x))t+(1/(2x))}]

f2=((3-x+2 (x^2)+4 (x^3)+4 (x^4))/(4 (x^2)));

CanonicalRepresentation[f2,{x},{1}]

Hermite Reduction

f1 = ((x-t)/(t^2));

Timing[MonomialHermiteReduce[f1,{x,t},{1,1+(t^2)}]]

Timing[QuarticHermiteReduce[f1,{x,t},{1,1+(t^2)}]]

Derivation[{x,t},{1,1+(t^2)}][-(x/t)]-x//Together

f2=((1+3 x+2 (x^2)+3 (x^3))/(-4+4 x+3 (x^2)));

Timing[MonomialHermiteReduce[f2,{x},{1}]]

Timing[QuarticHermiteReduce[f2,{x},{1}]]

HermiteReduce[f2,x]

D[-((2 x)/3)+((x^2)/2),x]+((-5+29 x)/(3 (-4+4 x+3 (x^2))))//Together

MonomialHermiteReduce[(x/(2(x^2)+4)),{x},{1}]

QuarticHermiteReduce[(x/(2(x^2)+4)),{x},{1}]

f3=(((x^2)(t^5)+x (t^4)-ν (t^3)-x((x^2)+1)(t^2)-((x^2)-(ν^2))t - (x^5)/4)/((x^2) (t^4)+(x^2)((x^2)+2)(t^2)+(x^2)+(x^4)+(x^6)/4));

MonomialHermiteReduce[f3,{x,t},{1,-(t^2)-(t/x)-(1-((ν^2)/(x^2)))}]//Together

QuarticHermiteReduce[f3,{x,t},{1,-(t^2)-(t/x)-(1-((ν^2)/(x^2)))}]//Together

Polynomial Reduction

p1 = 1+x t+(t^2);

PolyReduce[p1,{x,t},{1,1+(t^2)}]

p2 =(t^3)+(t^2) x-(t^4) (x^4)+(t^5) (x^6);

PolyReduce[p2,{x,t},{1,1+(t^2)}]

Collect[Expand[Derivation[{x,t},{1,1+(t^2)}][%[[1]]]+%[[2]]],t]

Lazard - Rioboo - Trager Resultant Reduction

f1 = ((2(t^2)-t-(x^2))/((t^3)-(x^2)t));

ResidueReduce[f1,{x,t},{1,1/x}]

f2=((-2 t (v^2)-2 x-2 (x^3)-t (x^4))/((x^2) (2+2 (t^2)+(x^2))));

ResidueReduce[f2,{x,t},{1,-1-(t^2)+((v^2)/(x^2))-(t/x)}]

ResidueReduce[(1/((t1+(t1^2)) x)),{x,t1},{1,(1/x)}]

Integration of hypertangent polynomials

PolyReduce[(t^2)+x t +1,{x,t},{1,1+(t^2)}]

PolyReduce[(t^3)+(x^2) t +1,{x,t},{1,1+(t^2)}]

Derivation[{x,t},{1,1+(t^2)}][((t^2)/2)]+1+t (-1+(x^2))//Expand

Integration of Nonlinear Case with no Specials

f=((-(t^3) (v^2)+(t^4) x+(t^5) (x^2)-((x^5)/4)-(t^2) x (1+(x^2))-t (-(v^2)+(x^2)))/((x^2)+(t^4) (x^2)+(x^4)+((x^6)/4)+(t^2) (x^2) (2+(x^2))));

IntegrateNonLinearNoSpecial[f,{x,t},{1,-1-(t^2)+((v^2)/(x^2))-(t/x)}]

Algebra`Polynomial`NestedTermsList[Expand[((t^2)/x)+t(x-t),t],t]

Recognizing Derivatives (tower consist of a tower consisting of Primitive elements and at most 1 Hyperexponential element)

DerivativeQ[(x^2),{x},{1}]

DerivativeQ[1+t,{x,t},{1,(1/x)}]

DerivativeQ[((t+t t0+t0 x)/(1+t0)),{x,t0,t},{1,t0,(t0/(1+t0))}]

D[((Erf[x])/((x^3)+(x^2)+x+1)),x]/.{Erf[x]->t,Exp[-(x^2)]->t0, Exp[-2(x^2)]->(t0^2)}

IntegrateTranscendentalMonomial[-((t (1+2 x+3 (x^2)))/(((1+x+(x^2)+(x^3)))^2))+((2 t0)/((Sqrt[π]) (1+x+(x^2)+(x^3)))),{x,t0,t},{1,-2x t0, (2/(Sqrt[π]))t0}]

Update[]
Block[{$DebugRisch = True},DerivativeQ[-((t (1+2 x+3 (x^2)))/(((1+x+(x^2)+(x^3)))^2))+((2 t0)/((Sqrt[π]) (1+x+(x^2)+(x^3)))),{x,t0,t},{1,-2x t0, (2/(Sqrt[π]))t0}]]

PolynomialGCD[1+x+(x^2)+(x^3),0]

Recognizing Log Derivatives (tower consists of Primitive and Hypertangent Elements)

Only primitive elements.

LogarithmicDerivativeQ[(2/x),{x,t},{1,(1/x)}]

D[Log[2+Exp[x]], x] /.{Exp[x]->t,Exp[-x]->(1/t)}

LogarithmicDerivativeQ[(t/(2+t)),{x,t},{1,t}]

LogarithmicDerivativeQ[t,{x,t},{1,(1/x)}]

LogarithmicDerivativeQ[(1/(x t1)),{x,t1,t2},{1,(1/x),(1/(x t1))}]

LogarithmicDerivativeQ[(1/((x^2)+x t1)),{x,t1,t2},{1,(1/x),(1/(x t1))}]

LogarithmicDerivativeQ[((x+1)/((x^2)+x t1)),{x,t1,t2},{1,(1/x),(1/(x t1))}]//Together

LogarithmicDerivativeQ[((1+t1+t1 x+(x^2)+t1 (x^2)-2 (t1^2) (x^2)-2 t1 t2 (x^2)-t1 (x^3))/(t1 x (t1+t2+x) (1+(x^2)))),{x,t1,t2},{1,(1/x),(1/(x t1))}]

LogarithmicDerivativeQ[(1/(t (1+(x^2)))),{x,t},{1,(1/(1+(x^2)))}]

LogarithmicDerivativeQ[((t2-t1 t2+t1 x+t2 (x^2)-t1 t2 (x^2))/(t1 t2 x (1+(x^2)))),{x,t1,t2},{1,(1/x),(1/((x^2)+1))}]

LogarithmicDerivativeQ[((-t2+x+t1 x-t2 (x^2))/((1+t1) t2 x (1+(x^2)))),{x,t1,t2},{1,(1/x),(1/((x^2)+1))}]

LogarithmicDerivativeQ[((t2+t1 x+(t1^2) x+t2 (x^2))/(t1 (1+t1) t2 x (1+(x^2)))),{x,t1,t2},{1,(1/x),(1/((x^2)+1))}]

Simplify[%]

Only hypertangent elements.

D[Log[x+tan[x]],x]/.{tan[x]->t}

LogarithmicDerivativeQ[%,{x,t},{1,1+(t^2)}]

D[Log[tan[tan[x]]+1],x]/.{tan[x]->t1,tan[tan[x]]->t2}

LogarithmicDerivativeQ[%,{x,t1,t2},{1,1+(t1^2),(1+(t1^2))(1+(t2^2))}]

LogarithmicDerivativeQ[((x (2+(t^2)))/(x+t)),{x,t},{1,1+(t^2)}]

Combination of both

(D[Log[Log[x]tan[x]],x]//Together)/.{Log[x]->t1,tan[x]->t2}

LogarithmicDerivativeQ[%,{x,t1,t2},{1,(1/x),1+(t2^2)}]

LogarithmicDerivativeQ[((1+(t2^2))/(x t2)),{x,t1,t2},{1,(1/x),1+(t2^2)}]

Recognizing Log Derivatives of k(t)-radicals (tower consists of Primitive and Hypertangent Elements)

Only primitives elements

RadicalLogarithmicDerivativeQ[(220/(3 x (100 t1+(x^3))))+((11 (x^2))/(5 (100 t1+(x^3)))),{x,t1,t2,t3},{1,(1/x),(1/(x t1)),(1/(x t1 t2))}]

RadicalLogarithmicDerivativeQ[(5632/(152369 x (3+512 t1+t2+(x^100))))+(11/(152369 t1 x (3+512 t1+t2+(x^100))))+((1100 (x^99))/(152369 (3+512 t1+t2+(x^100)))),{x,t1,t2,t3},{1,(1/x),(1/(x t1)),(1/(x t1 t2))}]

RadicalLogarithmicDerivativeQ[((32+21 (x^21)+32 t1 Log[32 t1+(x^21)]+(x^21) Log[32 t1+(x^21)])/(32 t1+(x^21))),{x,t1,t2,t3},{1,(1/x),(1/(x t1)),(1/(x t1 t2))}]

RadicalLogarithmicDerivativeQ[(1/x),{x,t},{1,(1/x)}]

RadicalLogarithmicDerivativeQ[(Pi/x),{x,t},{1,(1/x)}]

Only hypertangent elements

D[(2/3)Log[tan[x]],x]/.tan[x]->t

RadicalLogarithmicDerivativeQ[%,{x,t},{1,1+(t^2)}]

x*D[(2/3)Log[tan[x]],x]/.tan[x]->t

RadicalLogarithmicDerivativeQ[%,{x,t},{1,1+(t^2)}]

Combinations of both.

D[(4/5)Log[Log[x]+tan[x]],x]/.{Log[x]->t1,tan[x]->t2}//Together

RadicalLogarithmicDerivativeQ[%,{x,t1,t2},{1,(1/x),1+(t2^2)}]

x D[(4/5)Log[Log[x]+tan[x]],x]/.{Log[x]->t1,tan[x]->t2}//Together

RadicalLogarithmicDerivativeQ[%,{x,t1,t2},{1,(1/x),1+(t2^2)}]

Weak Normalization

WeakNormalizer[((2+3 t-3 (t^3)+x+t x)/(1+t)),{x,t},{1,1+(t^2)}]

WeakNormalizer[2,{x,t},{1,1+(t^2)}]

Bounding the degree of polynomial solutions

RdeBoundDegree[1,-2t,1,{t},{1}]

RdeBoundDegree[t,(t-1)((t^2)+1),1,{1,t},{1,1+(t^2)}]

Special Polynomial Differential Equation (SPDE)

SPDE[t,(t-1)((t^2)+1),1,{x,t},{1,1+(t^2)},0]

SPDE[(t^2)+2x t+(x^2),((t^2)/(x^2))-((2/x)-1)t,((t^2)/(x^2))-((2/x)-1)t,{x,t},{1,t},0]

SPDE[(t^2),((-(t^2))/(x^2))-(1/x),(2x-1)(t^4)+((t0+x)/x)(t^3)-((t0+4(x^2))/(2x))(t^2)+x t,{x,t0,t},{1,t0/(x^2),1/x},3]

Risch Differential Equation

The following are examples of the Rish Differential equation on primitive extentions comming from logs.

Update[];
Block[{$DebugRisch = False},RischDE[x,(1/x)+x(t+1),{x,t},{1,(1/x)}]]

-1-t-t (-1+(x^2))+((x+(x^3)+t (x^3))/x)//Together

Exponent[-1-t-t (-1+(x^2))+((x+(x^3)+t (x^3))/x) //Together,t]

|

Derivation[{x,t},{1,(1/x)}][1+t]+x(1+t)

RischDE[t,((1+x (t^2))/x),{x,t},{1,(1/x)}]

RischDE[x,((3 (t^2)+(t^3) (x^2))/x),{x,t},{1,(1/x)}]

RischDE[t,((2 t+7 t x+(t^3) x)/x),{x,t},{1,(1/x)}]

RischDE[t,((1+2 t+t x+(t^2) x+(t^3) x)/x),{x,t},{1,(1/x)}]

RischDE[2t+1,((2 t)/(x^2))-((t^2)/(x^2))+((t^2)/x)+((2 (t^3))/x),{x,t},{1,(1/x)}]

RischDE[t,(t^2),{x,t},{1,(1/x)}]

Next, an example in the field K = ℚ(x, Log[x], Log[ Log[x] ] ) = ℚ(x, t1, t2).

Timing[RischDE[t1,(2/t1)+2 t2+2 t1 t2 x,{x,t1,t2},{1,(1/x),(1/(x t1))}]]

Note that the above is equivalent to

Timing[DSolve[y'[x]+Log[x]y[x]== (2/(Log[x]))+2 Log[Log[x]]+2 x Log[x] Log[Log[x]],y[x],x]]

Next an example of a primitive extension comming from ArcTan

RischDE[(2t+(1/2)),(7/2)+14 t+((t^3)/2)+2 (t^4)+((3 (t^2))/(1+(x^2))),{x, t},{1,(1/((x^2)+1))}]

Next, a nice example from Sam Blake.

Timing[RischDE[1/(x^7+1),-(6 (-2+2 x-34 (x^2)+8 (x^3)-3 (x^4)-90 (x^5)+314 (x^6)-434 (x^7)+328 (x^8)-164 (x^9)+61 (x^10)-32 (x^11)+36 (x^12)+180 (x^13)-192 (x^14)+90 (x^15)-22 (x^16)+2 (x^17)))/((((1+6 (x^2)-2 (x^3)+12 (x^4)-6 (x^5)+(x^6)))^2) (1+(x^7))),{x},{1}]]

It is worth noting that Mathematica 6.1 struggles with it (good eye Sam!)

Timing[DSolve[y'[x]+1/(x^7+1)y[x]==-(6 (-2+2 x-34 (x^2)+8 (x^3)-3 (x^4)-90 (x^5)+314 (x^6)-434 (x^7)+328 (x^8)-164 (x^9)+61 (x^10)-32 (x^11)+36 (x^12)+180 (x^13)-192 (x^14)+90 (x^15)-22 (x^16)+2 (x^17)))/((((1+6 (x^2)-2 (x^3)+12 (x^4)-6 (x^5)+(x^6)))^2) (1+(x^7))),y[x],x]]

The following are examples of the Rish Differential equation on HyperExponential extentions.  Since the function for the Parametric Logarithimic Derivative problem is heurisitc then it can happend that there is a solution, but RishDE fails to find it.

The next examples lie in ℚ(x, t) where t = Exp[x].

RischDE[t, 2 (t^2)+(t^3),{x,t},{1,t}]

RischDE[t,t+(t^2),{x,t},{1,t}]

RischDE[t,1+t x,{x,t},{1,t}]

RischDE[x,t+t x,{x,t},{1,t}]

RischDE[x,t (4 t+(1/x))-(t/(x^2))+(3+2 (t^2)+(t/x)) x,{x,t},{1,t}]

The following example illustrate the problem of ParametricLogarithmicDerivative being heuristic.

RischDE[1,t+ 2t x, {x,t},{1,t}]

but

Derivation[{x,t},{1,t}][t x]+ t x

So, y = t x is a solution.

The following examples lie in ℚ(x, t0, t), with t0= ArcTan[x] and t = Exp[ArcTan[x]]

Timing[RischDE[t0,1+t0 (t+x)+(t/(1+(x^2))),{x,t0,t},{1,(1/((x^2)+1)),(t/((x^2)+1))}]]

which is saying that  D( t+ x ) + (Subscript[t, 0])( t + x ) = 1+(Subscript[t, 0])( t+x )+t/((x^2)+1) or

D[Exp[ArcTan[x]]+x,x]+ArcTan[x](Exp[ArcTan[x]]+x)

Mathematica 6.1 struggles with it

Timing[DSolve[v'[x]+ArcTan[x]v[x]== 1+ArcTan[x](Exp[ArcTan[x]]+x)+((Exp[ArcTan[x]])/(1+(x^2))),v[x],x]]

TrigToExp[D[Tan[x],x]+x Tan[x]]

Tan[x]//TrigToExp

RischDE[x,(4/((((t^(-1))+t))^2))+((I (t^(-1)) x)/((t^(-1))+t))-((I t x)/((t^(-1))+t)),{x,t},{1,I t}]/.{t->Exp[I x]} //ExpToTrig//Simplify

Parametric Risch Differential Equation

Primitive Extensions

{lv,ld} ={{x,t},{1,(1/x)}};
DD = Derivation[lv, ld];
Collect[DD[(t^2)+1]+(x+t)((t^2)+1) //Expand, {t,x}]

f =(x+t);
g = {(t^3),t (1+(2/x)),x+(t^2) x};
{h,A} = ParamRischDE[f,g,lv, ld];

A

h

Length[First[NullSpace[A]]]

NullSpace[A]

With[{y = #.h},{y,DD[y]+f*y, Take[#,Length[g]].g}]&/@NullSpace[A]//Expand//Collect[#,t|x]&

Here is an example where this method fails.

{lv,ld} ={{x,t},{1,(1/x)}};
DD = Derivation[lv, ld];
Collect[DD[(t^2)+1]+(1/(t+1))((t^2)+1) //Expand, {t,x}]

f =(1/(t+1));
g = {(1/(t+1)),((t^2)/(1+t)),(t/x)};
Update[];
Block[{$DebugRisch=True},ParamRischDE[f,g,lv, ld]]

Hyperexponential Extensions

{lv,ld} ={{x,t},{1,t}};
DD = Derivation[lv, ld];
Collect[DD[(t^2)+1]+((x^3)+t)((t^2)+1) //Expand, {t,x}]

List@@(t+(t^3)+(x^3)+(t^2) (2+(x^3)))

f =((x^3)+t);
g = {t,(t^3),(x^3),(t^2) (2+(x^3))};
{h,A} = ParamRischDE[f,g,lv, ld];

h

Union[With[{y = #.h},{y,DD[y]+f*y, Take[#,Length[g]].g}]&/@NullSpace[A]]//Expand//Collect[#,t|x]&

ParamRischDE can fail as shown in the following example.

{lv,ld} ={{x,t},{1,t}};
DD = Derivation[lv, ld];
Collect[DD[(t^2)+1]+(((x^3)/(x+1)))((t^2)+1) //Expand, {t,x}]

f =(((x^3)/(x+1)));
g = {((x^3)/(x+1)),(t^2),(((t^2)(x^3))/(x+1))};
Update[];
Block[{$DebugRisch=True},ParamRischDE[f,g,lv, ld]]

Another example, this time it fails for a different reason.

{lv,ld} ={{x,t},{1,t}};
DD = Derivation[lv, ld];
Collect[DD[t]+((1/x))(t) //Expand, {t,x}]

f =((1/x));
g = {t,(t/x)};
Update[];
Block[{$DebugRisch=True},ParamRischDE[f,g,lv, ld]]

(Heuristic) Parametric Logarithmic Derivative equation

ParametricLogarithmicDerivative[ ((5(t^2)+t-6)/(2x (t^2))), theta, -(theta/(x (t^2))),{x,t},{1,(1/x)}]

ParametricLogarithmicDerivative[11,theta, theta, {t},{1}]

ParametricLogarithmicDerivative[2, theta, -(theta/(x (t^2))),{x,t},{1,(1/x)}]

ParametricLogarithmicDerivative[t+(1/(t x)),theta,t theta,{x,t},{1,(1/x)}]

ParametricLogarithmicDerivative[2 t+(1/(t x)),theta,t theta,{x,t},{1,(1/x)}]

ParametricLogarithmicDerivative[25 t+(1/(4 x))+(1/(2 t x)),theta,t theta,{x,t},{1,(1/x)}]

Next, an example where this method fails to find a solution even though there is one.

ParametricLogarithmicDerivative[2+(1/x),t,2t,{x},{1}]

Coupled DE System

HyperExponential case

example 1:

Derivation[{x,t},{1,t}][x+I t]+(I t)(x+I t)

and so

CoupledDESystem[-1,0,t,1-(t^2),t+t x,{x,t},{1,t}]

example 2:

Derivation[{x,t},{1,t}][(1/x)+I t]+((x^2)+I t)((1/x)+I t)//Expand

therefore

CoupledDESystem[-1,(x^2),t,-(t^2)-(1/(x^2))+x,t+(t/x)+t (x^2),{x,t},{1,t}]

Primitive case

Example 1:

Derivation[{x,t},{1,(1/x)}][(1/x)+I t]+((x^2)+I t)((1/x)+I t)//Expand

therefore

CoupledDESystem[-1,(x^2),t,-(t^2)-(1/(x^2))+x,(1/x)+(t/x)+t (x^2),{x,t},{1,(1/x)}]

Example 2:

Derivation[{x,t},{1,(1/x)}][x]+((x^2)+I t)(x)//Expand

therefore

CoupledDESystem[-1,(x^2),t,1+(x^3),t x,{x,t},{1,(1/x)}]

Integration

Rational Functions

R1 = ((x+(x^2))/(3-3 (x^2)+3 (x^3)));
R2 = ((-4 x+2 (x^2))/(-4+4 x-(x^2)+2 (x^3)));
R3 = ((3+9 x+10 (x^2)+6 (x^3)-(x^4)+3 (x^5))/(8-7 x+10 (x^2)+8 (x^3)+(x^4)));
R4 = (1/x);
R5 = (1/((x^2)+1));

IntegrateTranscendentalMonomial[R1,{x},{1}]

IntegrateTranscendentalMonomial[R2,{x},{1}]

IntegrateTranscendentalMonomial[R3,{x},{1}]

IntegrateTranscendentalMonomial[R4,{x},{1}]

IntegrateTranscendentalMonomial[R5,{x},{1}]

Compare with IntegrateRationalFunction

IntegrateRationalFunction[R1,x]

IntegrateRationalFunction[R2,x]

IntegrateRationalFunction[R3,x]

IntegrateRationalFunction[R4,x]

IntegrateRationalFunction[R5,x]

Even though IntegrateTranscendentalMonomial is able to integrate rational functions (they lie in the primitive extension {ℚ(x), d/dx}), it is not a good idea to integrate them using this algorithm, since it will visit all "modules" for primitive integration.  Instead, it is better to use IntegrateRationalFunction which is a much simpler procedure intended to integrate only rational functions.  The next example illustrates this.

R6 = ((-9+(x^2)+(x^3)+5 (x^5))/(-5-5 x-8 (x^2)+4 (x^3)+9 (x^4)-9 (x^6)+4 (x^7)));

Timing[IntegrateTranscendentalMonomial[R6,{x},{1}]]

Timing[IntegrateRationalFunction[R6,x]]

Primitive Monomials

Logarithimic extensions

IntegrateTranscendentalMonomial[(1/(x t)),{x,t},{1,(1/x)}]

IntegrateTranscendentalMonomial[(1/x)+(1/(t x))+6 x,{x,t},{1,(1/x)}]

A nice example from the book.

IntegrateTranscendentalMonomial[(t0+(1/t0))t-(x/t0),{x,t0,t},{1,(1/x),(1/t0)}]//Timing

%/.{t->LogIntegral[x],t0->Log[x]}//Expand

This is equivalent to

Integrate[(Log[x]+(1/(Log[x])))LogIntegral[x]-(x/(Log[x])),x]//Expand//Timing

RischIntegration[(Log[x]+(1/(Log[x])))LogIntegral[x]-(x/(Log[x])),x]//Expand//Timing

ArcTan extensions

IntegrateTranscendentalMonomial[6 t x+(1/(t (1+(x^2))))+((3 (x^2))/(1+(x^2))),{x,t},{1,(1/((x^2)+1))}]

IntegrateTranscendentalMonomial[(1/x)+(1/(((1+(x^2)))^2))-((2 t x)/(((1+(x^2)))^2))+(1/(t (1+(x^2)))),{x,t},{1,(1/((x^2)+1))}]

(Derivation[{x,t},{1,(1/((x^2)+1))}][%] -( (1/x)+(1/(((1+(x^2)))^2))-((2 t x)/(((1+(x^2)))^2))+(1/(t (1+(x^2))))))//FullSimplify

IntegrateTranscendentalMonomial[(1/(t (1+(x^2)))),{x,t},{1,(1/((x^2)+1))}]

Combinations of Log extensions and ArcTan extensions.

The next examples lie in ℚ(x, t0, t) where t0 = Log[x] and t = ArcTan[ Log[x] ].

The first is example is the following

IntegrateTranscendentalMonomial[((t+t0+t (t0^2))/(t t0 (1+(t0^2)) x)),{x,t0,t},{1,(1/x),(1/x)(1/(1+(t0^2)))}]

Note that this is equivalent to

Integrate[((ArcTan[Log[x]]+Log[x]+ArcTan[Log[x]] ((Log[x])^2))/(x ArcTan[Log[x]] Log[x] (1+((Log[x])^2)))),x]//Timing

RischIntegration[((ArcTan[Log[x]]+Log[x]+ArcTan[Log[x]] ((Log[x])^2))/(x ArcTan[Log[x]] Log[x] (1+((Log[x])^2)))),x]//Timing

Next,

IntegrateTranscendentalMonomial[((2+(t0^2))/((t+t0) (1+(t0^2)) x)),{x,t0,t},{1,(1/x),(1/x)(1/(1+(t0^2)))}]//Timing

which is equivalent to

Integrate[((2+((Log[x])^2))/(x (ArcTan[Log[x]]+Log[x]) (1+((Log[x])^2)))),x]//Timing

RischIntegration[((2+((Log[x])^2))/(x (ArcTan[Log[x]]+Log[x]) (1+((Log[x])^2)))),x]//Timing

The next example lies in ℚ(x, t0, t1, t) where t0 = Log[x], t1 = Log[Log[x]], and t = ArcTan[ Log[ Log[x] ] ].

IntegrateTranscendentalMonomial[(1/(t t0 (1+(t1^2)) x)),{x,t0,t1,t},{1,(1/x),(1/(x t0)),(1/(x t0(1+(t1^2))))}]

Note that this equivalent to

Integrate[(1/(ArcTan[Log[Log[x]]] Log[x](1+((Log[Log[x]])^2))x)),x]//Timing

RischIntegration[(1/(ArcTan[Log[Log[x]]] Log[x](1+((Log[Log[x]])^2))x)),x]//Timing

The next example lies in ℚ(x, t0, t) where t0 = ArcTan[x] and t = Log[ArcTan[x]].

IntegrateTranscendentalMonomial[2 x+(t/(1+(x^2)))+((1+t t0)/(t t0 (1+(x^2)))),{x,t0,t},{1,(1/((x^2)+1)),(1/(((x^2)+1)t0))}]//Expand

Note that this is equivalent to

Integrate[2 x+((Log[ArcTan[x]])/(1+(x^2)))+((1+ArcTan[x] Log[ArcTan[x]])/((1+(x^2)) ArcTan[x] Log[ArcTan[x]])),x]

Hyperexponential Monomials

IntegrateTranscendentalMonomial, as of today, can integrate elements of a tower that  contains primitive elements and at most 1 hyperexponential without problems.  However if it contains more than one hyperexponential, it can fails even if it is doable.

The following examples lie in ℚ(x, t) with  t = Exp[x].

IntegrateTranscendentalMonomial[t,{x,t},{1,t}]

Update[];
Block[{$DebugRisch=True},IntegrateTranscendentalMonomial[1+t x,{x,t},{1,t}]]

IntegrateTranscendentalMonomial[(t/(1+t)),{x,t},{1,t}]

Integrate[((Exp[x])/(Exp[x]+1)),x]

IntegrateTranscendentalMonomial[((2 t+t x+(t^2) x)/(1+t x)),{x,t},{1,t}]

((2 t+t x+(t^2) x)/(1+t x))/.{t->Exp[x]}

Integrate[((2 (E^x)+(E^x) x+(E^(2 x)) x)/(1+(E^x) x)),x]

Update[];
Block[{$DebugRisch=True},IntegrateTranscendentalMonomial[((t+2 x+2 t x+t (x^2))/((1+t) (1+(x^2)))),{x,t},{1,t}]]

IntegrateTranscendentalMonomial[1+14 (t^2)+(1/x)+((2 t x+t (x^2))/(3+t (x^2))),{x,t},{1,t}]

Next, a trigonometric example, it lies in ℚ(I)(x, t) where t = Exp[ I t ].

TeXForm[D[(((x^2)+Cos[x]+Sin[x])/(3x Sin[x]+1)),x]]

After changing trigonometric functions to exponentials, setting t = Exp[I x], and togethering we have

IntegrateTranscendentalMonomial[-((1+I) (-3 I-2 I t-(3-3 I) (t^2)+2 (t^3)+3 (t^4)-(2-2 I) (t^2) x+(3+3 I) t (x^2)-(3+3 I) (t^3) (x^2)-(3-3 I) t (x^3)-(3-3 I) (t^3) (x^3)))/(((2 I t-3 x+3 (t^2) x))^2),{x,t},{1,I t}]

Changing everithing to exponentials we have

FullSimplify[(((1/3)+(I/3))/x)+((6 I x+2 I t ((-1-I)+3 (x^3)))/(3 x (2 I t-3 x+3 (t^2) x)))/.t->Exp[I x]]

The following examples lie in ℚ(x, t0 ,t) where t0 = Log[x] and t = Exp[t].

IntegrateTranscendentalMonomial[-((2 t t0 x)/(((1+(x^2)))^2))+((t t0)/(1+(x^2)))+(t/(x (1+(x^2)))),{x,t0,t},{1,(1/x),t}]

IntegrateTranscendentalMonomial[-((2 t t0 x)/(((1+(x^2)))^2))+((t t0)/(1+(x^2)))+(t/(x (1+(x^2)))),{x,t,t0},{1,t,(1/x)}]

This is equivalent to

Integrate[((E^x)/(x (1+(x^2))))-((2 (E^x) x Log[x])/(((1+(x^2)))^2))+(((E^x) Log[x])/(1+(x^2))),x]

RischIntegration[((E^x)/(x (1+(x^2))))-((2 (E^x) x Log[x])/(((1+(x^2)))^2))+(((E^x) Log[x])/(1+(x^2))),x]

candidateTower[((E^x)/(x (1+(x^2))))-((2 (E^x) x Log[x])/(((1+(x^2)))^2))+(((E^x) Log[x])/(1+(x^2))),x,t]

Next,

IntegrateTranscendentalMonomial[((-x+(x^3)+t0 (x^3)+(t^2)(-x+t0 x)+t (-1-t0 x+2 (t0^2) (x^2)+(x^3)-(t0^2) (x^3)))/(x (((t t0+x))^2))),{x,t0,t},{1,(1/x),t}]//Together

This is equivalent to

Integrate[(1/(x (((x+(E^x) Log[x]))^2)))(-x+(x^3)+(x^3) Log[x]+(E^(2 x)) (-x+x Log[x])+(E^x) (-1+(x^3)-x Log[x]+2 (x^2) ((Log[x])^2)-(x^3) ((Log[x])^2))),x]

RischIntegration[(1/(x (((x+(E^x) Log[x]))^2)))(-x+(x^3)+(x^3) Log[x]+(E^(2 x)) (-x+x Log[x])+(E^x) (-1+(x^3)-x Log[x]+2 (x^2) ((Log[x])^2)-(x^3) ((Log[x])^2))),x]

Next,

IntegrateTranscendentalMonomial[1+(t/(1+t))-(1/(x^2))+(1/(t0 x))+2 x,{x,t0,t},{1,(1/x),t}]

This is equivalent to

Integrate[1+((E^x)/(1+(E^x)))-(1/(x^2))+2 x+(1/(x Log[x])),x]

The nex example lies in ℚ((Sqrt[π]))(x, t0, t) where t0 = Exp[-(x^2)]and t = Erf[x].

IntegrateTranscendentalMonomial[((t t0)/(1-t-(t^2)+(t^3))),{x,t0,t},{1,-2x t0,(2/(Sqrt[π]))t0}]

This is equivalent to

Integrate[(((E^(-(x^2))) Erf[x])/(1-Erf[x]-((Erf[x])^2)+((Erf[x])^3))),x]

RischIntegration[(((E^(-(x^2))) Erf[x])/(1-Erf[x]-((Erf[x])^2)+((Erf[x])^3))),x]

The next examples lie in ℚ(x, t0, t) where t0 = Exp[x] and t = ArcTan[Exp[x]].

IntegrateTranscendentalMonomial[((t+(t0^2) t+t0 x)/(1+(t0^2))),{x,t0,t},{1,t0,(t0/(1+(t0^2)))}]

This is equivalent to

Integrate[(((E^x) x+ArcTan[(E^x)]+(E^(2 x)) ArcTan[(E^x)])/(1+(E^(2 x)))),x]

Next,

IntegrateTranscendentalMonomial[t0+(t0/(t (1+(t0^2))))+2 t x+t0 x+((t0 (x^2))/(1+(t0^2))),{x,t0,t},{1,t0,(t0/(1+(t0^2)))}]//Expand

This is equivalent to

Integrate[(E^x)+(E^x) x+(((E^x) (x^2))/(1+(E^(2 x))))+((E^x)/((1+(E^(2 x))) ArcTan[(E^x)]))+2 x ArcTan[(E^x)],x]

The next example lies in ℚ(x, t0,t1, t) where , t0 = Log[x], t1 = Exp[x], and t = ArcTan[Exp[x]].

IntegrateTranscendentalMonomial[((1-t+t0+x+t1 (1+x)+(t1^2) (1-t+t0+x))/((1+(t1^2)) (((1+x))^2))),{x,t0,t1,t},{1,(1/x),t1,(t1/(1+(t1^2)))}]//Together

This is equivalent to

Integrate[((1+x+(E^x) (1+x)-ArcTan[(E^x)]+Log[x]+(E^(2 x)) (1+x-ArcTan[(E^x)]+Log[x]))/((1+(E^(2 x))) (((1+x))^2))),x]

The following example lies in ℚ(x, t0, t) where t0 = Exp[-(x^2)] and t = Exp[Exp[-(x^2)]].

IntegrateTranscendentalMonomial[((t0-2 t x-2 t t0 x-3 t0 (x^2)-2 t t0 (x^3)-2 t0 (x^4))/(((1+(x^2)))^2)),{x,t0,t},{1,-2x t0,-2x t0 t}]

This is equivalent to

Integrate[(((E^(-(x^2)))-2 (E^(E^(-(x^2)))) x-2 (E^((E^(-(x^2)))-(x^2))) x-3 (E^(-(x^2))) (x^2)-2 (E^((E^(-(x^2)))-(x^2))) (x^3)-2 (E^(-(x^2))) (x^4))/(((1+(x^2)))^2)),x]

Finally, the next example lies in ℚ((Sqrt[π]))(x, t0, t1, t) where t0 = Log[x], t1 = Exp[-(x^2)], and t = Erf[x].  Note that the time is not optimal.

Timing@IntegrateTranscendentalMonomial[-((2 t t0 x)/(((1+(x^2)))^2))+((2 t0 t1)/((Sqrt[π]) (1+(x^2))))+(t/(x (1+(x^2)))),{x,t0,t1,t},{1,(1/x),-2x t1, (2/(Sqrt[π]))t1}]

Timing[Integrate@@{-((2 t t0 x)/(((1+(x^2)))^2))+((2 t0 t1)/((Sqrt[π]) (1+(x^2))))+(t/(x (1+(x^2))))/.{t0->Log[x],t1->Exp[-x^2],t->Erf[x]},x}]

Sam Blake examples

First example

(1/(x Log[1+(E^x)]))-(((E^x) Log[x])/((1+(E^x)) ((Log[1+(E^x)])^2)))/.{Log[1+Exp[x]]->t, Exp[x]->t1,Log[x]->t0}

Timing@IntegrateTranscendentalMonomial[-((t0 t1)/((t^2) (1+t1)))+(1/(t x)), {x,t0,t1,t},{1,(1/x),t1,(t1/(1+t1))}]

Second example

(x (1+x) (2 (E^(3 (x^2))) x (x-(1+x+2 (x^2)+2 (x^3)) Log[1+x])+((((E^(2 (x^2))) (x^2)-((Log[1+x])^2)))^2)))/(((-(E^(2 (x^2))) ((x^2)+(x^3))+(1+x) ((Log[1+x])^2)))^2)/.{Log[1+x]->t0, Exp[(x^2)]->t,Exp[2(x^2)]->(t^2),Exp[3(x^2)]->(t^3)}//Together

Timing@IntegrateTranscendentalMonomial[-(x (-(t0^4)+2 (t^3) t0 x-2 (t^3) (x^2)+2 (t^3) t0 (x^2)+2 (t^2) (t0^2) (x^2)+4 (t^3) t0 (x^3)-(t^4) (x^4)+4 (t^3) t0 (x^4)))/((1+x) (((-(t0^2)+(t^2) (x^2)))^2)),{x,t0,t},{1,(1/(x+1)),2x t}]

Checking the answer

-(x (-(t0^4)+2 (t^3) t0 x-2 (t^3) (x^2)+2 (t^3) t0 (x^2)+2 (t^2) (t0^2) (x^2)+4 (t^3) t0 (x^3)-(t^4) (x^4)+4 (t^3) t0 (x^4)))/((1+x) (((-(t0^2)+(t^2) (x^2)))^2))-Derivation[{x,t0,t},{1,(1/(x+1)),2x t}][-t0+x+((t t0 x)/(-(t0^2)+(t^2) (x^2)))+(1/2) Log[-(t0^2) x+t0 (x^2)-t t0 (x^2)-(t0^2) (x^2)+t (x^3)-t t0 (x^3)-2 (t0^2) (x^3)-2 t t0 (x^4)-2 (t0^2) (x^4)-2 t t0 (x^5)]-(1/2) Log[(t0^2) x-t0 (x^2)-t t0 (x^2)+(t0^2) (x^2)+t (x^3)-t t0 (x^3)+2 (t0^2) (x^3)-2 t t0 (x^4)+2 (t0^2) (x^4)-2 t t0 (x^5)]]//Together

D[ (((Exp[((-1)/(x+Exp[x]))])^2)/(x+Exp[x])),x]/.{Exp[x]->t0,Exp[((-1)/(x+Exp[x]))]->t,Exp[((-2)/(x+Exp[x]))]->(t^2)}

Timing@IntegrateTranscendentalMonomial[((2 (t^2) (1+t0))/(((t0+x))^3))-(((t^2) (1+t0))/(((t0+x))^2)),{x,t0,t},{1,t0,((t (1+t0))/(((t0+x))^2))}]

Timing@Integrate[D[ (((Exp[((-1)/(x+Exp[x]))])^2)/(x+Exp[x])),x],x]

f=(x^2-1)/x+1/(x+E^x);

((((E^x)-(x^2)+2 x) (E^f))/((x^2) (((x+(E^x)))^2)))

D[f,x]//Simplify

IntegrateTranscendentalMonomial[(((t-(x^2)+2x)t1)/((x^2)(((x+t))^2))),{x,t,t1},{1,t,t1(1+(1/(x^2))-((1+t)/(((t+x))^2)))}]

ParametricLogarithmicDerivative[-((1+(x^2))/(x^2)),t,t,{x},{1}]

D[(E^(-x+(1/((E^x)+x))+((-1+(x^2))/x))),x]//Together

((((E^x)-(x^2)+2 x) (E^f))/((x^2) (((x+(E^x)))^2)))//Together

M. Rothstein Example

((2581284541 Exp[x]+1757211400)/(39916800 Exp[3x]+119750400Exp[2x]+119750400 Exp[x]+39916800))Exp[(1/(Exp[x]+1))-10x]/.{Exp[x]->t0,Exp[2x]->(t0^2),Exp[3x]->(t0^3), (E^((1/(1+(E^x)))-10 x))->t}

IntegrateTranscendentalMonomial[((t (1757211400+2581284541 t0))/(39916800+119750400 t0+119750400 (t0^2)+39916800 (t0^3))),{x,t0,t},{1,t0,t(-10-(t0/(((1+t0))^2)))}]//Timing

Integrate[(((E^((1/(1+(E^x)))-10 x)) (1757211400+2581284541 (E^x)))/(39916800+119750400 (E^x)+119750400 (E^(2 x))+39916800 (E^(3 x)))),x]//Timing

Hypertangent Monomials

IntegrateTranscendentalMonomial, as today, can integrate a tower containing hypertangent monomials if there is no primitive monomial after a hypertangent element.  If there is a primitive element after a hypertangent element then it can integrate the integrand if the cancellation case for hypertangent monomial in ParamRischDE is not called.

The following examples are in ℚ(x, t) for t = Tan[x]

IntegrateTranscendentalMonomial[(1/t)+(1+(t^2)) (1-((1+x)/(t^2))),{x,t},{1,1+(t^2)}]

IntegrateTranscendentalMonomial[(t^2)+(1+(t^2)) (1-(1/(t^2))+2 t x),{x,t},{1,1+(t^2)}]

Update[];
Block[{$DebugRisch=True},IntegrateTranscendentalMonomial[(t^2)+t (1-(1/(t^2))+2 t x),{x,t},{1,1+(t^2)}]]

The following examples lies in ℚ(x,t0,t) where t0 = Exp[(x^2)]and t = Tan[Exp[(x^2)]].

IntegrateTranscendentalMonomial[2 (t^3) x+2 t t0 x+2 (1+(t^2)) t0 x (t0+3 (t^2) (x^2)),{x,t0,t},{1,2x t0,2x t0(1+(t^2))}]//Timing

This is equivalent to

Integrate[2 (E^(x^2)) x Tan[(E^(x^2))]+2 x ((Tan[(E^(x^2))])^3)+2 (E^(x^2)) x (1+((Tan[(E^(x^2))])^2)) ((E^(x^2))+3 (x^2) ((Tan[(E^(x^2))])^2)),x]//Timing

Update[];
Block[{$DebugRisch = True},RischIntegration[2 (E^(x^2)) x Tan[(E^(x^2))]+2 x ((Tan[(E^(x^2))])^3)+2 (E^(x^2)) x (1+((Tan[(E^(x^2))])^2)) ((E^(x^2))+3 (x^2) ((Tan[(E^(x^2))])^2)),x]]

D[Tan[Log[x+1]],x]/.(((Sec[Log[1+x]])^2)->1+(t^2))

Derivation[{x,t0,t1,t},{1,(1/(x+1)),2x t1,((1+(t^2))/(1+x))}][x t t1+3(t^7)]/.{t->Tan[Log[x+1]],t1->Exp[(x^2)],t0->Log[x+1]}

The following examples lie in ℚ(x,t0,t1,t) where t0 = Log[x+1], t1 = Exp[(x^2)], and t = Tan[Log[x+1]].

Timing[IntegrateTranscendentalMonomial[t t1+2 t t1 (x^2)+(((1+(t^2)) (21 (t^6)+t1 x))/(1+x)),{x,t0,t1,t},{1,(1/(x+1)),2x t1,((1+(t^2))/(1+x))}]//Together]

This is equivalennt to

Integrate[(E^(x^2)) Tan[Log[1+x]]+2 (E^(x^2)) (x^2) Tan[Log[1+x]]+(((1+((Tan[Log[1+x]])^2)) ((E^(x^2)) x+21 ((Tan[Log[1+x]])^6)))/(1+x)),x]//Timing

RischIntegration[(E^(x^2)) Tan[Log[1+x]]+2 (E^(x^2)) (x^2) Tan[Log[1+x]]+(((1+((Tan[Log[1+x]])^2)) ((E^(x^2)) x+21 ((Tan[Log[1+x]])^6)))/(1+x)),x]//Together//Timing

Next,

IntegrateTranscendentalMonomial[t1+2 t1 (x^2)+((1+(t^2))/(t (1+x))),{x,t0,t1,t},{1,(1/(x+1)),2x t1,((1+(t^2))/(1+x))}]//Timing

The next example lies in ℚ(x,t0,t) for t0 = Tan[x] and t = Exp[Tan[x]].

Update[];
Block[{$DebugRisch=True},IntegrateTranscendentalMonomial[(t0/t)+4 t t0 (x^3)+(1+(t0^2)) ((x/t)+t (x^4))+t (1+(t0^2)) (-((t0 x)/(t^2))+t0 (x^4)),{x,t0,t},{1,1+(t0^2),t(1+(t0^2))}]]

This is equivalent to

Integrate[(E^(-Tan[x])) Tan[x]+4 (E^(Tan[x])) (x^3) Tan[x]+((E^(-Tan[x])) x+(E^(Tan[x])) (x^4)) (1+((Tan[x])^2))+(E^(Tan[x])) (-(E^(-2 Tan[x])) x Tan[x]+(x^4) Tan[x]) (1+((Tan[x])^2)),x]//Timing

RischIntegration[(E^(-Tan[x])) Tan[x]+4 (E^(Tan[x])) (x^3) Tan[x]+((E^(-Tan[x])) x+(E^(Tan[x])) (x^4)) (1+((Tan[x])^2))+(E^(Tan[x])) (-(E^(-2 Tan[x])) x Tan[x]+(x^4) Tan[x]) (1+((Tan[x])^2)),x]//Timing

Parallel Risch

Rational Functions

pmint is able to handle the following examples.

R1=(1/( (x^2)+1));

pmint[R1,x]

R2=(2/((((x^2)+1))^2));

pmint[R2,x]

D[%,x]//Simplify

F[n_]:=pmint[((x^n)/(Product[x+k,{k,n}])),x]

F[1]

F[2]

F[3]

pmint[(1/(25(x^2)+4)),x]

pmint has problem handling Rational Functions with poles not in ℝ ⋃  ℚ(i) .

pmint[(((x^2)+x+1)/((x^4)+5)),x]

pmint[(((x^7)+1)/((x^9)-1)),x]

pmint[(1/((x^2)+2)),x]

However, I'm sure that the reason is that in the implementation of pmIntegrate we only adjoin to ℚ at most one element and this element turns out to be i.  For that reason the first six integrals work.

Exponentials and Logs

pmint[Exp[x],x]

pmint[Log[x],x]

pmint[x Exp[x]+Log[x],x]

D[%,x]//Simplify

pmint[(x^4)Log[x],x]

D[%,x]//Simplify

pmint[((Exp[x])^3)(x^7)+4((Log[x])^2),x]

D[%,x]//Together

pmint[((-2 (E^(2 x))+2 (E^(2 x)) x+3 (Sqrt[3]) ((Log[-1+x])^2))/((-1+x) ((E^(2 x))+(Sqrt[3]) ((Log[-1+x])^3)))),x]

The following example which is doable by parallel Risch bogs down because the number of monomials we want to feed into linear solve is horrendous. Total degree is 188 and number of variables is 3.

Timing[pmint[(((Sqrt[13])+(x^2)) (-6+(Sqrt[3]) (x^91)) Log[(Sqrt[13])+(x^2)]-x ((Sqrt[7])+x) Log[(Sqrt[7])+x] (2 (-6+(Sqrt[3]) (x^91))+91 (Sqrt[3]) (x^89) ((Sqrt[13])+(x^2)) Log[(Sqrt[13])+(x^2)]))/(((Sqrt[7])+x) ((Sqrt[13])+(x^2)) (((-2 (Sqrt[3])+(x^91)))^2) ((Log[(Sqrt[13])+(x^2)])^2)),x]]

Timing[Integrate[(((Sqrt[13])+(x^2)) (-6+(Sqrt[3]) (x^91)) Log[(Sqrt[13])+(x^2)]-x ((Sqrt[7])+x) Log[(Sqrt[7])+x] (2 (-6+(Sqrt[3]) (x^91))+91 (Sqrt[3]) (x^89) ((Sqrt[13])+(x^2)) Log[(Sqrt[13])+(x^2)]))/(((Sqrt[7])+x) ((Sqrt[13])+(x^2)) (((-2 (Sqrt[3])+(x^91)))^2) ((Log[(Sqrt[13])+(x^2)])^2)),x]]

D[BesselJ[ν+1,z]/BesselJ[ν,z],z]//Simplify`ShiftBesselIndexTo[#,BesselJ,ν,FullSimplify]&

Integrate[1-(((1+2 ν) BesselJ[1+ν,z])/(z BesselJ[ν,z]))+(((BesselJ[1+ν,z])^2)/((BesselJ[ν,z])^2)),z]

Trigonometric Functions

Some examples that works.

pmint[(x^20)Sin[x],x]//Timing

pmint[(x^20)Sin[x],x]//Timing

Note that Mathematica 6.0 is MUCH faster!

Integrate[(x^20)Sin[x],x]//Timing

pmint[Sin[x],x]

D[%,x]//Simplify

pmint[(x^2)Sin[x],x]

D[%,x]//Simplify

pmint[(1/x)+(x^2)Sin[x],x]

D[%,x]//FullSimplify

Some examples that don't work.

pmint[(1/(2+Sin[x])),x]

pmint[(x/(Sin[x])),x]

Louvillian Special Functions

f:=(((E^(-(x^2))) Erf[x])/(((Erf[x])^3)-((Erf[x])^2)-Erf[x]+1));

pmint[f,x]

D[%,x]-f//Simplify

f1 = Erf[x];

pmint[f1,x]

f2=((2 (E^(-(x^2))) (1+x))/(Sqrt[π]))+Erf[x];

pmint[f2,x]//Simplify

Airy Funcions

Mathematica 6.0 is unable to integrate the following "Airy functions".

Clear[a];

f1=((x-AiryAi[x] AiryAi'[x])/((x^2)-((AiryAi[x])^2)));
f2=(1/(((1+(x^2)))^2))(E^x) (AiryAi[x]-2 x AiryAi[x]+(x^2) AiryAi[x]+AiryAiPrime[x]+(x^2) AiryAiPrime[x]);
f3=(((E^(AiryAi[x])) AiryAiPrime[x])/(x+((AiryAi[x])^3)))-(((E^(AiryAi[x])) (1+3 ((AiryAi[x])^2) AiryAiPrime[x]))/(((x+((AiryAi[x])^3)))^2));
f4=((x AiryAiPrime[x] Cos[AiryAi[x]]-Sin[AiryAi[x]])/(x^2));
f5=(1/(((a+x))^2))(a AiryAiPrime[x] Cos[AiryAi[x]]+x AiryAiPrime[x] Cos[AiryAi[x]]-Sin[AiryAi[x]]);
f6 = AiryAi[x] Cos[x]+AiryAiPrime[x] Sin[x];
f7 = -((Cos[1+((AiryAi[x])^2)])/(((1+x))^2))-((2 AiryAi[x] AiryAiPrime[x] Sin[1+((AiryAi[x])^2)])/(1+x));
f8 = x AiryAiPrime[x] Cos[AiryAi[x]]+Sin[AiryAi[x]];
f9 = ((AiryAiPrime[x])/(AiryAi[(x^2)]))-((2 x AiryAi[x] AiryAiPrime[(x^2)])/((AiryAi[(x^2)])^2));

Integrate[f1,x]

Integrate[f2,x]

Integrate[f3,x]

Integrate[f4,x]

Integrate[f5,x]

Integrate[f6,x]

Integrate[f7,x]

Integrate[f8, x]

Integrate[f9,x]

However, for these cases, pmint is able to calculate their integrals

Update[];
Block[{$DebugRisch= False},pmint[f1,x]]

pmint[f2,x]//Simplify

pmint[f3,x]//Simplify

pmint[f4,x]//Simplify

pmint[f5,x]//Simplify

pmint[f6,x]//Simplify

pmint[f7,x]//Simplify

pmint[f8,x]//Simplify

pmint[f9,x]

Bessel Functions

Clear[g]

Derivative[1][g]=Function[z,1+(((-1-ν)/z)-(ν/z))g[z]+((g[z])^2)]

D[1/g[x]+g[x]Log[g[x]],x]//Expand

Block[{ν=1/2},pmint[%,x]]//Expand

Mathematica 6.1, as of today, has problem with the following "Bessel Functions".

Derivative[1][t1]=Function[z,(ν/z) t1[z]-t2[z]];
Derivative[1][t2]=Function[z,t1[z]-((ν+1)/z)t2[z]];

pmint[((t2[z])/(t1[z])),z]

Integrate[((t2[z])/(t1[z])),z]

pmint[g[x]+(1/(g[x])),x]

Integrate[g[x]+(1/(g[x])),x]

Lambert W

Some examples

pmint[ProductLog[x],x]

D[%,x]//Simplify

pmint[Sin[ProductLog[x]],x]//Simplify

Mathematica 6.0, as it is today, is unable to calculate the integrals of the following "Lambert W" functions.

f1 = ((ProductLog[Sin[x]]+x Cot[x] ProductLog[Sin[x]]+((ProductLog[Sin[x]])^2))/(1+ProductLog[Sin[x]]));
f2 = (-ProductLog[Sin[x]]+Cot[x] ProductLog[Sin[x]]-x Cot[x] ProductLog[Sin[x]]-((ProductLog[Sin[x]])^2))/(1+ProductLog[Sin[x]]);
f3 = ((2 ProductLog[x]+((ProductLog[x])^2))/(1+ProductLog[x]+(x^2) ((ProductLog[x])^2)+(x^2) ((ProductLog[x])^3)));

Integrate[f1,x]

Integrate[f2,x]

Integrate[f3,x]

pmint is able to handle these integrals.

pmint[f1,x]//Simplify

pmint[f2,x]//Simplify

pmint[f3,x]//FullSimplify

Combinations of some Specials Functions

Some Examples

Clear[g]
Derivative[1][g]=Function[z,1+(((-1-ν)/z)-(ν/z))g[z]+((g[z])^2)];
f1=AiryAiPrime[x] ProductLog[x]+((AiryAi[x] ProductLog[x])/(x (1+ProductLog[x])));
f2=(x AiryAiPrime[x]+ProductLog[x]+AiryAi[x] ProductLog[x]+2 x AiryAiPrime[x] ProductLog[x]+x AiryAiPrime[x] ((ProductLog[x])^2))/(x (1+ProductLog[x]));
f3 =((AiryAiPrime[x])/(AiryAi[x]+ProductLog[x]))+((ProductLog[x])/(x (1+ProductLog[x]) (AiryAi[x]+ProductLog[x])));
f4 = ((1+AiryAi[x]+x AiryAiPrime[x]+(((-1-ν)/x)-(ν/x)) g[x]+((g[x])^2))/(x AiryAi[x]+g[x]));
f5 = ((AiryAi[x] ArcTan[x])/x)+((AiryAi[x] Log[x])/(1+(x^2)))+AiryAiPrime[x] ArcTan[x] Log[x];
f6=(-(E^((AiryAi[x])/(ArcTan[x]))) AiryAi[x]+(E^((AiryAi[x])/(ArcTan[x]))) AiryAiPrime[x] ArcTan[x]+(E^((AiryAi[x])/(ArcTan[x]))) (x^2) AiryAiPrime[x] ArcTan[x])/((1+(x^2)) ((ArcTan[x])^2));
f7 = (((x^2) AiryAiPrime[1+x Log[1+x ArcTan[1+x]]])/((1+(((1+x))^2)) (1+x ArcTan[1+x])))+((x AiryAiPrime[1+x Log[1+x ArcTan[1+x]]] ArcTan[1+x])/(1+x ArcTan[1+x]))+AiryAiPrime[1+x Log[1+x ArcTan[1+x]]] Log[1+x ArcTan[1+x]];

Mathematica 6.0 answers

Integrate[f1,x]

Integrate[f2,x]

Integrate[f3,x]

Integrate[f4,x]

Integrate[f5,x]

Integrate[f6,x]

Integrate[f7,x]

pmint answers

Update[]
Block[{$DebugRisch = True},pmint[f1,x]]//Simplify

pmint[f1,x]//Simplify//Timing

pmint[f2,x]//Simplify

pmint[f3,x]//Simplify

pmint[f4,x]

pmint[f5,x]//Simplify

pmint[f6,x]//Simplify

pmint[f7, x] //Simplify

Another Example, in this one Mathematica 6.0 wins!

Timing[pmint[D[Log[ProductLog[AiryAi[x]]],x],x]]

Timing[Integrate[D[Log[ProductLog[AiryAi[x]]],x],x]]

Problems to address

Monomial Hermite Reduce

Monomial Hermite Reduce produces

f3=(((x^2)(t^5)+x (t^4)-ν (t^3)-x((x^2)+1)(t^2)-((x^2)-(ν^2))t - (x^5)/4)/((x^2) (t^4)+(x^2)((x^2)+2)(t^2)+(x^2)+(x^4)+(x^6)/4));

MonomialHermiteReduce[f3,{x,t},{1,-(t^2)-(t/x)-(1-((ν^2)/(x^2)))}]//Together//Simplify

This example should return {-((1+(x^2)/4)/((t^2)+2+(x^2)/2)),-((((ν^2)+(x^4)/2)t+(x^3)+x)/((x^2)(t^2)+(x^2)+(x^4)/2)),t+(1/x)}

Candidate Tower

The following is an example where candidateTower works fine.

candidateTower[{Log[Log[x]]},x]

ToIndetsAndDerivation[Log[Log[x]] ,x,t]

The follwing is an example where candidateTower give the "correct" tower, but out of order.

candidateTower[{Exp[tan[x]]},x]

ToIndetsAndDerivation[Exp[tan[x]] ,x,t]

The following example is an example where candidateTower fails to recognize algebraic dependences.

candidateTower[{Exp[1+x]},x]

ToIndetsAndDerivation[Exp[x+1] ,x,t]

ToIndetsAndDerivation[Exp[1+x],x,t]

The following example is a mess!  All the problems in candidateTower show up.

candidateTower[{Exp[x+Cos[Log[x]]]},x]

The following are examples where candidateTower will stop and failed.  I put a restriction of 25 recursion calls.  So, if the user enters and invalid function like say, Gamma[x] of Sqrt[x], candidateTower will stop.

candidateTower[{Cos[x],Gamma[x]},x]

candidateTower[{Exp[x],Log[x],Sqrt[x],Log[Log[x]]},x]

Example of Parametric Risch DE

The following example bothers me.  Note that if t = log(x) then D(t) = 1/x. So, if f = 1/t then D(t) + f t = 1/x +1.  Therefore ParamRischDE[1/t,{1,1/x},{x,t},{1,1/x}] should return a set of functions, say h and a matrix A such that by taking the null space of A we recover the above solution.  Now, note that the method fails.

Update[];
Block[{$DebugRisch = True},ParamRischDE[(1/t),{1,(1/x)},{x,t},{1,(1/x)}]]

Running the part of the code that is before ReduceToParamPolyRischDE I observed that it transforms the equation to one of the form 
aD(p)+bp = Sum(ci qi)  where a = t x, b = -t + x, q's ={ t (x^2), t x} and k(t) = ℚ(x)(t) and n = deg( p ) ≤ 1. Since at the end we want to solve an equation of the form D(p)+bp = Sum(ci qi)  for b, p, qi  (1)  in  k(t) then we apply ReduceToParamPolyRischDE  to it.

ReduceToParamPolyRischDE[t x,-t+x,{t (x^2),t x},{x,t},{1,(1/x)},15]

So, we have that ReduceToParamPolyRischDE fails. Now, what this procedure is doing is reapply ParamSPDE again and again (as M. Bronsteing suggests) until we get an equation of the form (1). So, I apply ParamSPDE once and see what happens.

ParamSPDE[t x,-t+x,{t (x^2),t x},{x,t},{1,(1/x)},1]

Note that it changes the equation of one of the same type with a = t x, b = 1+ x,  and q's ={ x, 1} and n = 0.  If I reapply it again I get a similar system with n = -1, which is the reason what ReduceToParamPolyRischDE fails.

ParamSPDE[t x,1+x,{x,1},{x,t},{1,(1/x)},0]

Looks like there is an error or that the equation aD(p)+bp = Sum(ci qi)  with a = t x, b = -t + x, q's ={ t (x^2), t x} cannot be reduced to one of the form (1).  Below, you can see the top part of the code. (the one before ReduceToParamPolyRischDE).

{f, g, lv, ld} ={(1/t),{1,(1/x)},{x,t},{1,(1/x)}};

theT=Last[lv];

DD=Derivation[lv,ld];

m=Length[g]

q1=WeakNormalizer[f,lv,ld]

F=f-DD[q1]/q1//Together

G=q1*g

{a,b,G,h1}=ParamRdeNormalDenominator[F,G,lv,ld]

{a,b,G,h2}=ParamRdeSpecialDenominator[a,b,G,lv,ld]

{G,AA}=LinearConstraints[a,b,G,lv,ld]

{AA,zero}=ConstantSystem[AA,ConstantArray[0,Length[AA]],lv,ld]

n=ParamRdeBoundDegree[a,b,G,lv,ld]

Since we know that t and {(Subscript[c, 1]), (Subscript[c, 2])} = {1,1} is a solution of the initial problem, then setting y = (Subscript[h, 1])(Subscript[h, 2]) (Subscript[q, 1])t should be a solution of (tx)D(y) + (x-t) y = tx+t(x^2).

y = h1 h2 q1 t;

Collect[a DD[y] +b y,{x,t}]

So, the two systems are equivalent, but I cannot reduce (tx)D(y) + (x-t) y =(Subscript[c, 1]) tx+(Subscript[c, 2]) t(x^2) to one of the form D(y) + b y = (Subscript[c, 1]) (Subscript[q, 1])+(Subscript[c, 2]) (Subscript[q, 2]) where b, y, (Subscript[q, 1]),(Subscript[q, 2])are in k[t].

A problem in IntegrateRationalFunction.

The following types of integrals produces an error in IntegrateRationalFunction

F[n_]:=IntegrateRationalFunction[((x^n)/((x^(n+1))+1)),x]

F[2]

F[3]

If we go to the code of IntegrateRationalFunction and put LazardRiobooTrager[x*R, x*Denominator[h], x] instead of LazardRiobooTrager[R, Denominator[h], x] then it returns an elementary integral.

Problem with order of the elements in the tower

The following integral is doable

IntegrateTranscendentalMonomial[(1/(x t))-(t1/t),{x,t1,t},{1,(1/x),t}]

However if I switch the order of t1 and t then is not doable. (Note we can switch them because they are indep)

IntegrateTranscendentalMonomial[(1/(x t))-(t1/t),{x,t,t1},{1,t,(1/x)}]

Let us enable the print messages to see what is going on.

Update[];
Block[{$DebugRisch=True},IntegrateTranscendentalMonomial[(1/(x t))-(t1/t),{x,t,t1},{1,t,(1/x)}]]

As you can see the problem is comming from trying to reduce and equation of the form a Dp+bp=sum[(Subscript[c, i])(Subscript[q, i])] to one of the form Dp+bp=sum[(Subscript[c, i])(Subscript[q, i])]

A problem

This integral works fine now because I when into the code of RadicalLogarithmicDerivativeQ and put "Quiet" in some of the statements.  However, when I did something to avoid the messages, but truned out that the integral was taking 22 secs.   I need to analized this example carefuly.  (the messages comes because when I do CollectLog[0], I get 0.  But since I'm expecting a Log, I take First after CollectLog)

Update[];
Block[{$DebugRisch = False},IntegrateTranscendentalMonomial[((2 t0 t1)/(Sqrt[π]))+t t0+((2 t1)/((Sqrt[π]) t))+(1/x),{x,t0,t1,t2,t},{1,t0,-2x t1,(1/x), (2/(Sqrt[π]))t1}]]//Expand

Missing Algorithms

We miss the cancellation case of ParamRischDE for HyperTangentMonomials.

Need to improve ParametricLogarithmicDerivative.  As today, it is heuristic.  Need to complete tower in order to use THM's from ch 9.

References

Manuel Bronstein (1997): Symbolic Integration 1: Transcendental Functions. Algorithms and Computation in Mathematics 1, Springer-Verlag, Berling Heidelberg.

Manuel Bronstein (2007): Structure Theorems for Parallel Integration. Journal of Symbolic Computation, 42 p. 757-769.

Manuel Bronstein (1998): Symbolic Integration Tutorial. Course notes, ISSAC'98.

Manuel Bronstein :  The Poor Man' s Integrator. http : // www - sop.inria.fr/cafe/Manuel.Bronstein/pmint/index.html

Robert H. Risch (1969): The Problem of Integration in Finite Terms. Transaction of the American Mathematical Society, 139 p. 167-189.