text:
@testset "8.9 Product logarithm function" begin
    (a, b, c, d, m, n, p, x, ) = @variables a b c d m n p x

    #= ::Package:: =#

    #= ::Title:: =#
    #=Integration*Problems*Involving*the*Lambert*W*(ProductLogarithm)*Function=#

    #= ::Subsection::Closed:: =#
    #=Integrands*involving*ProductLog(a+b*x)=#

    #= ::Subsubsection::Closed:: =#
    #=ProductLog(a+b*x)^n=#

    @test_int [ProductLog(a + b*x)^4, x, 6, 96*x - (96*(a + b*x))/(b*ProductLog(a + b*x)) - (48*(a + b*x)*ProductLog(a + b*x))/b + (16*(a + b*x)*ProductLog(a + b*x)^2)/b - (4*(a + b*x)*ProductLog(a + b*x)^3)/b + ((a + b*x)*ProductLog(a + b*x)^4)/b]
    @test_int [ProductLog(a + b*x)^3, x, 5, -18*x + (18*(a + b*x))/(b*ProductLog(a + b*x)) + (9*(a + b*x)*ProductLog(a + b*x))/b - (3*(a + b*x)*ProductLog(a + b*x)^2)/b + ((a + b*x)*ProductLog(a + b*x)^3)/b]
    @test_int [ProductLog(a + b*x)^2, x, 4, 4*x - (4*(a + b*x))/(b*ProductLog(a + b*x)) - (2*(a + b*x)*ProductLog(a + b*x))/b + ((a + b*x)*ProductLog(a + b*x)^2)/b]
    @test_int [ProductLog(a + b*x), x, 3, -x + (a + b*x)/(b*ProductLog(a + b*x)) + ((a + b*x)*ProductLog(a + b*x))/b]
    @test_int [1/ProductLog(a + b*x), x, 2, ExpIntegralEi(ProductLog(a + b*x))/b + (a + b*x)/(b*ProductLog(a + b*x))]
    @test_int [1/ProductLog(a + b*x)^2, x, 2, (2*ExpIntegralEi(ProductLog(a + b*x)))/b - (a + b*x)/(b*ProductLog(a + b*x)^2)]
    @test_int [1/ProductLog(a + b*x)^3, x, 3, (3*ExpIntegralEi(ProductLog(a + b*x)))/(2*b) - (a + b*x)/(2*b*ProductLog(a + b*x)^3) - (3*(a + b*x))/(2*b*ProductLog(a + b*x)^2)]
    @test_int [1/ProductLog(a + b*x)^4, x, 4, (2*ExpIntegralEi(ProductLog(a + b*x)))/(3*b) - (a + b*x)/(3*b*ProductLog(a + b*x)^4) - (2*(a + b*x))/(3*b*ProductLog(a + b*x)^3) - (2*(a + b*x))/(3*b*ProductLog(a + b*x)^2)]
    @test_int [1/ProductLog(a + b*x)^5, x, 5, (5*ExpIntegralEi(ProductLog(a + b*x)))/(24*b) - (a + b*x)/(4*b*ProductLog(a + b*x)^5) - (5*(a + b*x))/(12*b*ProductLog(a + b*x)^4) - (5*(a + b*x))/(24*b*ProductLog(a + b*x)^3) - (5*(a + b*x))/(24*b*ProductLog(a + b*x)^2)]

    @test_int [(c*ProductLog(a+b*x))^(5/2), x, 5, (75*c^(5/2)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(16*b) - (75*c^3*(a + b*x))/(8*b*sqrt(c*ProductLog(a + b*x))) + (25*c^2*(a + b*x)*sqrt(c*ProductLog(a + b*x)))/(4*b) - (5*c*(a + b*x)*(c*ProductLog(a + b*x))^(3/2))/(2*b) + ((a + b*x)*(c*ProductLog(a + b*x))^(5/2))/b]
    @test_int [(c*ProductLog(a+b*x))^(3/2), x, 4, -((9*c^(3/2)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(8*b)) + (9*c^2*(a + b*x))/(4*b*sqrt(c*ProductLog(a + b*x))) - (3*c*(a + b*x)*sqrt(c*ProductLog(a + b*x)))/(2*b) + ((a + b*x)*(c*ProductLog(a + b*x))^(3/2))/b]
    @test_int [sqrt(c*ProductLog(a+b*x)), x, 3, (sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(4*b) - (c*(a + b*x))/(2*b*sqrt(c*ProductLog(a + b*x))) + ((a + b*x)*sqrt(c*ProductLog(a + b*x)))/b]
    @test_int [1/sqrt(c*ProductLog(a+b*x)), x, 2, (sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(2*b*sqrt(c)) + (a + b*x)/(b*sqrt(c*ProductLog(a + b*x)))]
    @test_int [1/(c*ProductLog(a+b*x))^(3/2), x, 2, (3*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(b*c^(3/2)) - (2*(a + b*x))/(b*(c*ProductLog(a + b*x))^(3/2))]
    @test_int [1/(c*ProductLog(a+b*x))^(5/2), x, 3, (10*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(3*b*c^(5/2)) - (2*(a + b*x))/(3*b*(c*ProductLog(a + b*x))^(5/2)) - (10*(a + b*x))/(3*b*c*(c*ProductLog(a + b*x))^(3/2))]
    @test_int [1/(c*ProductLog(a+b*x))^(7/2), x, 4, (28*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(15*b*c^(7/2)) - (2*(a + b*x))/(5*b*(c*ProductLog(a + b*x))^(7/2)) - (14*(a + b*x))/(15*b*c*(c*ProductLog(a + b*x))^(5/2)) - (28*(a + b*x))/(15*b*c^2*(c*ProductLog(a + b*x))^(3/2))]

    @test_int [(-c*ProductLog(a+b*x))^(5/2), x, 5, (75*c^(5/2)*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(16*b) + (75*c^3*(a + b*x))/(8*b*sqrt((-c)*ProductLog(a + b*x))) + (25*c^2*(a + b*x)*sqrt((-c)*ProductLog(a + b*x)))/(4*b) + (5*c*(a + b*x)*((-c)*ProductLog(a + b*x))^(3/2))/(2*b) + ((a + b*x)*((-c)*ProductLog(a + b*x))^(5/2))/b]
    @test_int [(-c*ProductLog(a+b*x))^(3/2), x, 4, (9*c^(3/2)*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(8*b) + (9*c^2*(a + b*x))/(4*b*sqrt((-c)*ProductLog(a + b*x))) + (3*c*(a + b*x)*sqrt((-c)*ProductLog(a + b*x)))/(2*b) + ((a + b*x)*((-c)*ProductLog(a + b*x))^(3/2))/b]
    @test_int [sqrt(-c*ProductLog(a+b*x)), x, 3, (sqrt(c)*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(4*b) + (c*(a + b*x))/(2*b*sqrt((-c)*ProductLog(a + b*x))) + ((a + b*x)*sqrt((-c)*ProductLog(a + b*x)))/b]
    @test_int [1/sqrt(-c*ProductLog(a+b*x)), x, 2, -((sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(2*b*sqrt(c))) + (a + b*x)/(b*sqrt((-c)*ProductLog(a + b*x)))]
    @test_int [1/(-c*ProductLog(a+b*x))^(3/2), x, 2, (3*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(b*c^(3/2)) - (2*(a + b*x))/(b*((-c)*ProductLog(a + b*x))^(3/2))]
    @test_int [1/(-c*ProductLog(a+b*x))^(5/2), x, 3, -((10*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(3*b*c^(5/2))) - (2*(a + b*x))/(3*b*((-c)*ProductLog(a + b*x))^(5/2)) + (10*(a + b*x))/(3*b*c*((-c)*ProductLog(a + b*x))^(3/2))]
    @test_int [1/(-c*ProductLog(a+b*x))^(7/2), x, 4, (28*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(15*b*c^(7/2)) - (2*(a + b*x))/(5*b*((-c)*ProductLog(a + b*x))^(7/2)) + (14*(a + b*x))/(15*b*c*((-c)*ProductLog(a + b*x))^(5/2)) - (28*(a + b*x))/(15*b*c^2*((-c)*ProductLog(a + b*x))^(3/2))]

    @test_int [(c*ProductLog(a + b*x))^n, x, 2, ((a + b*x)*(c*ProductLog(a + b*x))^n)/b - (n*Gamma(1 + n, -ProductLog(a + b*x))*(c*ProductLog(a + b*x))^n)/((-ProductLog(a + b*x))^n*b)]

    #= ::Subsubsection::Closed:: =#
    #=x^m*ProductLog(a+b*x)^n=#

    @test_int [x^3*ProductLog(a + b*x), x, 20, (a^3*x)/b^3 - (3*a^2*(a + b*x)^2)/(4*b^4) + (a*(a + b*x)^3)/(3*b^4) - (a + b*x)^4/(16*b^4) - (3*(a + b*x)^4)/(512*b^4*ProductLog(a + b*x)^4) - (2*a*(a + b*x)^3)/(27*b^4*ProductLog(a + b*x)^3) + (3*(a + b*x)^4)/(128*b^4*ProductLog(a + b*x)^3) - (3*a^2*(a + b*x)^2)/(8*b^4*ProductLog(a + b*x)^2) + (2*a*(a + b*x)^3)/(9*b^4*ProductLog(a + b*x)^2) - (3*(a + b*x)^4)/(64*b^4*ProductLog(a + b*x)^2) - (a^3*(a + b*x))/(b^4*ProductLog(a + b*x)) + (3*a^2*(a + b*x)^2)/(4*b^4*ProductLog(a + b*x)) - (a*(a + b*x)^3)/(3*b^4*ProductLog(a + b*x)) + (a + b*x)^4/(16*b^4*ProductLog(a + b*x)) - (a^3*(a + b*x)*ProductLog(a + b*x))/b^4 + (3*a^2*(a + b*x)^2*ProductLog(a + b*x))/(2*b^4) - (a*(a + b*x)^3*ProductLog(a + b*x))/b^4 + ((a + b*x)^4*ProductLog(a + b*x))/(4*b^4)]
    @test_int [x^2*ProductLog(a + b*x), x, 14, -((a^2*x)/b^2) + (a*(a + b*x)^2)/(2*b^3) - (a + b*x)^3/(9*b^3) + (2*(a + b*x)^3)/(81*b^3*ProductLog(a + b*x)^3) + (a*(a + b*x)^2)/(4*b^3*ProductLog(a + b*x)^2) - (2*(a + b*x)^3)/(27*b^3*ProductLog(a + b*x)^2) + (a^2*(a + b*x))/(b^3*ProductLog(a + b*x)) - (a*(a + b*x)^2)/(2*b^3*ProductLog(a + b*x)) + (a + b*x)^3/(9*b^3*ProductLog(a + b*x)) + (a^2*(a + b*x)*ProductLog(a + b*x))/b^3 - (a*(a + b*x)^2*ProductLog(a + b*x))/b^3 + ((a + b*x)^3*ProductLog(a + b*x))/(3*b^3)]
    @test_int [x*ProductLog(a + b*x), x, 9, (a*x)/b - (a + b*x)^2/(4*b^2) - (a + b*x)^2/(8*b^2*ProductLog(a + b*x)^2) - (a*(a + b*x))/(b^2*ProductLog(a + b*x)) + (a + b*x)^2/(4*b^2*ProductLog(a + b*x)) - (a*(a + b*x)*ProductLog(a + b*x))/b^2 + ((a + b*x)^2*ProductLog(a + b*x))/(2*b^2)]
    @test_int [ProductLog(a + b*x), x, 3, -x + (a + b*x)/(b*ProductLog(a + b*x)) + ((a + b*x)*ProductLog(a + b*x))/b]
    @test_int [ProductLog(a + b*x)/x, x, 0, CannotIntegrate(ProductLog(a + b*x)/x, x)]
    @test_int [ProductLog(a + b*x)/x^2, x, 0, CannotIntegrate(ProductLog(a + b*x)/x^2, x)]

    @test_int [x^3*ProductLog(a + b*x)^2, x, 24, -((4*a^3*x)/b^3) + (9*a^2*(a + b*x)^2)/(4*b^4) - (8*a*(a + b*x)^3)/(9*b^4) + (5*(a + b*x)^4)/(32*b^4) + (15*(a + b*x)^4)/(1024*b^4*ProductLog(a + b*x)^4) + (16*a*(a + b*x)^3)/(81*b^4*ProductLog(a + b*x)^3) - (15*(a + b*x)^4)/(256*b^4*ProductLog(a + b*x)^3) + (9*a^2*(a + b*x)^2)/(8*b^4*ProductLog(a + b*x)^2) - (16*a*(a + b*x)^3)/(27*b^4*ProductLog(a + b*x)^2) + (15*(a + b*x)^4)/(128*b^4*ProductLog(a + b*x)^2) + (4*a^3*(a + b*x))/(b^4*ProductLog(a + b*x)) - (9*a^2*(a + b*x)^2)/(4*b^4*ProductLog(a + b*x)) + (8*a*(a + b*x)^3)/(9*b^4*ProductLog(a + b*x)) - (5*(a + b*x)^4)/(32*b^4*ProductLog(a + b*x)) + (2*a^3*(a + b*x)*ProductLog(a + b*x))/b^4 - (3*a^2*(a + b*x)^2*ProductLog(a + b*x))/(2*b^4) + (2*a*(a + b*x)^3*ProductLog(a + b*x))/(3*b^4) - ((a + b*x)^4*ProductLog(a + b*x))/(8*b^4) - (a^3*(a + b*x)*ProductLog(a + b*x)^2)/b^4 + (3*a^2*(a + b*x)^2*ProductLog(a + b*x)^2)/(2*b^4) - (a*(a + b*x)^3*ProductLog(a + b*x)^2)/b^4 + ((a + b*x)^4*ProductLog(a + b*x)^2)/(4*b^4)]
    @test_int [x^2*ProductLog(a + b*x)^2, x, 17, (4*a^2*x)/b^2 - (3*a*(a + b*x)^2)/(2*b^3) + (8*(a + b*x)^3)/(27*b^3) - (16*(a + b*x)^3)/(243*b^3*ProductLog(a + b*x)^3) - (3*a*(a + b*x)^2)/(4*b^3*ProductLog(a + b*x)^2) + (16*(a + b*x)^3)/(81*b^3*ProductLog(a + b*x)^2) - (4*a^2*(a + b*x))/(b^3*ProductLog(a + b*x)) + (3*a*(a + b*x)^2)/(2*b^3*ProductLog(a + b*x)) - (8*(a + b*x)^3)/(27*b^3*ProductLog(a + b*x)) - (2*a^2*(a + b*x)*ProductLog(a + b*x))/b^3 + (a*(a + b*x)^2*ProductLog(a + b*x))/b^3 - (2*(a + b*x)^3*ProductLog(a + b*x))/(9*b^3) + (a^2*(a + b*x)*ProductLog(a + b*x)^2)/b^3 - (a*(a + b*x)^2*ProductLog(a + b*x)^2)/b^3 + ((a + b*x)^3*ProductLog(a + b*x)^2)/(3*b^3)]
    @test_int [x*ProductLog(a + b*x)^2, x, 11, -((4*a*x)/b) + (3*(a + b*x)^2)/(4*b^2) + (3*(a + b*x)^2)/(8*b^2*ProductLog(a + b*x)^2) + (4*a*(a + b*x))/(b^2*ProductLog(a + b*x)) - (3*(a + b*x)^2)/(4*b^2*ProductLog(a + b*x)) + (2*a*(a + b*x)*ProductLog(a + b*x))/b^2 - ((a + b*x)^2*ProductLog(a + b*x))/(2*b^2) - (a*(a + b*x)*ProductLog(a + b*x)^2)/b^2 + ((a + b*x)^2*ProductLog(a + b*x)^2)/(2*b^2)]
    @test_int [ProductLog(a + b*x)^2, x, 4, 4*x - (4*(a + b*x))/(b*ProductLog(a + b*x)) - (2*(a + b*x)*ProductLog(a + b*x))/b + ((a + b*x)*ProductLog(a + b*x)^2)/b]
    @test_int [ProductLog(a + b*x)^2/x, x, 0, CannotIntegrate(ProductLog(a + b*x)^2/x, x)]
    @test_int [ProductLog(a + b*x)^2/x^2, x, 0, CannotIntegrate(ProductLog(a + b*x)^2/x^2, x)]

    @test_int [x^3/sqrt(c*ProductLog(a + b*x)), x, 16, -((a^3*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(2*b^4*sqrt(c))) - (15*sqrt(pi)*erfi((2*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(8192*b^4*sqrt(c)) - (3*a^2*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(16*b^4*sqrt(c)) - (a*sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(24*b^4*sqrt(c)) + (15*c^3*(a + b*x)^4)/(2048*b^4*(c*ProductLog(a + b*x))^(7/2)) + (a*c^2*(a + b*x)^3)/(12*b^4*(c*ProductLog(a + b*x))^(5/2)) - (5*c^2*(a + b*x)^4)/(256*b^4*(c*ProductLog(a + b*x))^(5/2)) + (3*a^2*c*(a + b*x)^2)/(8*b^4*(c*ProductLog(a + b*x))^(3/2)) - (a*c*(a + b*x)^3)/(6*b^4*(c*ProductLog(a + b*x))^(3/2)) + (c*(a + b*x)^4)/(32*b^4*(c*ProductLog(a + b*x))^(3/2)) - (a^3*(a + b*x))/(b^4*sqrt(c*ProductLog(a + b*x))) + (3*a^2*(a + b*x)^2)/(2*b^4*sqrt(c*ProductLog(a + b*x))) - (a*(a + b*x)^3)/(b^4*sqrt(c*ProductLog(a + b*x))) + (a + b*x)^4/(4*b^4*sqrt(c*ProductLog(a + b*x)))]
    @test_int [x^2/sqrt(c*ProductLog(a + b*x)), x, 11, (a^2*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(2*b^3*sqrt(c)) + (a*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(8*b^3*sqrt(c)) + (sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(72*b^3*sqrt(c)) - (c^2*(a + b*x)^3)/(36*b^3*(c*ProductLog(a + b*x))^(5/2)) - (a*c*(a + b*x)^2)/(4*b^3*(c*ProductLog(a + b*x))^(3/2)) + (c*(a + b*x)^3)/(18*b^3*(c*ProductLog(a + b*x))^(3/2)) + (a^2*(a + b*x))/(b^3*sqrt(c*ProductLog(a + b*x))) - (a*(a + b*x)^2)/(b^3*sqrt(c*ProductLog(a + b*x))) + (a + b*x)^3/(3*b^3*sqrt(c*ProductLog(a + b*x)))]
    @test_int [x/sqrt(c*ProductLog(a + b*x)), x, 7, -((a*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(2*b^2*sqrt(c))) - (sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(16*b^2*sqrt(c)) + (c*(a + b*x)^2)/(8*b^2*(c*ProductLog(a + b*x))^(3/2)) - (a*(a + b*x))/(b^2*sqrt(c*ProductLog(a + b*x))) + (a + b*x)^2/(2*b^2*sqrt(c*ProductLog(a + b*x)))]
    @test_int [1/sqrt(c*ProductLog(a + b*x)), x, 2, (sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(2*b*sqrt(c)) + (a + b*x)/(b*sqrt(c*ProductLog(a + b*x)))]
    @test_int [1/sqrt(c*ProductLog(a + b*x))/x, x, 1, (CannotIntegrate(1/(x*sqrt(ProductLog(a + b*x))), x)*sqrt(ProductLog(a + b*x)))/sqrt(c*ProductLog(a + b*x))]
    @test_int [1/sqrt(c*ProductLog(a + b*x))/x^2, x, 1, (CannotIntegrate(1/(x^2*sqrt(ProductLog(a + b*x))), x)*sqrt(ProductLog(a + b*x)))/sqrt(c*ProductLog(a + b*x))]

    @test_int [x^3/sqrt(-c*ProductLog(a + b*x)), x, 16, (a^3*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(2*b^4*sqrt(c)) + (15*sqrt(pi)*erf((2*sqrt((-c)*ProductLog(a + b*x)))/sqrt(c)))/(8192*b^4*sqrt(c)) + (3*a^2*sqrt(pi/2)*erf((sqrt(2)*sqrt((-c)*ProductLog(a + b*x)))/sqrt(c)))/(16*b^4*sqrt(c)) + (a*sqrt(pi/3)*erf((sqrt(3)*sqrt((-c)*ProductLog(a + b*x)))/sqrt(c)))/(24*b^4*sqrt(c)) - (15*c^3*(a + b*x)^4)/(2048*b^4*((-c)*ProductLog(a + b*x))^(7/2)) + (a*c^2*(a + b*x)^3)/(12*b^4*((-c)*ProductLog(a + b*x))^(5/2)) - (5*c^2*(a + b*x)^4)/(256*b^4*((-c)*ProductLog(a + b*x))^(5/2)) - (3*a^2*c*(a + b*x)^2)/(8*b^4*((-c)*ProductLog(a + b*x))^(3/2)) + (a*c*(a + b*x)^3)/(6*b^4*((-c)*ProductLog(a + b*x))^(3/2)) - (c*(a + b*x)^4)/(32*b^4*((-c)*ProductLog(a + b*x))^(3/2)) - (a^3*(a + b*x))/(b^4*sqrt((-c)*ProductLog(a + b*x))) + (3*a^2*(a + b*x)^2)/(2*b^4*sqrt((-c)*ProductLog(a + b*x))) - (a*(a + b*x)^3)/(b^4*sqrt((-c)*ProductLog(a + b*x))) + (a + b*x)^4/(4*b^4*sqrt((-c)*ProductLog(a + b*x)))]
    @test_int [x^2/sqrt(-c*ProductLog(a + b*x)), x, 11, -((a^2*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(2*b^3*sqrt(c))) - (a*sqrt(pi/2)*erf((sqrt(2)*sqrt((-c)*ProductLog(a + b*x)))/sqrt(c)))/(8*b^3*sqrt(c)) - (sqrt(pi/3)*erf((sqrt(3)*sqrt((-c)*ProductLog(a + b*x)))/sqrt(c)))/(72*b^3*sqrt(c)) - (c^2*(a + b*x)^3)/(36*b^3*((-c)*ProductLog(a + b*x))^(5/2)) + (a*c*(a + b*x)^2)/(4*b^3*((-c)*ProductLog(a + b*x))^(3/2)) - (c*(a + b*x)^3)/(18*b^3*((-c)*ProductLog(a + b*x))^(3/2)) + (a^2*(a + b*x))/(b^3*sqrt((-c)*ProductLog(a + b*x))) - (a*(a + b*x)^2)/(b^3*sqrt((-c)*ProductLog(a + b*x))) + (a + b*x)^3/(3*b^3*sqrt((-c)*ProductLog(a + b*x)))]
    @test_int [x/sqrt(-c*ProductLog(a + b*x)), x, 7, (a*sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(2*b^2*sqrt(c)) + (sqrt(pi/2)*erf((sqrt(2)*sqrt((-c)*ProductLog(a + b*x)))/sqrt(c)))/(16*b^2*sqrt(c)) - (c*(a + b*x)^2)/(8*b^2*((-c)*ProductLog(a + b*x))^(3/2)) - (a*(a + b*x))/(b^2*sqrt((-c)*ProductLog(a + b*x))) + (a + b*x)^2/(2*b^2*sqrt((-c)*ProductLog(a + b*x)))]
    @test_int [1/sqrt(-c*ProductLog(a + b*x)), x, 2, -((sqrt(pi)*erf(sqrt((-c)*ProductLog(a + b*x))/sqrt(c)))/(2*b*sqrt(c))) + (a + b*x)/(b*sqrt((-c)*ProductLog(a + b*x)))]
    @test_int [1/sqrt(-c*ProductLog(a + b*x))/x, x, 1, (CannotIntegrate(1/(x*sqrt(ProductLog(a + b*x))), x)*sqrt(ProductLog(a + b*x)))/sqrt((-c)*ProductLog(a + b*x))]
    @test_int [1/sqrt(-c*ProductLog(a + b*x))/x^2, x, 1, (CannotIntegrate(1/(x^2*sqrt(ProductLog(a + b*x))), x)*sqrt(ProductLog(a + b*x)))/sqrt((-c)*ProductLog(a + b*x))]

    @test_int [x^3*sqrt(c*ProductLog(a + b*x)), x, 20, -((a^3*sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(4*b^4)) - (105*sqrt(c)*sqrt(pi)*erfi((2*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(65536*b^4) - (9*a^2*sqrt(c)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(64*b^4) - (5*a*sqrt(c)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(144*b^4) + (105*c^4*(a + b*x)^4)/(16384*b^4*(c*ProductLog(a + b*x))^(7/2)) + (5*a*c^3*(a + b*x)^3)/(72*b^4*(c*ProductLog(a + b*x))^(5/2)) - (35*c^3*(a + b*x)^4)/(2048*b^4*(c*ProductLog(a + b*x))^(5/2)) + (9*a^2*c^2*(a + b*x)^2)/(32*b^4*(c*ProductLog(a + b*x))^(3/2)) - (5*a*c^2*(a + b*x)^3)/(36*b^4*(c*ProductLog(a + b*x))^(3/2)) + (7*c^2*(a + b*x)^4)/(256*b^4*(c*ProductLog(a + b*x))^(3/2)) + (a^3*c*(a + b*x))/(2*b^4*sqrt(c*ProductLog(a + b*x))) - (3*a^2*c*(a + b*x)^2)/(8*b^4*sqrt(c*ProductLog(a + b*x))) + (a*c*(a + b*x)^3)/(6*b^4*sqrt(c*ProductLog(a + b*x))) - (c*(a + b*x)^4)/(32*b^4*sqrt(c*ProductLog(a + b*x))) - (a^3*(a + b*x)*sqrt(c*ProductLog(a + b*x)))/b^4 + (3*a^2*(a + b*x)^2*sqrt(c*ProductLog(a + b*x)))/(2*b^4) - (a*(a + b*x)^3*sqrt(c*ProductLog(a + b*x)))/b^4 + ((a + b*x)^4*sqrt(c*ProductLog(a + b*x)))/(4*b^4)]
    @test_int [x^2*sqrt(c*ProductLog(a + b*x)), x, 14, (a^2*sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(4*b^3) + (3*a*sqrt(c)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(32*b^3) + (5*sqrt(c)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(432*b^3) - (5*c^3*(a + b*x)^3)/(216*b^3*(c*ProductLog(a + b*x))^(5/2)) - (3*a*c^2*(a + b*x)^2)/(16*b^3*(c*ProductLog(a + b*x))^(3/2)) + (5*c^2*(a + b*x)^3)/(108*b^3*(c*ProductLog(a + b*x))^(3/2)) - (a^2*c*(a + b*x))/(2*b^3*sqrt(c*ProductLog(a + b*x))) + (a*c*(a + b*x)^2)/(4*b^3*sqrt(c*ProductLog(a + b*x))) - (c*(a + b*x)^3)/(18*b^3*sqrt(c*ProductLog(a + b*x))) + (a^2*(a + b*x)*sqrt(c*ProductLog(a + b*x)))/b^3 - (a*(a + b*x)^2*sqrt(c*ProductLog(a + b*x)))/b^3 + ((a + b*x)^3*sqrt(c*ProductLog(a + b*x)))/(3*b^3)]
    @test_int [x*sqrt(c*ProductLog(a + b*x)), x, 9, -((a*sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(4*b^2)) - (3*sqrt(c)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a + b*x)))/sqrt(c)))/(64*b^2) + (3*c^2*(a + b*x)^2)/(32*b^2*(c*ProductLog(a + b*x))^(3/2)) + (a*c*(a + b*x))/(2*b^2*sqrt(c*ProductLog(a + b*x))) - (c*(a + b*x)^2)/(8*b^2*sqrt(c*ProductLog(a + b*x))) - (a*(a + b*x)*sqrt(c*ProductLog(a + b*x)))/b^2 + ((a + b*x)^2*sqrt(c*ProductLog(a + b*x)))/(2*b^2)]
    @test_int [sqrt(c*ProductLog(a + b*x)), x, 3, (sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a + b*x))/sqrt(c)))/(4*b) - (c*(a + b*x))/(2*b*sqrt(c*ProductLog(a + b*x))) + ((a + b*x)*sqrt(c*ProductLog(a + b*x)))/b]
    @test_int [sqrt(c*ProductLog(a + b*x))/x, x, 1, (CannotIntegrate(sqrt(ProductLog(a + b*x))/x, x)*sqrt(c*ProductLog(a + b*x)))/sqrt(ProductLog(a + b*x))]
    @test_int [sqrt(c*ProductLog(a + b*x))/x^2, x, 1, (CannotIntegrate(sqrt(ProductLog(a + b*x))/x^2, x)*sqrt(c*ProductLog(a + b*x)))/sqrt(ProductLog(a + b*x))]

    #= ::Subsubsection::Closed:: =#
    #=x^m / (d+d*ProductLog(a+b*x))=#
    #==#

    @test_int [x^3/(d + d*ProductLog(a + b*x)), x, 12, -((3*(a + b*x)^4)/(128*b^4*d*ProductLog(a + b*x)^4)) - (2*a*(a + b*x)^3)/(9*b^4*d*ProductLog(a + b*x)^3) + (3*(a + b*x)^4)/(32*b^4*d*ProductLog(a + b*x)^3) - (3*a^2*(a + b*x)^2)/(4*b^4*d*ProductLog(a + b*x)^2) + (2*a*(a + b*x)^3)/(3*b^4*d*ProductLog(a + b*x)^2) - (3*(a + b*x)^4)/(16*b^4*d*ProductLog(a + b*x)^2) - (a^3*(a + b*x))/(b^4*d*ProductLog(a + b*x)) + (3*a^2*(a + b*x)^2)/(2*b^4*d*ProductLog(a + b*x)) - (a*(a + b*x)^3)/(b^4*d*ProductLog(a + b*x)) + (a + b*x)^4/(4*b^4*d*ProductLog(a + b*x))]
    @test_int [x^2/(d + d*ProductLog(a + b*x)), x, 8, (2*(a + b*x)^3)/(27*b^3*d*ProductLog(a + b*x)^3) + (a*(a + b*x)^2)/(2*b^3*d*ProductLog(a + b*x)^2) - (2*(a + b*x)^3)/(9*b^3*d*ProductLog(a + b*x)^2) + (a^2*(a + b*x))/(b^3*d*ProductLog(a + b*x)) - (a*(a + b*x)^2)/(b^3*d*ProductLog(a + b*x)) + (a + b*x)^3/(3*b^3*d*ProductLog(a + b*x))]
    @test_int [x/(d + d*ProductLog(a + b*x)), x, 5, -((a + b*x)^2/(4*b^2*d*ProductLog(a + b*x)^2)) - (a*(a + b*x))/(b^2*d*ProductLog(a + b*x)) + (a + b*x)^2/(2*b^2*d*ProductLog(a + b*x))]
    @test_int [1/(d + d*ProductLog(a + b*x)), x, 1, (a + b*x)/(b*d*ProductLog(a + b*x))]
    @test_int [1/(x*(d + d*ProductLog(a + b*x))), x, 2, CannotIntegrate(1/(x*(1 + ProductLog(a + b*x))), x)/d]
    @test_int [1/(x^2*(d + d*ProductLog(a + b*x))), x, 2, CannotIntegrate(1/(x^2*(1 + ProductLog(a + b*x))), x)/d]

    #= ::Subsection::Closed:: =#
    #=Integrands*involving*ProductLog(a*x^n)=#

    #= ::Subsubsection::Closed:: =#
    #=x^m*ProductLog(a*x)^p=#

    @test_int [x^3*ProductLog(a*x), x, 6, -(x^4/16) - (3*x^4)/(512*ProductLog(a*x)^4) + (3*x^4)/(128*ProductLog(a*x)^3) - (3*x^4)/(64*ProductLog(a*x)^2) + x^4/(16*ProductLog(a*x)) + (1/4)*x^4*ProductLog(a*x)]
    @test_int [x^2*ProductLog(a*x), x, 5, -(x^3/9) + (2*x^3)/(81*ProductLog(a*x)^3) - (2*x^3)/(27*ProductLog(a*x)^2) + x^3/(9*ProductLog(a*x)) + (1/3)*x^3*ProductLog(a*x)]
    @test_int [x*ProductLog(a*x), x, 4, -(x^2/4) - x^2/(8*ProductLog(a*x)^2) + x^2/(4*ProductLog(a*x)) + (1/2)*x^2*ProductLog(a*x)]
    @test_int [ProductLog(a*x), x, 3, -x + x/ProductLog(a*x) + x*ProductLog(a*x)]
    @test_int [ProductLog(a*x)/x, x, 2, ProductLog(a*x) + (1/2)*ProductLog(a*x)^2]
    @test_int [ProductLog(a*x)/x^2, x, 2, a*ExpIntegralEi(-ProductLog(a*x)) - ProductLog(a*x)/x]
    @test_int [ProductLog(a*x)/x^3, x, 2, (-a^2)*ExpIntegralEi(-2*ProductLog(a*x)) - ProductLog(a*x)/x^2]
    @test_int [ProductLog(a*x)/x^4, x, 3, (3/2)*a^3*ExpIntegralEi(-3*ProductLog(a*x)) - ProductLog(a*x)/(2*x^3) + ProductLog(a*x)^2/(2*x^3)]
    @test_int [ProductLog(a*x)/x^5, x, 4, (-(8/3))*a^4*ExpIntegralEi(-4*ProductLog(a*x)) - ProductLog(a*x)/(3*x^4) + ProductLog(a*x)^2/(6*x^4) - (2*ProductLog(a*x)^3)/(3*x^4)]
    @test_int [ProductLog(a*x)/x^6, x, 5, (125/24)*a^5*ExpIntegralEi(-5*ProductLog(a*x)) - ProductLog(a*x)/(4*x^5) + ProductLog(a*x)^2/(12*x^5) - (5*ProductLog(a*x)^3)/(24*x^5) + (25*ProductLog(a*x)^4)/(24*x^5)]

    @test_int [x^2*ProductLog(a*x)^2, x, 6, (8*x^3)/27 - (16*x^3)/(243*ProductLog(a*x)^3) + (16*x^3)/(81*ProductLog(a*x)^2) - (8*x^3)/(27*ProductLog(a*x)) - (2/9)*x^3*ProductLog(a*x) + (1/3)*x^3*ProductLog(a*x)^2]
    @test_int [x*ProductLog(a*x)^2, x, 5, (3*x^2)/4 + (3*x^2)/(8*ProductLog(a*x)^2) - (3*x^2)/(4*ProductLog(a*x)) - (1/2)*x^2*ProductLog(a*x) + (1/2)*x^2*ProductLog(a*x)^2]
    @test_int [ProductLog(a*x)^2, x, 4, 4*x - (4*x)/ProductLog(a*x) - 2*x*ProductLog(a*x) + x*ProductLog(a*x)^2]
    @test_int [ProductLog(a*x)^2/x, x, 2, (1/2)*ProductLog(a*x)^2 + (1/3)*ProductLog(a*x)^3]
    @test_int [ProductLog(a*x)^2/x^2, x, 2, -((2*ProductLog(a*x))/x) - ProductLog(a*x)^2/x]
    @test_int [ProductLog(a*x)^2/x^3, x, 2, a^2*ExpIntegralEi(-2*ProductLog(a*x)) - ProductLog(a*x)^2/(2*x^2)]
    @test_int [ProductLog(a*x)^2/x^4, x, 2, -2*a^3*ExpIntegralEi(-3*ProductLog(a*x)) - ProductLog(a*x)^2/x^3]
    @test_int [ProductLog(a*x)^2/x^5, x, 3, 4*a^4*ExpIntegralEi(-4*ProductLog(a*x)) - ProductLog(a*x)^2/(2*x^4) + ProductLog(a*x)^3/x^4]
    @test_int [ProductLog(a*x)^2/x^6, x, 4, (-(25/3))*a^5*ExpIntegralEi(-5*ProductLog(a*x)) - ProductLog(a*x)^2/(3*x^5) + ProductLog(a*x)^3/(3*x^5) - (5*ProductLog(a*x)^4)/(3*x^5)]
    @test_int [ProductLog(a*x)^2/x^7, x, 5, 18*a^6*ExpIntegralEi(-6*ProductLog(a*x)) - ProductLog(a*x)^2/(4*x^6) + ProductLog(a*x)^3/(6*x^6) - ProductLog(a*x)^4/(2*x^6) + (3*ProductLog(a*x)^5)/x^6]

    @test_int [x^2*ProductLog(a*x)^3, x, 7, -((20*x^3)/27) + (40*x^3)/(243*ProductLog(a*x)^3) - (40*x^3)/(81*ProductLog(a*x)^2) + (20*x^3)/(27*ProductLog(a*x)) + (5/9)*x^3*ProductLog(a*x) - (1/3)*x^3*ProductLog(a*x)^2 + (1/3)*x^3*ProductLog(a*x)^3]
    @test_int [x*ProductLog(a*x)^3, x, 6, -((9*x^2)/4) - (9*x^2)/(8*ProductLog(a*x)^2) + (9*x^2)/(4*ProductLog(a*x)) + (3/2)*x^2*ProductLog(a*x) - (3/4)*x^2*ProductLog(a*x)^2 + (1/2)*x^2*ProductLog(a*x)^3]
    @test_int [ProductLog(a*x)^3, x, 5, -18*x + (18*x)/ProductLog(a*x) + 9*x*ProductLog(a*x) - 3*x*ProductLog(a*x)^2 + x*ProductLog(a*x)^3]
    @test_int [ProductLog(a*x)^3/x, x, 2, (1/3)*ProductLog(a*x)^3 + (1/4)*ProductLog(a*x)^4]
    @test_int [ProductLog(a*x)^3/x^2, x, 3, -((3*ProductLog(a*x))/x) - (3*ProductLog(a*x)^2)/x - ProductLog(a*x)^3/x]
    @test_int [ProductLog(a*x)^3/x^3, x, 2, -((3*ProductLog(a*x)^2)/(4*x^2)) - ProductLog(a*x)^3/(2*x^2)]
    @test_int [ProductLog(a*x)^3/x^4, x, 2, a^3*ExpIntegralEi(-3*ProductLog(a*x)) - ProductLog(a*x)^3/(3*x^3)]
    @test_int [ProductLog(a*x)^3/x^5, x, 2, -3*a^4*ExpIntegralEi(-4*ProductLog(a*x)) - ProductLog(a*x)^3/x^4]
    @test_int [ProductLog(a*x)^3/x^6, x, 3, (15/2)*a^5*ExpIntegralEi(-5*ProductLog(a*x)) - ProductLog(a*x)^3/(2*x^5) + (3*ProductLog(a*x)^4)/(2*x^5)]
    @test_int [ProductLog(a*x)^3/x^7, x, 4, -18*a^6*ExpIntegralEi(-6*ProductLog(a*x)) - ProductLog(a*x)^3/(3*x^6) + ProductLog(a*x)^4/(2*x^6) - (3*ProductLog(a*x)^5)/x^6]
    @test_int [ProductLog(a*x)^3/x^8, x, 5, (343/8)*a^7*ExpIntegralEi(-7*ProductLog(a*x)) - ProductLog(a*x)^3/(4*x^7) + ProductLog(a*x)^4/(4*x^7) - (7*ProductLog(a*x)^5)/(8*x^7) + (49*ProductLog(a*x)^6)/(8*x^7)]

    @test_int [x^4/ProductLog(a*x), x, 5, -((6*x^5)/(3125*ProductLog(a*x)^5)) + (6*x^5)/(625*ProductLog(a*x)^4) - (3*x^5)/(125*ProductLog(a*x)^3) + x^5/(25*ProductLog(a*x)^2) + x^5/(5*ProductLog(a*x))]
    @test_int [x^3/ProductLog(a*x), x, 4, x^4/(128*ProductLog(a*x)^4) - x^4/(32*ProductLog(a*x)^3) + x^4/(16*ProductLog(a*x)^2) + x^4/(4*ProductLog(a*x))]
    @test_int [x^2/ProductLog(a*x), x, 3, -(x^3/(27*ProductLog(a*x)^3)) + x^3/(9*ProductLog(a*x)^2) + x^3/(3*ProductLog(a*x))]
    @test_int [x/ProductLog(a*x), x, 2, x^2/(4*ProductLog(a*x)^2) + x^2/(2*ProductLog(a*x))]
    @test_int [1/ProductLog(a*x), x, 2, ExpIntegralEi(ProductLog(a*x))/a + x/ProductLog(a*x)]
    @test_int [1/(x*ProductLog(a*x)), x, 2, log(ProductLog(a*x)) - 1/ProductLog(a*x)]
    @test_int [1/(x^2*ProductLog(a*x)), x, 3, -(1/(2*x)) - (1/2)*a*ExpIntegralEi(-ProductLog(a*x)) - 1/(2*x*ProductLog(a*x))]
    @test_int [1/(x^3*ProductLog(a*x)), x, 4, -(1/(6*x^2)) + (2/3)*a^2*ExpIntegralEi(-2*ProductLog(a*x)) - 1/(3*x^2*ProductLog(a*x)) + ProductLog(a*x)/(3*x^2)]
    @test_int [1/(x^4*ProductLog(a*x)), x, 5, -(1/(12*x^3)) - (9/8)*a^3*ExpIntegralEi(-3*ProductLog(a*x)) - 1/(4*x^3*ProductLog(a*x)) + ProductLog(a*x)/(8*x^3) - (3*ProductLog(a*x)^2)/(8*x^3)]

    @test_int [x^5/ProductLog(a*x)^2, x, 5, -(x^6/(648*ProductLog(a*x)^6)) + x^6/(108*ProductLog(a*x)^5) - x^6/(36*ProductLog(a*x)^4) + x^6/(18*ProductLog(a*x)^3) + x^6/(6*ProductLog(a*x)^2)]
    @test_int [x^4/ProductLog(a*x)^2, x, 4, (4*x^5)/(625*ProductLog(a*x)^5) - (4*x^5)/(125*ProductLog(a*x)^4) + (2*x^5)/(25*ProductLog(a*x)^3) + x^5/(5*ProductLog(a*x)^2)]
    @test_int [x^3/ProductLog(a*x)^2, x, 3, -(x^4/(32*ProductLog(a*x)^4)) + x^4/(8*ProductLog(a*x)^3) + x^4/(4*ProductLog(a*x)^2)]
    @test_int [x^2/ProductLog(a*x)^2, x, 2, (2*x^3)/(9*ProductLog(a*x)^3) + x^3/(3*ProductLog(a*x)^2)]
    @test_int [x/ProductLog(a*x)^2, x, 2, ExpIntegralEi(2*ProductLog(a*x))/a^2 + x^2/(2*ProductLog(a*x)^2)]
    @test_int [1/ProductLog(a*x)^2, x, 2, (2*ExpIntegralEi(ProductLog(a*x)))/a - x/ProductLog(a*x)^2]
    @test_int [1/(x*ProductLog(a*x)^2), x, 2, -(1/(2*ProductLog(a*x)^2)) - 1/ProductLog(a*x)]
    @test_int [1/(x^2*ProductLog(a*x)^2), x, 4, 1/(3*x) + (1/3)*a*ExpIntegralEi(-ProductLog(a*x)) - 1/(3*x*ProductLog(a*x)^2) - 1/(3*x*ProductLog(a*x))]
    @test_int [1/(x^3*ProductLog(a*x)^2), x, 5, 1/(6*x^2) - (2/3)*a^2*ExpIntegralEi(-2*ProductLog(a*x)) - 1/(4*x^2*ProductLog(a*x)^2) - 1/(6*x^2*ProductLog(a*x)) - ProductLog(a*x)/(3*x^2)]

    @test_int [x^6/ProductLog(a*x)^3, x, 5, -((18*x^7)/(16807*ProductLog(a*x)^7)) + (18*x^7)/(2401*ProductLog(a*x)^6) - (9*x^7)/(343*ProductLog(a*x)^5) + (3*x^7)/(49*ProductLog(a*x)^4) + x^7/(7*ProductLog(a*x)^3)]
    @test_int [x^5/ProductLog(a*x)^3, x, 4, x^6/(216*ProductLog(a*x)^6) - x^6/(36*ProductLog(a*x)^5) + x^6/(12*ProductLog(a*x)^4) + x^6/(6*ProductLog(a*x)^3)]
    @test_int [x^4/ProductLog(a*x)^3, x, 3, -((3*x^5)/(125*ProductLog(a*x)^5)) + (3*x^5)/(25*ProductLog(a*x)^4) + x^5/(5*ProductLog(a*x)^3)]
    @test_int [x^3/ProductLog(a*x)^3, x, 2, (3*x^4)/(16*ProductLog(a*x)^4) + x^4/(4*ProductLog(a*x)^3)]
    @test_int [x^2/ProductLog(a*x)^3, x, 2, ExpIntegralEi(3*ProductLog(a*x))/a^3 + x^3/(3*ProductLog(a*x)^3)]
    @test_int [x/ProductLog(a*x)^3, x, 2, (3*ExpIntegralEi(2*ProductLog(a*x)))/a^2 - x^2/ProductLog(a*x)^3]
    @test_int [1/ProductLog(a*x)^3, x, 3, (3*ExpIntegralEi(ProductLog(a*x)))/(2*a) - x/(2*ProductLog(a*x)^3) - (3*x)/(2*ProductLog(a*x)^2)]
    @test_int [1/(x*ProductLog(a*x)^3), x, 2, -(1/(3*ProductLog(a*x)^3)) - 1/(2*ProductLog(a*x)^2)]
    @test_int [1/(x^2*ProductLog(a*x)^3), x, 5, -(1/(8*x)) - (1/8)*a*ExpIntegralEi(-ProductLog(a*x)) - 1/(4*x*ProductLog(a*x)^3) - 1/(4*x*ProductLog(a*x)^2) + 1/(8*x*ProductLog(a*x))]
    @test_int [1/(x^3*ProductLog(a*x)^3), x, 6, -(1/(10*x^2)) + (2/5)*a^2*ExpIntegralEi(-2*ProductLog(a*x)) - 1/(5*x^2*ProductLog(a*x)^3) - 3/(20*x^2*ProductLog(a*x)^2) + 1/(10*x^2*ProductLog(a*x)) + ProductLog(a*x)/(5*x^2)]

    @test_int [x^3*sqrt(c*ProductLog(a*x)), x, 6, -((105*sqrt(c)*sqrt(pi)*erfi((2*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(65536*a^4)) + (105*c^4*x^4)/(16384*(c*ProductLog(a*x))^(7/2)) - (35*c^3*x^4)/(2048*(c*ProductLog(a*x))^(5/2)) + (7*c^2*x^4)/(256*(c*ProductLog(a*x))^(3/2)) - (c*x^4)/(32*sqrt(c*ProductLog(a*x))) + (1/4)*x^4*sqrt(c*ProductLog(a*x))]
    @test_int [x^2*sqrt(c*ProductLog(a*x)), x, 5, (5*sqrt(c)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(432*a^3) - (5*c^3*x^3)/(216*(c*ProductLog(a*x))^(5/2)) + (5*c^2*x^3)/(108*(c*ProductLog(a*x))^(3/2)) - (c*x^3)/(18*sqrt(c*ProductLog(a*x))) + (1/3)*x^3*sqrt(c*ProductLog(a*x))]
    @test_int [x*sqrt(c*ProductLog(a*x)), x, 4, -((3*sqrt(c)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(64*a^2)) + (3*c^2*x^2)/(32*(c*ProductLog(a*x))^(3/2)) - (c*x^2)/(8*sqrt(c*ProductLog(a*x))) + (1/2)*x^2*sqrt(c*ProductLog(a*x))]
    @test_int [sqrt(c*ProductLog(a*x)), x, 3, (sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x))/sqrt(c)))/(4*a) - (c*x)/(2*sqrt(c*ProductLog(a*x))) + x*sqrt(c*ProductLog(a*x))]
    @test_int [sqrt(c*ProductLog(a*x))/x, x, 2, 2*sqrt(c*ProductLog(a*x)) + (2*(c*ProductLog(a*x))^(3/2))/(3*c)]
    @test_int [sqrt(c*ProductLog(a*x))/x^2, x, 2, (-a)*sqrt(c)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x))/sqrt(c)) - (2*sqrt(c*ProductLog(a*x)))/x]
    @test_int [sqrt(c*ProductLog(a*x))/x^3, x, 3, (2/3)*a^2*sqrt(c)*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x)))/sqrt(c)) - (2*sqrt(c*ProductLog(a*x)))/(3*x^2) + (2*(c*ProductLog(a*x))^(3/2))/(3*c*x^2)]
    @test_int [sqrt(c*ProductLog(a*x))/x^4, x, 4, (-(4/5))*a^3*sqrt(c)*sqrt(3*pi)*erf((sqrt(3)*sqrt(c*ProductLog(a*x)))/sqrt(c)) - (2*sqrt(c*ProductLog(a*x)))/(5*x^3) + (2*(c*ProductLog(a*x))^(3/2))/(15*c*x^3) - (4*(c*ProductLog(a*x))^(5/2))/(5*c^2*x^3)]
    @test_int [sqrt(c*ProductLog(a*x))/x^5, x, 5, (256/105)*a^4*sqrt(c)*sqrt(pi)*erf((2*sqrt(c*ProductLog(a*x)))/sqrt(c)) - (2*sqrt(c*ProductLog(a*x)))/(7*x^4) + (2*(c*ProductLog(a*x))^(3/2))/(35*c*x^4) - (16*(c*ProductLog(a*x))^(5/2))/(105*c^2*x^4) + (128*(c*ProductLog(a*x))^(7/2))/(105*c^3*x^4)]
    @test_int [sqrt(c*ProductLog(a*x))/x^6, x, 6, (-(400/189))*a^5*sqrt(c)*sqrt(5*pi)*erf((sqrt(5)*sqrt(c*ProductLog(a*x)))/sqrt(c)) - (2*sqrt(c*ProductLog(a*x)))/(9*x^5) + (2*(c*ProductLog(a*x))^(3/2))/(63*c*x^5) - (4*(c*ProductLog(a*x))^(5/2))/(63*c^2*x^5) + (40*(c*ProductLog(a*x))^(7/2))/(189*c^3*x^5) - (400*(c*ProductLog(a*x))^(9/2))/(189*c^4*x^5)]

    @test_int [x^4/sqrt(c*ProductLog(a*x)), x, 6, (21*sqrt(pi/5)*erfi((sqrt(5)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(20000*a^5*sqrt(c)) - (21*c^4*x^5)/(10000*(c*ProductLog(a*x))^(9/2)) + (7*c^3*x^5)/(1000*(c*ProductLog(a*x))^(7/2)) - (7*c^2*x^5)/(500*(c*ProductLog(a*x))^(5/2)) + (c*x^5)/(50*(c*ProductLog(a*x))^(3/2)) + x^5/(5*sqrt(c*ProductLog(a*x)))]
    @test_int [x^3/sqrt(c*ProductLog(a*x)), x, 5, -((15*sqrt(pi)*erfi((2*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(8192*a^4*sqrt(c))) + (15*c^3*x^4)/(2048*(c*ProductLog(a*x))^(7/2)) - (5*c^2*x^4)/(256*(c*ProductLog(a*x))^(5/2)) + (c*x^4)/(32*(c*ProductLog(a*x))^(3/2)) + x^4/(4*sqrt(c*ProductLog(a*x)))]
    @test_int [x^2/sqrt(c*ProductLog(a*x)), x, 4, (sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(72*a^3*sqrt(c)) - (c^2*x^3)/(36*(c*ProductLog(a*x))^(5/2)) + (c*x^3)/(18*(c*ProductLog(a*x))^(3/2)) + x^3/(3*sqrt(c*ProductLog(a*x)))]
    @test_int [x/sqrt(c*ProductLog(a*x)), x, 3, -((sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(16*a^2*sqrt(c))) + (c*x^2)/(8*(c*ProductLog(a*x))^(3/2)) + x^2/(2*sqrt(c*ProductLog(a*x)))]
    @test_int [1/sqrt(c*ProductLog(a*x)), x, 2, (sqrt(pi)*erfi(sqrt(c*ProductLog(a*x))/sqrt(c)))/(2*a*sqrt(c)) + x/sqrt(c*ProductLog(a*x))]
    @test_int [1/(x*sqrt(c*ProductLog(a*x))), x, 2, -(2/sqrt(c*ProductLog(a*x))) + (2*sqrt(c*ProductLog(a*x)))/c]
    @test_int [1/(x^2*sqrt(c*ProductLog(a*x))), x, 3, -((2*a*sqrt(pi)*erf(sqrt(c*ProductLog(a*x))/sqrt(c)))/(3*sqrt(c))) - 2/(3*x*sqrt(c*ProductLog(a*x))) - (2*sqrt(c*ProductLog(a*x)))/(3*c*x)]
    @test_int [1/(x^3*sqrt(c*ProductLog(a*x))), x, 4, (8*a^2*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(15*sqrt(c)) - 2/(5*x^2*sqrt(c*ProductLog(a*x))) - (2*sqrt(c*ProductLog(a*x)))/(15*c*x^2) + (8*(c*ProductLog(a*x))^(3/2))/(15*c^2*x^2)]
    @test_int [1/(x^4*sqrt(c*ProductLog(a*x))), x, 5, -((24*a^3*sqrt(3*pi)*erf((sqrt(3)*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(35*sqrt(c))) - 2/(7*x^3*sqrt(c*ProductLog(a*x))) - (2*sqrt(c*ProductLog(a*x)))/(35*c*x^3) + (4*(c*ProductLog(a*x))^(3/2))/(35*c^2*x^3) - (24*(c*ProductLog(a*x))^(5/2))/(35*c^3*x^3)]
    @test_int [1/(x^5*sqrt(c*ProductLog(a*x))), x, 6, (2048*a^4*sqrt(pi)*erf((2*sqrt(c*ProductLog(a*x)))/sqrt(c)))/(945*sqrt(c)) - 2/(9*x^4*sqrt(c*ProductLog(a*x))) - (2*sqrt(c*ProductLog(a*x)))/(63*c*x^4) + (16*(c*ProductLog(a*x))^(3/2))/(315*c^2*x^4) - (128*(c*ProductLog(a*x))^(5/2))/(945*c^3*x^4) + (1024*(c*ProductLog(a*x))^(7/2))/(945*c^4*x^4)]

    @test_int [x^2*(c*ProductLog(a*x))^p, x, 3, (3^(-3 - p)*x^2*Gamma(3 + p, -3*ProductLog(a*x))*(-ProductLog(a*x))^(-2 - p)*(c*ProductLog(a*x))^p)/(ℯ^(2*ProductLog(a*x))*a) + (3^(-4 - p)*x^2*Gamma(4 + p, -3*ProductLog(a*x))*(-ProductLog(a*x))^(-3 - p)*(c*ProductLog(a*x))^(1 + p))/(ℯ^(2*ProductLog(a*x))*(a*c))]
    @test_int [x*(c*ProductLog(a*x))^p, x, 3, (2^(-2 - p)*x*Gamma(2 + p, -2*ProductLog(a*x))*(-ProductLog(a*x))^(-1 - p)*(c*ProductLog(a*x))^p)/(ℯ^ProductLog(a*x)*a) + (2^(-3 - p)*x*Gamma(3 + p, -2*ProductLog(a*x))*(-ProductLog(a*x))^(-2 - p)*(c*ProductLog(a*x))^(1 + p))/(ℯ^ProductLog(a*x)*(a*c))]
    @test_int [(c*ProductLog(a*x))^p/x, x, 2, (c*ProductLog(a*x))^p/p + (c*ProductLog(a*x))^(1 + p)/(c*(1 + p))]
    @test_int [(c*ProductLog(a*x))^p/x^2, x, 3, -((ℯ^(2*ProductLog(a*x))*Gamma(-1 + p, ProductLog(a*x))*ProductLog(a*x)^(2 - p)*(c*ProductLog(a*x))^p)/(a*x^2)) - (ℯ^(2*ProductLog(a*x))*Gamma(p, ProductLog(a*x))*ProductLog(a*x)^(1 - p)*(c*ProductLog(a*x))^(1 + p))/(a*c*x^2)]
    @test_int [(c*ProductLog(a*x))^p/x^3, x, 3, -((2^(2 - p)*ℯ^(3*ProductLog(a*x))*Gamma(-2 + p, 2*ProductLog(a*x))*ProductLog(a*x)^(3 - p)*(c*ProductLog(a*x))^p)/(a*x^3)) - (2^(1 - p)*ℯ^(3*ProductLog(a*x))*Gamma(-1 + p, 2*ProductLog(a*x))*ProductLog(a*x)^(2 - p)*(c*ProductLog(a*x))^(1 + p))/(a*c*x^3)]

    @test_int [x^m*ProductLog(a*x), x, 3, (x^m*Gamma(3 + m, -(1 + m)*ProductLog(a*x))*ProductLog(a*x)^2*(-(1 + m)*ProductLog(a*x))^(-2 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m))) + (x^m*Gamma(2 + m, -(1 + m)*ProductLog(a*x))*ProductLog(a*x)*(-(1 + m)*ProductLog(a*x))^(-1 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)))]
    @test_int [x^m*ProductLog(a*x)^2, x, 3, (x^m*Gamma(4 + m, -(1 + m)*ProductLog(a*x))*ProductLog(a*x)^3*(-(1 + m)*ProductLog(a*x))^(-3 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m))) + (x^m*Gamma(3 + m, -(1 + m)*ProductLog(a*x))*ProductLog(a*x)^2*(-(1 + m)*ProductLog(a*x))^(-2 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)))]
    @test_int [x^m/ProductLog(a*x), x, 3, (x^m*Gamma(m, -(1 + m)*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^(1 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)*ProductLog(a*x))) + (x^m*Gamma(1 + m, -(1 + m)*ProductLog(a*x)))/(ℯ^(m*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^m*(a*(1 + m)))]
    @test_int [x^m/ProductLog(a*x)^2, x, 3, (x^m*Gamma(m, -(1 + m)*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^(1 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)*ProductLog(a*x))) + (x^m*Gamma(-1 + m, -(1 + m)*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^(2 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)*ProductLog(a*x)^2))]
    @test_int [x^m*sqrt(c*ProductLog(a*x)), x, 3, (x^m*Gamma(5/2 + m, -(1 + m)*ProductLog(a*x))*(c*ProductLog(a*x))^(3/2)*(-(1 + m)*ProductLog(a*x))^(-(3/2) - m))/(ℯ^(m*ProductLog(a*x))*(a*c*(1 + m))) + (x^m*Gamma(3/2 + m, -(1 + m)*ProductLog(a*x))*sqrt(c*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^(-(1/2) - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)))]
    @test_int [x^m/sqrt(c*ProductLog(a*x)), x, 3, (x^m*Gamma(3/2 + m, -(1 + m)*ProductLog(a*x))*sqrt(c*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^(-(1/2) - m))/(ℯ^(m*ProductLog(a*x))*(a*c*(1 + m))) + (x^m*Gamma(1/2 + m, -(1 + m)*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^(1/2 - m))/(ℯ^(m*ProductLog(a*x))*(a*(1 + m)*sqrt(c*ProductLog(a*x))))]

    @test_int [x^m*(c*ProductLog(a*x))^p, x, 3, (1/(a*c*(1 + m)))*((x^m*Gamma(2 + m + p, -(1 + m)*ProductLog(a*x))*(c*ProductLog(a*x))^(1 + p)*(-(1 + m)*ProductLog(a*x))^(-1 - m - p))/ℯ^(m*ProductLog(a*x))) + (1/(a*(1 + m)))*((x^m*Gamma(1 + m + p, -(1 + m)*ProductLog(a*x))*(c*ProductLog(a*x))^p*(-(1 + m)*ProductLog(a*x))^(-m - p))/ℯ^(m*ProductLog(a*x)))]

    #= ::Subsubsection::Closed:: =#
    #=x^m*ProductLog(a*x^2)^p=#

    @test_int [x^4*ProductLog(a*x^2), x, 0, CannotIntegrate(x^4*ProductLog(a*x^2), x)]
    @test_int [x^3*ProductLog(a*x^2), x, 5, -(x^4/8) - x^4/(16*ProductLog(a*x^2)^2) + x^4/(8*ProductLog(a*x^2)) + (1/4)*x^4*ProductLog(a*x^2)]
    @test_int [x^2*ProductLog(a*x^2), x, 0, CannotIntegrate(x^2*ProductLog(a*x^2), x)]
    @test_int [x*ProductLog(a*x^2), x, 4, -(x^2/2) + x^2/(2*ProductLog(a*x^2)) + (1/2)*x^2*ProductLog(a*x^2)]
    @test_int [ProductLog(a*x^2), x, 0, CannotIntegrate(ProductLog(a*x^2), x)]
    @test_int [ProductLog(a*x^2)/x, x, 2, (1/2)*ProductLog(a*x^2) + (1/4)*ProductLog(a*x^2)^2]
    @test_int [ProductLog(a*x^2)/x^2, x, 0, CannotIntegrate(ProductLog(a*x^2)/x^2, x)]
    @test_int [ProductLog(a*x^2)/x^3, x, 2, (1/2)*a*ExpIntegralEi(-ProductLog(a*x^2)) - ProductLog(a*x^2)/(2*x^2)]
    @test_int [ProductLog(a*x^2)/x^4, x, 0, CannotIntegrate(ProductLog(a*x^2)/x^4, x)]
    @test_int [ProductLog(a*x^2)/x^5, x, 2, (-(1/2))*a^2*ExpIntegralEi(-2*ProductLog(a*x^2)) - ProductLog(a*x^2)/(2*x^4)]
    @test_int [ProductLog(a*x^2)/x^6, x, 0, CannotIntegrate(ProductLog(a*x^2)/x^6, x)]
    @test_int [ProductLog(a*x^2)/x^7, x, 3, (3/4)*a^3*ExpIntegralEi(-3*ProductLog(a*x^2)) - ProductLog(a*x^2)/(4*x^6) + ProductLog(a*x^2)^2/(4*x^6)]

    @test_int [x^3*ProductLog(a*x^2)^2, x, 6, (3*x^4)/8 + (3*x^4)/(16*ProductLog(a*x^2)^2) - (3*x^4)/(8*ProductLog(a*x^2)) - (1/4)*x^4*ProductLog(a*x^2) + (1/4)*x^4*ProductLog(a*x^2)^2]
    @test_int [x^2*ProductLog(a*x^2)^2, x, 0, CannotIntegrate(x^2*ProductLog(a*x^2)^2, x)]
    @test_int [x*ProductLog(a*x^2)^2, x, 5, 2*x^2 - (2*x^2)/ProductLog(a*x^2) - x^2*ProductLog(a*x^2) + (1/2)*x^2*ProductLog(a*x^2)^2]
    @test_int [ProductLog(a*x^2)^2, x, 0, CannotIntegrate(ProductLog(a*x^2)^2, x)]
    @test_int [ProductLog(a*x^2)^2/x, x, 2, (1/4)*ProductLog(a*x^2)^2 + (1/6)*ProductLog(a*x^2)^3]
    @test_int [ProductLog(a*x^2)^2/x^2, x, 0, CannotIntegrate(ProductLog(a*x^2)^2/x^2, x)]
    @test_int [ProductLog(a*x^2)^2/x^3, x, 2, -(ProductLog(a*x^2)/x^2) - ProductLog(a*x^2)^2/(2*x^2)]
    @test_int [ProductLog(a*x^2)^2/x^4, x, 0, CannotIntegrate(ProductLog(a*x^2)^2/x^4, x)]
    @test_int [ProductLog(a*x^2)^2/x^5, x, 2, (1/2)*a^2*ExpIntegralEi(-2*ProductLog(a*x^2)) - ProductLog(a*x^2)^2/(4*x^4)]
    @test_int [ProductLog(a*x^2)^2/x^6, x, 0, CannotIntegrate(ProductLog(a*x^2)^2/x^6, x)]
    @test_int [ProductLog(a*x^2)^2/x^7, x, 2, (-a^3)*ExpIntegralEi(-3*ProductLog(a*x^2)) - ProductLog(a*x^2)^2/(2*x^6)]
    @test_int [ProductLog(a*x^2)^2/x^8, x, 0, CannotIntegrate(ProductLog(a*x^2)^2/x^8, x)]
    @test_int [ProductLog(a*x^2)^2/x^9, x, 3, 2*a^4*ExpIntegralEi(-4*ProductLog(a*x^2)) - ProductLog(a*x^2)^2/(4*x^8) + ProductLog(a*x^2)^3/(2*x^8)]

    @test_int [x^2*ProductLog(a*x^2)^3, x, 0, CannotIntegrate(x^2*ProductLog(a*x^2)^3, x)]
    @test_int [x*ProductLog(a*x^2)^3, x, 6, -9*x^2 + (9*x^2)/ProductLog(a*x^2) + (9/2)*x^2*ProductLog(a*x^2) - (3/2)*x^2*ProductLog(a*x^2)^2 + (1/2)*x^2*ProductLog(a*x^2)^3]
    @test_int [ProductLog(a*x^2)^3, x, 0, CannotIntegrate(ProductLog(a*x^2)^3, x)]
    @test_int [ProductLog(a*x^2)^3/x, x, 2, (1/6)*ProductLog(a*x^2)^3 + (1/8)*ProductLog(a*x^2)^4]
    @test_int [ProductLog(a*x^2)^3/x^2, x, 0, CannotIntegrate(ProductLog(a*x^2)^3/x^2, x)]
    @test_int [ProductLog(a*x^2)^3/x^3, x, 3, -((3*ProductLog(a*x^2))/(2*x^2)) - (3*ProductLog(a*x^2)^2)/(2*x^2) - ProductLog(a*x^2)^3/(2*x^2)]
    @test_int [ProductLog(a*x^2)^3/x^4, x, 0, CannotIntegrate(ProductLog(a*x^2)^3/x^4, x)]
    @test_int [ProductLog(a*x^2)^3/x^5, x, 2, -((3*ProductLog(a*x^2)^2)/(8*x^4)) - ProductLog(a*x^2)^3/(4*x^4)]
    @test_int [ProductLog(a*x^2)^3/x^6, x, 0, CannotIntegrate(ProductLog(a*x^2)^3/x^6, x)]
    @test_int [ProductLog(a*x^2)^3/x^7, x, 2, (1/2)*a^3*ExpIntegralEi(-3*ProductLog(a*x^2)) - ProductLog(a*x^2)^3/(6*x^6)]
    @test_int [ProductLog(a*x^2)^3/x^8, x, 0, CannotIntegrate(ProductLog(a*x^2)^3/x^8, x)]
    @test_int [ProductLog(a*x^2)^3/x^9, x, 2, (-(3/2))*a^4*ExpIntegralEi(-4*ProductLog(a*x^2)) - ProductLog(a*x^2)^3/(2*x^8)]

    @test_int [x^5/ProductLog(a*x^2), x, 3, -(x^6/(54*ProductLog(a*x^2)^3)) + x^6/(18*ProductLog(a*x^2)^2) + x^6/(6*ProductLog(a*x^2))]
    @test_int [x^4/ProductLog(a*x^2), x, 0, CannotIntegrate(x^4/ProductLog(a*x^2), x)]
    @test_int [x^3/ProductLog(a*x^2), x, 2, x^4/(8*ProductLog(a*x^2)^2) + x^4/(4*ProductLog(a*x^2))]
    @test_int [x^2/ProductLog(a*x^2), x, 0, CannotIntegrate(x^2/ProductLog(a*x^2), x)]
    @test_int [x/ProductLog(a*x^2), x, 2, ExpIntegralEi(ProductLog(a*x^2))/(2*a) + x^2/(2*ProductLog(a*x^2))]
    @test_int [1/ProductLog(a*x^2), x, 0, CannotIntegrate(1/ProductLog(a*x^2), x)]
    @test_int [1/(x*ProductLog(a*x^2)), x, 2, (1/2)*log(ProductLog(a*x^2)) - 1/(2*ProductLog(a*x^2))]
    @test_int [1/(x^2*ProductLog(a*x^2)), x, 0, CannotIntegrate(1/(x^2*ProductLog(a*x^2)), x)]
    @test_int [1/(x^3*ProductLog(a*x^2)), x, 4, -(1/(4*x^2)) - (1/4)*a*ExpIntegralEi(-ProductLog(a*x^2)) - 1/(4*x^2*ProductLog(a*x^2))]
    @test_int [1/(x^4*ProductLog(a*x^2)), x, 0, CannotIntegrate(1/(x^4*ProductLog(a*x^2)), x)]
    @test_int [1/(x^5*ProductLog(a*x^2)), x, 5, -(1/(12*x^4)) + (1/3)*a^2*ExpIntegralEi(-2*ProductLog(a*x^2)) - 1/(6*x^4*ProductLog(a*x^2)) + ProductLog(a*x^2)/(6*x^4)]

    @test_int [x^7/ProductLog(a*x^2)^2, x, 3, -(x^8/(64*ProductLog(a*x^2)^4)) + x^8/(16*ProductLog(a*x^2)^3) + x^8/(8*ProductLog(a*x^2)^2)]
    @test_int [x^6/ProductLog(a*x^2)^2, x, 0, CannotIntegrate(x^6/ProductLog(a*x^2)^2, x)]
    @test_int [x^5/ProductLog(a*x^2)^2, x, 2, x^6/(9*ProductLog(a*x^2)^3) + x^6/(6*ProductLog(a*x^2)^2)]
    @test_int [x^4/ProductLog(a*x^2)^2, x, 0, CannotIntegrate(x^4/ProductLog(a*x^2)^2, x)]
    @test_int [x^3/ProductLog(a*x^2)^2, x, 2, ExpIntegralEi(2*ProductLog(a*x^2))/(2*a^2) + x^4/(4*ProductLog(a*x^2)^2)]
    @test_int [x^2/ProductLog(a*x^2)^2, x, 0, CannotIntegrate(x^2/ProductLog(a*x^2)^2, x)]
    @test_int [x/ProductLog(a*x^2)^2, x, 2, ExpIntegralEi(ProductLog(a*x^2))/a - x^2/(2*ProductLog(a*x^2)^2)]
    @test_int [1/ProductLog(a*x^2)^2, x, 0, CannotIntegrate(1/ProductLog(a*x^2)^2, x)]
    @test_int [1/(x*ProductLog(a*x^2)^2), x, 2, -(1/(4*ProductLog(a*x^2)^2)) - 1/(2*ProductLog(a*x^2))]
    @test_int [1/(x^2*ProductLog(a*x^2)^2), x, 0, CannotIntegrate(1/(x^2*ProductLog(a*x^2)^2), x)]
    @test_int [1/(x^3*ProductLog(a*x^2)^2), x, 5, 1/(6*x^2) + (1/6)*a*ExpIntegralEi(-ProductLog(a*x^2)) - 1/(6*x^2*ProductLog(a*x^2)^2) - 1/(6*x^2*ProductLog(a*x^2))]

    @test_int [x^7*sqrt(c*ProductLog(a*x^2)), x, 6, -((105*sqrt(c)*sqrt(pi)*erfi((2*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(131072*a^4)) + (105*c^4*x^8)/(32768*(c*ProductLog(a*x^2))^(7/2)) - (35*c^3*x^8)/(4096*(c*ProductLog(a*x^2))^(5/2)) + (7*c^2*x^8)/(512*(c*ProductLog(a*x^2))^(3/2)) - (c*x^8)/(64*sqrt(c*ProductLog(a*x^2))) + (1/8)*x^8*sqrt(c*ProductLog(a*x^2))]
    @test_int [x^6*sqrt(c*ProductLog(a*x^2)), x, 5, (48*c^4*x^7)/(16807*(c*ProductLog(a*x^2))^(7/2)) - (24*c^3*x^7)/(2401*(c*ProductLog(a*x^2))^(5/2)) + (6*c^2*x^7)/(343*(c*ProductLog(a*x^2))^(3/2)) - (c*x^7)/(49*sqrt(c*ProductLog(a*x^2))) + (1/7)*x^7*sqrt(c*ProductLog(a*x^2))]
    @test_int [x^5*sqrt(c*ProductLog(a*x^2)), x, 5, (5*sqrt(c)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(864*a^3) - (5*c^3*x^6)/(432*(c*ProductLog(a*x^2))^(5/2)) + (5*c^2*x^6)/(216*(c*ProductLog(a*x^2))^(3/2)) - (c*x^6)/(36*sqrt(c*ProductLog(a*x^2))) + (1/6)*x^6*sqrt(c*ProductLog(a*x^2))]
    @test_int [x^4*sqrt(c*ProductLog(a*x^2)), x, 4, -((8*c^3*x^5)/(625*(c*ProductLog(a*x^2))^(5/2))) + (4*c^2*x^5)/(125*(c*ProductLog(a*x^2))^(3/2)) - (c*x^5)/(25*sqrt(c*ProductLog(a*x^2))) + (1/5)*x^5*sqrt(c*ProductLog(a*x^2))]
    @test_int [x^3*sqrt(c*ProductLog(a*x^2)), x, 4, -((3*sqrt(c)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(128*a^2)) + (3*c^2*x^4)/(64*(c*ProductLog(a*x^2))^(3/2)) - (c*x^4)/(16*sqrt(c*ProductLog(a*x^2))) + (1/4)*x^4*sqrt(c*ProductLog(a*x^2))]
    @test_int [x^2*sqrt(c*ProductLog(a*x^2)), x, 3, (2*c^2*x^3)/(27*(c*ProductLog(a*x^2))^(3/2)) - (c*x^3)/(9*sqrt(c*ProductLog(a*x^2))) + (1/3)*x^3*sqrt(c*ProductLog(a*x^2))]
    @test_int [x*sqrt(c*ProductLog(a*x^2)), x, 3, (sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^2))/sqrt(c)))/(8*a) - (c*x^2)/(4*sqrt(c*ProductLog(a*x^2))) + (1/2)*x^2*sqrt(c*ProductLog(a*x^2))]
    @test_int [sqrt(c*ProductLog(a*x^2)), x, 2, -((c*x)/sqrt(c*ProductLog(a*x^2))) + x*sqrt(c*ProductLog(a*x^2))]
    @test_int [sqrt(c*ProductLog(a*x^2))/x, x, 2, sqrt(c*ProductLog(a*x^2)) + (c*ProductLog(a*x^2))^(3/2)/(3*c)]
    @test_int [sqrt(c*ProductLog(a*x^2))/x^2, x, 1, (CannotIntegrate(sqrt(ProductLog(a*x^2))/x^2, x)*sqrt(c*ProductLog(a*x^2)))/sqrt(ProductLog(a*x^2))]
    @test_int [sqrt(c*ProductLog(a*x^2))/x^3, x, 2, (-(1/2))*a*sqrt(c)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^2))/sqrt(c)) - sqrt(c*ProductLog(a*x^2))/x^2]
    @test_int [sqrt(c*ProductLog(a*x^2))/x^4, x, 1, (CannotIntegrate(sqrt(ProductLog(a*x^2))/x^4, x)*sqrt(c*ProductLog(a*x^2)))/sqrt(ProductLog(a*x^2))]
    @test_int [sqrt(c*ProductLog(a*x^2))/x^5, x, 3, (1/3)*a^2*sqrt(c)*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)) - sqrt(c*ProductLog(a*x^2))/(3*x^4) + (c*ProductLog(a*x^2))^(3/2)/(3*c*x^4)]
    @test_int [sqrt(c*ProductLog(a*x^2))/x^6, x, 1, (CannotIntegrate(sqrt(ProductLog(a*x^2))/x^6, x)*sqrt(c*ProductLog(a*x^2)))/sqrt(ProductLog(a*x^2))]
    @test_int [sqrt(c*ProductLog(a*x^2))/x^7, x, 4, (-(2/5))*a^3*sqrt(c)*sqrt(3*pi)*erf((sqrt(3)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)) - sqrt(c*ProductLog(a*x^2))/(5*x^6) + (c*ProductLog(a*x^2))^(3/2)/(15*c*x^6) - (2*(c*ProductLog(a*x^2))^(5/2))/(5*c^2*x^6)]

    @test_int [x^7/sqrt(c*ProductLog(a*x^2)), x, 5, -((15*sqrt(pi)*erfi((2*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(16384*a^4*sqrt(c))) + (15*c^3*x^8)/(4096*(c*ProductLog(a*x^2))^(7/2)) - (5*c^2*x^8)/(512*(c*ProductLog(a*x^2))^(5/2)) + (c*x^8)/(64*(c*ProductLog(a*x^2))^(3/2)) + x^8/(8*sqrt(c*ProductLog(a*x^2)))]
    @test_int [x^6/sqrt(c*ProductLog(a*x^2)), x, 4, (8*c^3*x^7)/(2401*(c*ProductLog(a*x^2))^(7/2)) - (4*c^2*x^7)/(343*(c*ProductLog(a*x^2))^(5/2)) + (c*x^7)/(49*(c*ProductLog(a*x^2))^(3/2)) + x^7/(7*sqrt(c*ProductLog(a*x^2)))]
    @test_int [x^5/sqrt(c*ProductLog(a*x^2)), x, 4, (sqrt(pi/3)*erfi((sqrt(3)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(144*a^3*sqrt(c)) - (c^2*x^6)/(72*(c*ProductLog(a*x^2))^(5/2)) + (c*x^6)/(36*(c*ProductLog(a*x^2))^(3/2)) + x^6/(6*sqrt(c*ProductLog(a*x^2)))]
    @test_int [x^4/sqrt(c*ProductLog(a*x^2)), x, 3, -((2*c^2*x^5)/(125*(c*ProductLog(a*x^2))^(5/2))) + (c*x^5)/(25*(c*ProductLog(a*x^2))^(3/2)) + x^5/(5*sqrt(c*ProductLog(a*x^2)))]
    @test_int [x^3/sqrt(c*ProductLog(a*x^2)), x, 3, -((sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(32*a^2*sqrt(c))) + (c*x^4)/(16*(c*ProductLog(a*x^2))^(3/2)) + x^4/(4*sqrt(c*ProductLog(a*x^2)))]
    @test_int [x^2/sqrt(c*ProductLog(a*x^2)), x, 2, (c*x^3)/(9*(c*ProductLog(a*x^2))^(3/2)) + x^3/(3*sqrt(c*ProductLog(a*x^2)))]
    @test_int [x/sqrt(c*ProductLog(a*x^2)), x, 2, (sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^2))/sqrt(c)))/(4*a*sqrt(c)) + x^2/(2*sqrt(c*ProductLog(a*x^2)))]
    @test_int [1/sqrt(c*ProductLog(a*x^2)), x, 1, (CannotIntegrate(1/sqrt(ProductLog(a*x^2)), x)*sqrt(ProductLog(a*x^2)))/sqrt(c*ProductLog(a*x^2))]
    @test_int [1/(x*sqrt(c*ProductLog(a*x^2))), x, 2, -(1/sqrt(c*ProductLog(a*x^2))) + sqrt(c*ProductLog(a*x^2))/c]
    @test_int [1/(x^2*sqrt(c*ProductLog(a*x^2))), x, 1, (CannotIntegrate(1/(x^2*sqrt(ProductLog(a*x^2))), x)*sqrt(ProductLog(a*x^2)))/sqrt(c*ProductLog(a*x^2))]
    @test_int [1/(x^3*sqrt(c*ProductLog(a*x^2))), x, 3, -((a*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^2))/sqrt(c)))/(3*sqrt(c))) - 1/(3*x^2*sqrt(c*ProductLog(a*x^2))) - sqrt(c*ProductLog(a*x^2))/(3*c*x^2)]
    @test_int [1/(x^4*sqrt(c*ProductLog(a*x^2))), x, 1, (CannotIntegrate(1/(x^4*sqrt(ProductLog(a*x^2))), x)*sqrt(ProductLog(a*x^2)))/sqrt(c*ProductLog(a*x^2))]
    @test_int [1/(x^5*sqrt(c*ProductLog(a*x^2))), x, 4, (4*a^2*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(15*sqrt(c)) - 1/(5*x^4*sqrt(c*ProductLog(a*x^2))) - sqrt(c*ProductLog(a*x^2))/(15*c*x^4) + (4*(c*ProductLog(a*x^2))^(3/2))/(15*c^2*x^4)]
    @test_int [1/(x^6*sqrt(c*ProductLog(a*x^2))), x, 1, (CannotIntegrate(1/(x^6*sqrt(ProductLog(a*x^2))), x)*sqrt(ProductLog(a*x^2)))/sqrt(c*ProductLog(a*x^2))]
    @test_int [1/(x^7*sqrt(c*ProductLog(a*x^2))), x, 5, -((12*a^3*sqrt(3*pi)*erf((sqrt(3)*sqrt(c*ProductLog(a*x^2)))/sqrt(c)))/(35*sqrt(c))) - 1/(7*x^6*sqrt(c*ProductLog(a*x^2))) - sqrt(c*ProductLog(a*x^2))/(35*c*x^6) + (2*(c*ProductLog(a*x^2))^(3/2))/(35*c^2*x^6) - (12*(c*ProductLog(a*x^2))^(5/2))/(35*c^3*x^6)]

    @test_int [x^2*(c*ProductLog(a*x^2))^p, x, 1, (CannotIntegrate(x^2*ProductLog(a*x^2)^p, x)*(c*ProductLog(a*x^2))^p)/ProductLog(a*x^2)^p]
    @test_int [x*(c*ProductLog(a*x^2))^p, x, 3, (1/2)*x^2*(c*ProductLog(a*x^2))^p - (p*Gamma(1 + p, -ProductLog(a*x^2))*(c*ProductLog(a*x^2))^p)/((-ProductLog(a*x^2))^p*(2*a))]
    @test_int [(c*ProductLog(a*x^2))^p/x, x, 2, (c*ProductLog(a*x^2))^p/(2*p) + (c*ProductLog(a*x^2))^(1 + p)/(2*c*(1 + p))]
    @test_int [(c*ProductLog(a*x^2))^p/x^2, x, 1, (CannotIntegrate(ProductLog(a*x^2)^p/x^2, x)*(c*ProductLog(a*x^2))^p)/ProductLog(a*x^2)^p]
    @test_int [(c*ProductLog(a*x^2))^p/x^3, x, 5, -((ℯ^(2*ProductLog(a*x^2))*Gamma(-1 + p, ProductLog(a*x^2))*ProductLog(a*x^2)^(2 - p)*(c*ProductLog(a*x^2))^p)/(2*a*x^4)) - (ℯ^(2*ProductLog(a*x^2))*Gamma(p, ProductLog(a*x^2))*ProductLog(a*x^2)^(2 - p)*(c*ProductLog(a*x^2))^p)/(2*a*x^4)]

    #= ::Subsubsection::Closed:: =#
    #=x^m*ProductLog(a/x)^p=#

    @test_int [x^4*ProductLog(a/x), x, 5, (-(125/24))*a^5*ExpIntegralEi(-5*ProductLog(a/x)) + (1/4)*x^5*ProductLog(a/x) - (1/12)*x^5*ProductLog(a/x)^2 + (5/24)*x^5*ProductLog(a/x)^3 - (25/24)*x^5*ProductLog(a/x)^4]
    @test_int [x^3*ProductLog(a/x), x, 4, (8/3)*a^4*ExpIntegralEi(-4*ProductLog(a/x)) + (1/3)*x^4*ProductLog(a/x) - (1/6)*x^4*ProductLog(a/x)^2 + (2/3)*x^4*ProductLog(a/x)^3]
    @test_int [x^2*ProductLog(a/x), x, 3, (-(3/2))*a^3*ExpIntegralEi(-3*ProductLog(a/x)) + (1/2)*x^3*ProductLog(a/x) - (1/2)*x^3*ProductLog(a/x)^2]
    @test_int [x*ProductLog(a/x), x, 2, a^2*ExpIntegralEi(-2*ProductLog(a/x)) + x^2*ProductLog(a/x)]
    @test_int [ProductLog(a/x), x, 3, (-a)*ExpIntegralEi(-ProductLog(a/x)) + x*ProductLog(a/x)]
    @test_int [ProductLog(a/x)/x, x, 2, -ProductLog(a/x) - (1/2)*ProductLog(a/x)^2]
    @test_int [ProductLog(a/x)/x^2, x, 4, 1/x - 1/(x*ProductLog(a/x)) - ProductLog(a/x)/x]
    @test_int [ProductLog(a/x)/x^3, x, 5, 1/(4*x^2) + 1/(8*x^2*ProductLog(a/x)^2) - 1/(4*x^2*ProductLog(a/x)) - ProductLog(a/x)/(2*x^2)]
    @test_int [ProductLog(a/x)/x^4, x, 6, 1/(9*x^3) - 2/(81*x^3*ProductLog(a/x)^3) + 2/(27*x^3*ProductLog(a/x)^2) - 1/(9*x^3*ProductLog(a/x)) - ProductLog(a/x)/(3*x^3)]
    @test_int [ProductLog(a/x)/x^5, x, 7, 1/(16*x^4) + 3/(512*x^4*ProductLog(a/x)^4) - 3/(128*x^4*ProductLog(a/x)^3) + 3/(64*x^4*ProductLog(a/x)^2) - 1/(16*x^4*ProductLog(a/x)) - ProductLog(a/x)/(4*x^4)]

    @test_int [x^4*ProductLog(a/x)^2, x, 4, (25/3)*a^5*ExpIntegralEi(-5*ProductLog(a/x)) + (1/3)*x^5*ProductLog(a/x)^2 - (1/3)*x^5*ProductLog(a/x)^3 + (5/3)*x^5*ProductLog(a/x)^4]
    @test_int [x^3*ProductLog(a/x)^2, x, 3, -4*a^4*ExpIntegralEi(-4*ProductLog(a/x)) + (1/2)*x^4*ProductLog(a/x)^2 - x^4*ProductLog(a/x)^3]
    @test_int [x^2*ProductLog(a/x)^2, x, 2, 2*a^3*ExpIntegralEi(-3*ProductLog(a/x)) + x^3*ProductLog(a/x)^2]
    @test_int [x*ProductLog(a/x)^2, x, 2, (-a^2)*ExpIntegralEi(-2*ProductLog(a/x)) + (1/2)*x^2*ProductLog(a/x)^2]
    @test_int [ProductLog(a/x)^2, x, 2, 2*x*ProductLog(a/x) + x*ProductLog(a/x)^2]
    @test_int [ProductLog(a/x)^2/x, x, 2, (-(1/2))*ProductLog(a/x)^2 - (1/3)*ProductLog(a/x)^3]
    @test_int [ProductLog(a/x)^2/x^2, x, 5, -(4/x) + 4/(x*ProductLog(a/x)) + (2*ProductLog(a/x))/x - ProductLog(a/x)^2/x]
    @test_int [ProductLog(a/x)^2/x^3, x, 6, -(3/(4*x^2)) - 3/(8*x^2*ProductLog(a/x)^2) + 3/(4*x^2*ProductLog(a/x)) + ProductLog(a/x)/(2*x^2) - ProductLog(a/x)^2/(2*x^2)]
    @test_int [ProductLog(a/x)^2/x^4, x, 7, -(8/(27*x^3)) + 16/(243*x^3*ProductLog(a/x)^3) - 16/(81*x^3*ProductLog(a/x)^2) + 8/(27*x^3*ProductLog(a/x)) + (2*ProductLog(a/x))/(9*x^3) - ProductLog(a/x)^2/(3*x^3)]
    @test_int [ProductLog(a/x)^2/x^5, x, 8, -(5/(32*x^4)) - 15/(1024*x^4*ProductLog(a/x)^4) + 15/(256*x^4*ProductLog(a/x)^3) - 15/(128*x^4*ProductLog(a/x)^2) + 5/(32*x^4*ProductLog(a/x)) + ProductLog(a/x)/(8*x^4) - ProductLog(a/x)^2/(4*x^4)]

    @test_int [x^3*sqrt(ProductLog(a/x)), x, 5, (-(256/105))*a^4*sqrt(pi)*erf(2*sqrt(ProductLog(a/x))) + (2/7)*x^4*sqrt(ProductLog(a/x)) - (2/35)*x^4*ProductLog(a/x)^(3/2) + (16/105)*x^4*ProductLog(a/x)^(5/2) - (128/105)*x^4*ProductLog(a/x)^(7/2)]
    @test_int [x^2*sqrt(ProductLog(a/x)), x, 4, (4/5)*a^3*sqrt(3*pi)*erf(sqrt(3)*sqrt(ProductLog(a/x))) + (2/5)*x^3*sqrt(ProductLog(a/x)) - (2/15)*x^3*ProductLog(a/x)^(3/2) + (4/5)*x^3*ProductLog(a/x)^(5/2)]
    @test_int [x*sqrt(ProductLog(a/x)), x, 3, (-(2/3))*a^2*sqrt(2*pi)*erf(sqrt(2)*sqrt(ProductLog(a/x))) + (2/3)*x^2*sqrt(ProductLog(a/x)) - (2/3)*x^2*ProductLog(a/x)^(3/2)]
    @test_int [sqrt(ProductLog(a/x)), x, 2, a*sqrt(pi)*erf(sqrt(ProductLog(a/x))) + 2*x*sqrt(ProductLog(a/x))]
    @test_int [sqrt(ProductLog(a/x))/x, x, 2, -2*sqrt(ProductLog(a/x)) - (2/3)*ProductLog(a/x)^(3/2)]
    @test_int [sqrt(ProductLog(a/x))/x^2, x, 3, -((sqrt(pi)*erfi(sqrt(ProductLog(a/x))))/(4*a)) + 1/(2*x*sqrt(ProductLog(a/x))) - sqrt(ProductLog(a/x))/x]
    @test_int [sqrt(ProductLog(a/x))/x^3, x, 4, (3*sqrt(pi/2)*erfi(sqrt(2)*sqrt(ProductLog(a/x))))/(64*a^2) - 3/(32*x^2*ProductLog(a/x)^(3/2)) + 1/(8*x^2*sqrt(ProductLog(a/x))) - sqrt(ProductLog(a/x))/(2*x^2)]
    @test_int [sqrt(ProductLog(a/x))/x^4, x, 5, -((5*sqrt(pi/3)*erfi(sqrt(3)*sqrt(ProductLog(a/x))))/(432*a^3)) + 5/(216*x^3*ProductLog(a/x)^(5/2)) - 5/(108*x^3*ProductLog(a/x)^(3/2)) + 1/(18*x^3*sqrt(ProductLog(a/x))) - sqrt(ProductLog(a/x))/(3*x^3)]

    @test_int [x^3/sqrt(ProductLog(a/x)), x, 6, (-(2048/945))*a^4*sqrt(pi)*erf(2*sqrt(ProductLog(a/x))) + (2*x^4)/(9*sqrt(ProductLog(a/x))) + (2/63)*x^4*sqrt(ProductLog(a/x)) - (16/315)*x^4*ProductLog(a/x)^(3/2) + (128/945)*x^4*ProductLog(a/x)^(5/2) - (1024/945)*x^4*ProductLog(a/x)^(7/2)]
    @test_int [x^2/sqrt(ProductLog(a/x)), x, 5, (24/35)*a^3*sqrt(3*pi)*erf(sqrt(3)*sqrt(ProductLog(a/x))) + (2*x^3)/(7*sqrt(ProductLog(a/x))) + (2/35)*x^3*sqrt(ProductLog(a/x)) - (4/35)*x^3*ProductLog(a/x)^(3/2) + (24/35)*x^3*ProductLog(a/x)^(5/2)]
    @test_int [x/sqrt(ProductLog(a/x)), x, 4, (-(8/15))*a^2*sqrt(2*pi)*erf(sqrt(2)*sqrt(ProductLog(a/x))) + (2*x^2)/(5*sqrt(ProductLog(a/x))) + (2/15)*x^2*sqrt(ProductLog(a/x)) - (8/15)*x^2*ProductLog(a/x)^(3/2)]
    @test_int [1/sqrt(ProductLog(a/x)), x, 4, (2/3)*a*sqrt(pi)*erf(sqrt(ProductLog(a/x))) + (2*x)/(3*sqrt(ProductLog(a/x))) + (2/3)*x*sqrt(ProductLog(a/x))]
    @test_int [1/(x*sqrt(ProductLog(a/x))), x, 2, 2/sqrt(ProductLog(a/x)) - 2*sqrt(ProductLog(a/x))]
    @test_int [1/(x^2*sqrt(ProductLog(a/x))), x, 2, -((sqrt(pi)*erfi(sqrt(ProductLog(a/x))))/(2*a)) - 1/(x*sqrt(ProductLog(a/x)))]
    @test_int [1/(x^3*sqrt(ProductLog(a/x))), x, 3, (sqrt(pi/2)*erfi(sqrt(2)*sqrt(ProductLog(a/x))))/(16*a^2) - 1/(8*x^2*ProductLog(a/x)^(3/2)) - 1/(2*x^2*sqrt(ProductLog(a/x)))]
    @test_int [1/(x^4*sqrt(ProductLog(a/x))), x, 4, -((sqrt(pi/3)*erfi(sqrt(3)*sqrt(ProductLog(a/x))))/(72*a^3)) + 1/(36*x^3*ProductLog(a/x)^(5/2)) - 1/(18*x^3*ProductLog(a/x)^(3/2)) - 1/(3*x^3*sqrt(ProductLog(a/x)))]

    @test_int [x^2*(c*ProductLog(a/x))^p, x, 4, (3^(3 - p)*ℯ^(4*ProductLog(a/x))*x^4*Gamma(-3 + p, 3*ProductLog(a/x))*ProductLog(a/x)^(4 - p)*(c*ProductLog(a/x))^p)/a + (3^(2 - p)*ℯ^(4*ProductLog(a/x))*x^4*Gamma(-2 + p, 3*ProductLog(a/x))*ProductLog(a/x)^(3 - p)*(c*ProductLog(a/x))^(1 + p))/(a*c)]
    @test_int [x*(c*ProductLog(a/x))^p, x, 4, (2^(2 - p)*ℯ^(3*ProductLog(a/x))*x^3*Gamma(-2 + p, 2*ProductLog(a/x))*ProductLog(a/x)^(3 - p)*(c*ProductLog(a/x))^p)/a + (2^(1 - p)*ℯ^(3*ProductLog(a/x))*x^3*Gamma(-1 + p, 2*ProductLog(a/x))*ProductLog(a/x)^(2 - p)*(c*ProductLog(a/x))^(1 + p))/(a*c)]
    @test_int [(c*ProductLog(a/x))^p/x, x, 2, -((c*ProductLog(a/x))^p/p) - (c*ProductLog(a/x))^(1 + p)/(c*(1 + p))]
    @test_int [(c*ProductLog(a/x))^p/x^2, x, 3, -((c*ProductLog(a/x))^p/x) + (p*Gamma(1 + p, -ProductLog(a/x))*(c*ProductLog(a/x))^p)/((-ProductLog(a/x))^p*a)]
    @test_int [(c*ProductLog(a/x))^p/x^3, x, 4, -((2^(-2 - p)*Gamma(2 + p, -2*ProductLog(a/x))*(-ProductLog(a/x))^(-1 - p)*(c*ProductLog(a/x))^p)/(ℯ^ProductLog(a/x)*(a*x))) - (2^(-3 - p)*Gamma(3 + p, -2*ProductLog(a/x))*(-ProductLog(a/x))^(-2 - p)*(c*ProductLog(a/x))^(1 + p))/(ℯ^ProductLog(a/x)*(a*c*x))]

    #= ::Subsubsection::Closed:: =#
    #=ProductLog(a*x^n)^p=#

    @test_int [ProductLog(a/x^(1/4))^5, x, 2, (5/4)*x*ProductLog(a/x^(1/4))^4 + x*ProductLog(a/x^(1/4))^5]
    @test_int [ProductLog(a/x^(1/3))^4, x, 2, (4/3)*x*ProductLog(a/x^(1/3))^3 + x*ProductLog(a/x^(1/3))^4]
    @test_int [ProductLog(a/sqrt(x))^3, x, 2, (3/2)*x*ProductLog(a/sqrt(x))^2 + x*ProductLog(a/sqrt(x))^3]
    @test_int [ProductLog(a/x)^2, x, 2, 2*x*ProductLog(a/x) + x*ProductLog(a/x)^2]
    @test_int [1/ProductLog(a*sqrt(x)), x, 2, x/(2*ProductLog(a*sqrt(x))^2) + x/ProductLog(a*sqrt(x))]
    @test_int [1/ProductLog(a*x^(1/3))^2, x, 2, (2*x)/(3*ProductLog(a*x^(1/3))^3) + x/ProductLog(a*x^(1/3))^2]
    @test_int [1/ProductLog(a*x^(1/4))^3, x, 2, (3*x)/(4*ProductLog(a*x^(1/4))^4) + x/ProductLog(a*x^(1/4))^3]

    @test_int [ProductLog(a/x^(1/5))^4, x, 2, 20*a^5*ExpIntegralEi(-5*ProductLog(a/x^(1/5))) + 5*x*ProductLog(a/x^(1/5))^4]
    @test_int [ProductLog(a/x^(1/4))^3, x, 2, 12*a^4*ExpIntegralEi(-4*ProductLog(a/x^(1/4))) + 4*x*ProductLog(a/x^(1/4))^3]
    @test_int [ProductLog(a/x^(1/3))^2, x, 2, 6*a^3*ExpIntegralEi(-3*ProductLog(a/x^(1/3))) + 3*x*ProductLog(a/x^(1/3))^2]
    @test_int [ProductLog(a/sqrt(x)), x, 2, 2*a^2*ExpIntegralEi(-2*ProductLog(a/sqrt(x))) + 2*x*ProductLog(a/sqrt(x))]
    @test_int [1/ProductLog(a*x)^2, x, 2, (2*ExpIntegralEi(ProductLog(a*x)))/a - x/ProductLog(a*x)^2]
    @test_int [1/ProductLog(a*sqrt(x))^3, x, 2, (6*ExpIntegralEi(2*ProductLog(a*sqrt(x))))/a^2 - (2*x)/ProductLog(a*sqrt(x))^3]
    @test_int [1/ProductLog(a*x^(1/3))^4, x, 2, (12*ExpIntegralEi(3*ProductLog(a*x^(1/3))))/a^3 - (3*x)/ProductLog(a*x^(1/3))^4]
    @test_int [1/ProductLog(a*x^(1/4))^5, x, 2, (20*ExpIntegralEi(4*ProductLog(a*x^(1/4))))/a^4 - (4*x)/ProductLog(a*x^(1/4))^5]

    @test_int [ProductLog(a*x^n)^((-1 + n)/n), x, 2, ((1 - n)*x)/ProductLog(a*x^n)^n^(-1) + x/ProductLog(a*x^n)^((1 - n)/n)]
    @test_int [ProductLog(a*x^(1/(1 - p)))^p, x, 2, x*ProductLog(a*x^(1/(1 - p)))^p - (p/(1 - p))*x*ProductLog(a*x^(1/(1 - p)))^(p - 1)]

    #= ::Subsubsection::Closed:: =#
    #=x^m*ProductLog(a*x^n)^p=#

    @test_int [x^(-1 - n)*(c*ProductLog(a*x^n))^(9/2), x, 5, (135*a*c^(9/2)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(16*n) - (135*c^3*(c*ProductLog(a*x^n))^(3/2))/(x^n*(8*n)) - (45*c^2*(c*ProductLog(a*x^n))^(5/2))/(x^n*(4*n)) - (9*c*(c*ProductLog(a*x^n))^(7/2))/(x^n*(2*n)) - (c*ProductLog(a*x^n))^(9/2)/(x^n*n)]
    @test_int [x^(-1 - n)*(c*ProductLog(a*x^n))^(7/2), x, 4, (21*a*c^(7/2)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(8*n) - (21*c^2*(c*ProductLog(a*x^n))^(3/2))/(x^n*(4*n)) - (7*c*(c*ProductLog(a*x^n))^(5/2))/(x^n*(2*n)) - (c*ProductLog(a*x^n))^(7/2)/(x^n*n)]
    @test_int [x^(-1 - n)*(c*ProductLog(a*x^n))^(5/2), x, 3, (5*a*c^(5/2)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(4*n) - (5*c*(c*ProductLog(a*x^n))^(3/2))/(x^n*(2*n)) - (c*ProductLog(a*x^n))^(5/2)/(x^n*n)]
    @test_int [x^(-1 - n)*(c*ProductLog(a*x^n))^(3/2), x, 2, (3*a*c^(3/2)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(2*n) - (c*ProductLog(a*x^n))^(3/2)/(x^n*n)]
    @test_int [x^(-1 - n)*(c*ProductLog(a*x^n))^(1/2), x, 2, -((a*sqrt(c)*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/n) - (2*sqrt(c*ProductLog(a*x^n)))/(x^n*n)]
    @test_int [x^(-1 - n)/(c*ProductLog(a*x^n))^(1/2), x, 3, -((2*a*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(3*sqrt(c)*n)) - 2/(x^n*(3*n*sqrt(c*ProductLog(a*x^n)))) - (2*sqrt(c*ProductLog(a*x^n)))/(x^n*(3*c*n))]
    @test_int [x^(-1 - n)/(c*ProductLog(a*x^n))^(3/2), x, 4, (4*a*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(5*c^(3/2)*n) - 2/(x^n*(5*n*(c*ProductLog(a*x^n))^(3/2))) - 2/(x^n*(5*c*n*sqrt(c*ProductLog(a*x^n)))) + (4*sqrt(c*ProductLog(a*x^n)))/(x^n*(5*c^2*n))]
    @test_int [x^(-1 - n)/(c*ProductLog(a*x^n))^(5/2), x, 5, -((8*a*sqrt(pi)*erf(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(21*c^(5/2)*n)) - 2/(x^n*(7*n*(c*ProductLog(a*x^n))^(5/2))) - 2/(x^n*(7*c*n*(c*ProductLog(a*x^n))^(3/2))) + 4/(x^n*(21*c^2*n*sqrt(c*ProductLog(a*x^n)))) - (8*sqrt(c*ProductLog(a*x^n)))/(x^n*(21*c^3*n))]

    @test_int [x^(-1 - 2*n)*(c*ProductLog(a*x^n))^(11/2), x, 5, (165*a^2*c^(11/2)*sqrt(pi/2)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(256*n) - (165*c^3*(c*ProductLog(a*x^n))^(5/2))/(x^(2*n)*(128*n)) - (55*c^2*(c*ProductLog(a*x^n))^(7/2))/(x^(2*n)*(32*n)) - (11*c*(c*ProductLog(a*x^n))^(9/2))/(x^(2*n)*(8*n)) - (c*ProductLog(a*x^n))^(11/2)/(x^(2*n)*(2*n))]
    @test_int [x^(-1 - 2*n)*(c*ProductLog(a*x^n))^(9/2), x, 4, (27*a^2*c^(9/2)*sqrt(pi/2)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(64*n) - (27*c^2*(c*ProductLog(a*x^n))^(5/2))/(x^(2*n)*(32*n)) - (9*c*(c*ProductLog(a*x^n))^(7/2))/(x^(2*n)*(8*n)) - (c*ProductLog(a*x^n))^(9/2)/(x^(2*n)*(2*n))]
    @test_int [x^(-1 - 2*n)*(c*ProductLog(a*x^n))^(7/2), x, 3, (7*a^2*c^(7/2)*sqrt(pi/2)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(16*n) - (7*c*(c*ProductLog(a*x^n))^(5/2))/(x^(2*n)*(8*n)) - (c*ProductLog(a*x^n))^(7/2)/(x^(2*n)*(2*n))]
    @test_int [x^(-1 - 2*n)*(c*ProductLog(a*x^n))^(5/2), x, 2, (5*a^2*c^(5/2)*sqrt(pi/2)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(4*n) - (c*ProductLog(a*x^n))^(5/2)/(x^(2*n)*(2*n))]
    @test_int [x^(-1 - 2*n)*(c*ProductLog(a*x^n))^(3/2), x, 2, -((3*a^2*c^(3/2)*sqrt(pi/2)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/n) - (2*(c*ProductLog(a*x^n))^(3/2))/(x^(2*n)*n)]
    @test_int [x^(-1 - 2*n)*(c*ProductLog(a*x^n))^(1/2), x, 3, (2*a^2*sqrt(c)*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(3*n) - (2*sqrt(c*ProductLog(a*x^n)))/(x^(2*n)*(3*n)) + (2*(c*ProductLog(a*x^n))^(3/2))/(x^(2*n)*(3*c*n))]
    @test_int [x^(-1 - 2*n)/(c*ProductLog(a*x^n))^(1/2), x, 4, (8*a^2*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(15*sqrt(c)*n) - 2/(x^(2*n)*(5*n*sqrt(c*ProductLog(a*x^n)))) - (2*sqrt(c*ProductLog(a*x^n)))/(x^(2*n)*(15*c*n)) + (8*(c*ProductLog(a*x^n))^(3/2))/(x^(2*n)*(15*c^2*n))]
    @test_int [x^(-1 - 2*n)/(c*ProductLog(a*x^n))^(3/2), x, 5, -((32*a^2*sqrt(2*pi)*erf((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(35*c^(3/2)*n)) - 2/(x^(2*n)*(7*n*(c*ProductLog(a*x^n))^(3/2))) - 6/(x^(2*n)*(35*c*n*sqrt(c*ProductLog(a*x^n)))) + (8*sqrt(c*ProductLog(a*x^n)))/(x^(2*n)*(35*c^2*n)) - (32*(c*ProductLog(a*x^n))^(3/2))/(x^(2*n)*(35*c^3*n))]

    @test_int [x^(-1 + n)*(c*ProductLog(a*x^n))^(5/2), x, 5, (75*c^(5/2)*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(16*a*n) - (75*c^3*x^n)/(8*n*sqrt(c*ProductLog(a*x^n))) + (25*c^2*x^n*sqrt(c*ProductLog(a*x^n)))/(4*n) - (5*c*x^n*(c*ProductLog(a*x^n))^(3/2))/(2*n) + (x^n*(c*ProductLog(a*x^n))^(5/2))/n]
    @test_int [x^(-1 + n)*(c*ProductLog(a*x^n))^(3/2), x, 4, -((9*c^(3/2)*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(8*a*n)) + (9*c^2*x^n)/(4*n*sqrt(c*ProductLog(a*x^n))) - (3*c*x^n*sqrt(c*ProductLog(a*x^n)))/(2*n) + (x^n*(c*ProductLog(a*x^n))^(3/2))/n]
    @test_int [x^(-1 + n)*(c*ProductLog(a*x^n))^(1/2), x, 3, (sqrt(c)*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(4*a*n) - (c*x^n)/(2*n*sqrt(c*ProductLog(a*x^n))) + (x^n*sqrt(c*ProductLog(a*x^n)))/n]
    @test_int [x^(-1 + n)/(c*ProductLog(a*x^n))^(1/2), x, 2, (sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(2*a*sqrt(c)*n) + x^n/(n*sqrt(c*ProductLog(a*x^n)))]
    @test_int [x^(-1 + n)/(c*ProductLog(a*x^n))^(3/2), x, 2, (3*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(a*c^(3/2)*n) - (2*x^n)/(n*(c*ProductLog(a*x^n))^(3/2))]
    @test_int [x^(-1 + n)/(c*ProductLog(a*x^n))^(5/2), x, 3, (10*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(3*a*c^(5/2)*n) - (2*x^n)/(3*n*(c*ProductLog(a*x^n))^(5/2)) - (10*x^n)/(3*c*n*(c*ProductLog(a*x^n))^(3/2))]
    @test_int [x^(-1 + n)/(c*ProductLog(a*x^n))^(7/2), x, 4, (28*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(15*a*c^(7/2)*n) - (2*x^n)/(5*n*(c*ProductLog(a*x^n))^(7/2)) - (14*x^n)/(15*c*n*(c*ProductLog(a*x^n))^(5/2)) - (28*x^n)/(15*c^2*n*(c*ProductLog(a*x^n))^(3/2))]
    @test_int [x^(-1 + n)/(c*ProductLog(a*x^n))^(9/2), x, 5, (24*sqrt(pi)*erfi(sqrt(c*ProductLog(a*x^n))/sqrt(c)))/(35*a*c^(9/2)*n) - (2*x^n)/(7*n*(c*ProductLog(a*x^n))^(9/2)) - (18*x^n)/(35*c*n*(c*ProductLog(a*x^n))^(7/2)) - (12*x^n)/(35*c^2*n*(c*ProductLog(a*x^n))^(5/2)) - (24*x^n)/(35*c^3*n*(c*ProductLog(a*x^n))^(3/2))]

    @test_int [x^(-1 + 2*n)*(c*ProductLog(a*x^n))^(3/2), x, 5, (45*c^(3/2)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(256*a^2*n) - (45*c^3*x^(2*n))/(128*n*(c*ProductLog(a*x^n))^(3/2)) + (15*c^2*x^(2*n))/(32*n*sqrt(c*ProductLog(a*x^n))) - (3*c*x^(2*n)*sqrt(c*ProductLog(a*x^n)))/(8*n) + (x^(2*n)*(c*ProductLog(a*x^n))^(3/2))/(2*n)]
    @test_int [x^(-1 + 2*n)*(c*ProductLog(a*x^n))^(1/2), x, 4, -((3*sqrt(c)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(64*a^2*n)) + (3*c^2*x^(2*n))/(32*n*(c*ProductLog(a*x^n))^(3/2)) - (c*x^(2*n))/(8*n*sqrt(c*ProductLog(a*x^n))) + (x^(2*n)*sqrt(c*ProductLog(a*x^n)))/(2*n)]
    @test_int [x^(-1 + 2*n)/(c*ProductLog(a*x^n))^(1/2), x, 3, -((sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(16*a^2*sqrt(c)*n)) + (c*x^(2*n))/(8*n*(c*ProductLog(a*x^n))^(3/2)) + x^(2*n)/(2*n*sqrt(c*ProductLog(a*x^n)))]
    @test_int [x^(-1 + 2*n)/(c*ProductLog(a*x^n))^(3/2), x, 2, (3*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(4*a^2*c^(3/2)*n) + x^(2*n)/(2*n*(c*ProductLog(a*x^n))^(3/2))]
    @test_int [x^(-1 + 2*n)/(c*ProductLog(a*x^n))^(5/2), x, 2, (5*sqrt(pi/2)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(a^2*c^(5/2)*n) - (2*x^(2*n))/(n*(c*ProductLog(a*x^n))^(5/2))]
    @test_int [x^(-1 + 2*n)/(c*ProductLog(a*x^n))^(7/2), x, 3, (14*sqrt(2*pi)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(3*a^2*c^(7/2)*n) - (2*x^(2*n))/(3*n*(c*ProductLog(a*x^n))^(7/2)) - (14*x^(2*n))/(3*c*n*(c*ProductLog(a*x^n))^(5/2))]
    @test_int [x^(-1 + 2*n)/(c*ProductLog(a*x^n))^(9/2), x, 4, (24*sqrt(2*pi)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(5*a^2*c^(9/2)*n) - (2*x^(2*n))/(5*n*(c*ProductLog(a*x^n))^(9/2)) - (6*x^(2*n))/(5*c*n*(c*ProductLog(a*x^n))^(7/2)) - (24*x^(2*n))/(5*c^2*n*(c*ProductLog(a*x^n))^(5/2))]
    @test_int [x^(-1 + 2*n)/(c*ProductLog(a*x^n))^(11/2), x, 5, (352*sqrt(2*pi)*erfi((sqrt(2)*sqrt(c*ProductLog(a*x^n)))/sqrt(c)))/(105*a^2*c^(11/2)*n) - (2*x^(2*n))/(7*n*(c*ProductLog(a*x^n))^(11/2)) - (22*x^(2*n))/(35*c*n*(c*ProductLog(a*x^n))^(9/2)) - (88*x^(2*n))/(105*c^2*n*(c*ProductLog(a*x^n))^(7/2)) - (352*x^(2*n))/(105*c^3*n*(c*ProductLog(a*x^n))^(5/2))]

    @test_int [ProductLog(a*x^n)^4/x^(3*n + 1), x, 2, -((4*ProductLog(a*x^n)^3)/(x^(3*n)*(9*n))) - ProductLog(a*x^n)^4/(x^(3*n)*(3*n))]
    @test_int [ProductLog(a*x^n)^3/x^(2*n + 1), x, 2, -((3*ProductLog(a*x^n)^2)/(x^(2*n)*(4*n))) - ProductLog(a*x^n)^3/(x^(2*n)*(2*n))]
    @test_int [ProductLog(a*x^n)^2/x^(n + 1), x, 2, -((2*ProductLog(a*x^n))/(x^n*n)) - ProductLog(a*x^n)^2/(x^n*n)]
    @test_int [x^(2*n - 1)/ProductLog(a*x^n), x, 2, x^(2*n)/(4*n*ProductLog(a*x^n)^2) + x^(2*n)/(2*n*ProductLog(a*x^n))]
    @test_int [x^(3*n - 1)/ProductLog(a*x^n)^2, x, 2, (2*x^(3*n))/(9*n*ProductLog(a*x^n)^3) + x^(3*n)/(3*n*ProductLog(a*x^n)^2)]
    @test_int [x^(4*n - 1)/ProductLog(a*x^n)^3, x, 2, (3*x^(4*n))/(16*n*ProductLog(a*x^n)^4) + x^(4*n)/(4*n*ProductLog(a*x^n)^3)]

    @test_int [x^(-1 - n*(1 + p))*(c*ProductLog(a*x^n))^p, x, 2, -((c*ProductLog(a*x^n))^p/(x^(n*(1 + p))*n)) - (p*(c*ProductLog(a*x^n))^p*CannotIntegrate((x^(-1 - n*(1 + p))*ProductLog(a*x^n)^(1 + p))/(1 + ProductLog(a*x^n)), x))/ProductLog(a*x^n)^p]
    @test_int [x^(-1 + n*(0 - p))*(c*ProductLog(a*x^n))^p, x, 2, -((c*ProductLog(a*x^n))^p/(x^(n*p)*(n*p))) + (CannotIntegrate((x^(-1 - n*p)*ProductLog(a*x^n)^p)/(1 + ProductLog(a*x^n)), x)*(c*ProductLog(a*x^n))^p)/ProductLog(a*x^n)^p]
    @test_int [x^(-1 + n*(1 - p))*(c*ProductLog(a*x^n))^p, x, 2, -((c*p*x^(n*(1 - p))*(c*ProductLog(a*x^n))^(-1 + p))/(n*(1 - p)^2)) + (x^(n*(1 - p))*(c*ProductLog(a*x^n))^p)/(n*(1 - p))]
    @test_int [x^(-1 + n*(2 - p))*(c*ProductLog(a*x^n))^p, x, 3, (c^2*p*x^(n*(2 - p))*(c*ProductLog(a*x^n))^(-2 + p))/(n*(2 - p)^3) - (c*p*x^(n*(2 - p))*(c*ProductLog(a*x^n))^(-1 + p))/(n*(2 - p)^2) + (x^(n*(2 - p))*(c*ProductLog(a*x^n))^p)/(n*(2 - p))]
    @test_int [x^(-1 + n*(3 - p))*(c*ProductLog(a*x^n))^p, x, 4, -((2*c^3*p*x^(n*(3 - p))*(c*ProductLog(a*x^n))^(-3 + p))/(n*(3 - p)^4)) + (2*c^2*p*x^(n*(3 - p))*(c*ProductLog(a*x^n))^(-2 + p))/(n*(3 - p)^3) - (c*p*x^(n*(3 - p))*(c*ProductLog(a*x^n))^(-1 + p))/(n*(3 - p)^2) + (x^(n*(3 - p))*(c*ProductLog(a*x^n))^p)/(n*(3 - p))]

    #= ::Subsubsection::Closed:: =#
    #=x^m / (1+ProductLog(a*x^n))=#

    @test_int [x^3/(1 + ProductLog(a*x)), x, 4, -((3*x^4)/(128*ProductLog(a*x)^4)) + (3*x^4)/(32*ProductLog(a*x)^3) - (3*x^4)/(16*ProductLog(a*x)^2) + x^4/(4*ProductLog(a*x))]
    @test_int [x^2/(1 + ProductLog(a*x)), x, 3, (2*x^3)/(27*ProductLog(a*x)^3) - (2*x^3)/(9*ProductLog(a*x)^2) + x^3/(3*ProductLog(a*x))]
    @test_int [x/(1 + ProductLog(a*x)), x, 2, -(x^2/(4*ProductLog(a*x)^2)) + x^2/(2*ProductLog(a*x))]
    @test_int [1/(1 + ProductLog(a*x)), x, 1, a*x/(a*ProductLog(a*x))]
    @test_int [1/(x*(1 + ProductLog(a*x))), x, 1, log(ProductLog(a*x))]
    @test_int [1/(x^2*(1 + ProductLog(a*x))), x, 2, -(1/x) - a*ExpIntegralEi(-ProductLog(a*x))]
    @test_int [1/(x^3*(1 + ProductLog(a*x))), x, 3, -(1/(2*x^2)) + 2*a^2*ExpIntegralEi(-2*ProductLog(a*x)) + ProductLog(a*x)/x^2]
    @test_int [1/(x^4*(1 + ProductLog(a*x))), x, 4, -(1/(3*x^3)) - (9/2)*a^3*ExpIntegralEi(-3*ProductLog(a*x)) + ProductLog(a*x)/(2*x^3) - (3*ProductLog(a*x)^2)/(2*x^3)]

    @test_int [x^3/(1 + ProductLog(a*x^2)), x, 3, -(x^4/(8*ProductLog(a*x^2)^2)) + x^4/(4*ProductLog(a*x^2))]
    @test_int [x^2/(1 + ProductLog(a*x^2)), x, 0, CannotIntegrate(x^2/(1 + ProductLog(a*x^2)), x)]
    @test_int [x/(1 + ProductLog(a*x^2)), x, 2, x^2/(2*ProductLog(a*x^2))]
    @test_int [1/(1 + ProductLog(a*x^2)), x, 0, CannotIntegrate(1/(1 + ProductLog(a*x^2)), x)]
    @test_int [1/(x*(1 + ProductLog(a*x^2))), x, 1, (1/2)*log(ProductLog(a*x^2))]
    @test_int [1/(x^2*(1 + ProductLog(a*x^2))), x, 0, CannotIntegrate(1/(x^2*(1 + ProductLog(a*x^2))), x)]
    @test_int [1/(x^3*(1 + ProductLog(a*x^2))), x, 3, -(1/(2*x^2)) - (1/2)*a*ExpIntegralEi(-ProductLog(a*x^2))]
    @test_int [1/(x^4*(1 + ProductLog(a*x^2))), x, 0, CannotIntegrate(1/(x^4*(1 + ProductLog(a*x^2))), x)]

    @test_int [x^3/(1 + ProductLog(a/x)), x, 6, x^4/4 - (32/3)*a^4*ExpIntegralEi(-4*ProductLog(a/x)) - (1/3)*x^4*ProductLog(a/x) + (2/3)*x^4*ProductLog(a/x)^2 - (8/3)*x^4*ProductLog(a/x)^3]
    @test_int [x^2/(1 + ProductLog(a/x)), x, 5, x^3/3 + (9/2)*a^3*ExpIntegralEi(-3*ProductLog(a/x)) - (1/2)*x^3*ProductLog(a/x) + (3/2)*x^3*ProductLog(a/x)^2]
    @test_int [x/(1 + ProductLog(a/x)), x, 4, x^2/2 - 2*a^2*ExpIntegralEi(-2*ProductLog(a/x)) - x^2*ProductLog(a/x)]
    @test_int [1/(1 + ProductLog(a/x)), x, 3, x + a*ExpIntegralEi(-ProductLog(a/x))]
    @test_int [1/(x*(1 + ProductLog(a/x))), x, 1, -log(ProductLog(a/x))]
    @test_int [1/(x^2*(1 + ProductLog(a/x))), x, 2, -(1/(x*ProductLog(a/x)))]
    @test_int [1/(x^3*(1 + ProductLog(a/x))), x, 3, 1/(4*x^2*ProductLog(a/x)^2) - 1/(2*x^2*ProductLog(a/x))]
    @test_int [1/(x^4*(1 + ProductLog(a/x))), x, 4, -(2/(27*x^3*ProductLog(a/x)^3)) + 2/(9*x^3*ProductLog(a/x)^2) - 1/(3*x^3*ProductLog(a/x))]

    @test_int [x^5/(1 + ProductLog(a/x^2)), x, 6, x^6/6 + (9/4)*a^3*ExpIntegralEi(-3*ProductLog(a/x^2)) - (1/4)*x^6*ProductLog(a/x^2) + (3/4)*x^6*ProductLog(a/x^2)^2]
    @test_int [x^3/(1 + ProductLog(a/x^2)), x, 5, x^4/4 - a^2*ExpIntegralEi(-2*ProductLog(a/x^2)) - (1/2)*x^4*ProductLog(a/x^2)]
    @test_int [x^1/(1 + ProductLog(a/x^2)), x, 4, x^2/2 + (1/2)*a*ExpIntegralEi(-ProductLog(a/x^2))]
    @test_int [1/(x^1*(1 + ProductLog(a/x^2))), x, 1, (-(1/2))*log(ProductLog(a/x^2))]
    @test_int [1/(x^3*(1 + ProductLog(a/x^2))), x, 3, -(1/(2*x^2*ProductLog(a/x^2)))]

    @test_int [x^4/(1 + ProductLog(a/x^2)), x, 1, CannotIntegrate(x^4/(1 + ProductLog(a/x^2)), x)]
    @test_int [x^2/(1 + ProductLog(a/x^2)), x, 1, CannotIntegrate(x^2/(1 + ProductLog(a/x^2)), x)]
    @test_int [x^0/(1 + ProductLog(a/x^2)), x, 1, CannotIntegrate(1/(1 + ProductLog(a/x^2)), x)]
    @test_int [1/(x^2*(1 + ProductLog(a/x^2))), x, 1, CannotIntegrate(1/(x^2*(1 + ProductLog(a/x^2))), x)]
    @test_int [1/(x^4*(1 + ProductLog(a/x^2))), x, 1, CannotIntegrate(1/(x^4*(1 + ProductLog(a/x^2))), x)]

    @test_int [x^m/(d + d*ProductLog(a*x)), x, 1, (x^m*Gamma(1 + m, (-(1 + m)*ProductLog(a*x))))/(ℯ^(m*ProductLog(a*x))*(-(1 + m)*ProductLog(a*x))^m*(a*d*(1 + m)))]

    #= ::Subsubsection::Closed:: =#
    #=ProductLog(a*x^n)^p / (1+ProductLog(a*x^n))=#

    @test_int [ProductLog(a/x^(1/4))^5/(1 + ProductLog(a/x^(1/4))), x, 1, x*ProductLog(a/x^(1/4))^4]
    @test_int [ProductLog(a/x^(1/3))^4/(1 + ProductLog(a/x^(1/3))), x, 1, x*ProductLog(a/x^(1/3))^3]
    @test_int [ProductLog(a/sqrt(x))^3/(1 + ProductLog(a/sqrt(x))), x, 1, x*ProductLog(a/sqrt(x))^2]
    @test_int [ProductLog(a/x)^2/(1 + ProductLog(a/x)), x, 1, x*ProductLog(a/x)]
    @test_int [1/(ProductLog(a*sqrt(x))*(1 + ProductLog(a*sqrt(x)))), x, 1, x/ProductLog(a*sqrt(x))^2]
    @test_int [1/(ProductLog(a*x^(1/3))^2*(1 + ProductLog(a*x^(1/3)))), x, 1, x/ProductLog(a*x^(1/3))^3]
    @test_int [1/(ProductLog(a*x^(1/4))^3*(1 + ProductLog(a*x^(1/4)))), x, 1, x/ProductLog(a*x^(1/4))^4]

    @test_int [ProductLog(a/x^(1/4))^4/(1 + ProductLog(a/x^(1/4))), x, 1, -4*a^4*ExpIntegralEi(-4*ProductLog(a/x^(1/4)))]
    @test_int [ProductLog(a/x^(1/3))^3/(1 + ProductLog(a/x^(1/3))), x, 1, -3*a^3*ExpIntegralEi(-3*ProductLog(a/x^(1/3)))]
    @test_int [ProductLog(a/sqrt(x))^2/(1 + ProductLog(a/sqrt(x))), x, 1, -2*a^2*ExpIntegralEi(-2*ProductLog(a/sqrt(x)))]
    @test_int [ProductLog(a/x)/(1 + ProductLog(a/x)), x, 1, (-a)*ExpIntegralEi(-ProductLog(a/x))]
    @test_int [1/(ProductLog(a*x)*(1 + ProductLog(a*x))), x, 1, ExpIntegralEi(ProductLog(a*x))/a]
    @test_int [1/(ProductLog(a*sqrt(x))^2*(1 + ProductLog(a*sqrt(x)))), x, 1, (2*ExpIntegralEi(2*ProductLog(a*sqrt(x))))/a^2]
    @test_int [1/(ProductLog(a*x^(1/3))^3*(1 + ProductLog(a*x^(1/3)))), x, 1, (3*ExpIntegralEi(3*ProductLog(a*x^(1/3))))/a^3]
    @test_int [1/(ProductLog(a*x^(1/4))^4*(1 + ProductLog(a*x^(1/4)))), x, 1, (4*ExpIntegralEi(4*ProductLog(a*x^(1/4))))/a^4]

    @test_int [ProductLog(a*x^n)^(1 - 1/n)/(1 + ProductLog(a*x^n)), x, 1, x/ProductLog(a*x^n)^(n^(-1))]
    @test_int [ProductLog(a*x^(1/(1 - p)))^p/(1 + ProductLog(a*x^(1/(1 - p)))), x, 1, x*ProductLog(a*x^(1/(1 - p)))^(p - 1)]
    end

max_stars_repo_path: test/8 Special functions/8.9 Product logarithm function.jl


text:
module JuliaManager

const version = v"0.2.0-DEV"
# This could be useful for checking frontend-backend compatibility.

include("SysImageHack/SysImageHack.jl")
using .SysImageHack: compile_patched_sysimage

bundled_jlm() = joinpath(dirname(@__DIR__), "jlm", "jlm")

"""
    JuliaManager.install_cli([destdir = "~/.julia/bin"]; upgrade)

Install `jlm` CLI at `destdir`.
"""
function install_cli(destdir = joinpath(homedir(), ".julia", "bin");
                     upgrade = false)
    destpath = joinpath(destdir, "jlm")
    if isfile(destpath) && !upgrade
        @info "CLI `jlm` is already installed at $destpath"
    else
        @info "Installing CLI `jlm` at $destpath"
        mkpath(destdir)
        rm(destpath, force=true)
        symlink(bundled_jlm(), destpath)
    end

    installed = Sys.which("jlm")
    if installed === nothing
        @warn "`jlm` is not on PATH.  Please make sure $destdir is in PATH."
    elseif realpath(installed) != realpath(destpath)
        @warn """
        A `jlm` program different from the one just installed may be
        executed.  Please check your PATH.
        Program to be executed:
            $installed
        Program that is installed:
            $destpath
        """
        if !upgrade
            @info """
            Upgrading CLI with `JuliaManager.install_cli(upgrade=true)` may fix
            the issue.
            """
        end
    end

    return
end

end # module

ext: jl


text:
# define Vulkan types locally, so we don't need to add VulkanCore.jl as dependency
const VkResult = Cuint
const VkInstance = Ptr{Cvoid}
const VkSurfaceKHR = Ptr{Cvoid}
const VkPhysicalDevice = Ptr{Cvoid}

struct VkAllocationCallbacks
    pUserData::Ptr{Cvoid}
    pfnAllocation::Ptr{Cvoid}
    pfnReallocation::Ptr{Cvoid}
    pfnFree::Ptr{Cvoid}
    pfnInternalAllocation::Ptr{Cvoid}
    pfnInternalFree::Ptr{Cvoid}
end

"""
    VulkanSupported()
Return whether the Vulkan loader has been found.
"""
VulkanSupported() = Bool(ccall((:glfwVulkanSupported, libglfw), Cint, ()))

"""
    GetRequiredInstanceExtensions()
Return a vector of names of Vulkan instance extensions.
"""
function GetRequiredInstanceExtensions()
    count = Ref{Cuint}(0)
    ptr = ccall((:glfwGetRequiredInstanceExtensions, libglfw), Ptr{Ptr{Cchar}}, (Ref{Cuint},), count)
    return unsafe_string.(unsafe_wrap(Array, ptr, count[]))
end

"""
    GetInstanceProcAddress(instance, procname) -> funcptr
Return the address of the specified Vulkan core or extension function for the specified instance.
`funcptr` can be used directly as the first argument of `ccall`: ccall(funcptr, ...).
"""
GetInstanceProcAddress(instance, procname) = ccall((:glfwGetInstanceProcAddress, libglfw), Ptr{Cvoid}, (VkInstance, Cstring), instance, procname)

"""
    GetPhysicalDevicePresentationSupport(instance, device, queuefamily)
Return whether the specified queue family of the specified physical device supports presentation to the platform GLFW was built for.
"""
GetPhysicalDevicePresentationSupport(instance, device, queuefamily) = Bool(ccall((:glfwGetPhysicalDevicePresentationSupport, libglfw), Cint, (VkInstance, VkPhysicalDevice, Cuint), instance, device, queuefamily))

"""
    CreateWindowSurface(instance, window, allocator=C_NULL)
Create a Vulkan surface for the specified window.
"""
function CreateWindowSurface(instance, window, allocator=C_NULL)
    surface = Ref{VkSurfaceKHR}(C_NULL)
    ccall((:glfwCreateWindowSurface, libglfw), VkResult, (VkInstance, Window, Ptr{VkAllocationCallbacks}, Ref{VkSurfaceKHR}), instance, window, allocator, surface)
    return surface[]
end


text:
using Test, LinearMaps

include("linearmaps.jl")

include("transpose.jl")

include("functionmap.jl")

include("linearcombination.jl")

include("composition.jl")

include("wrappedmap.jl")

include("uniformscalingmap.jl")

include("numbertypes.jl")

include("blockmap.jl")

include("kronecker.jl")

include("conversion.jl")


text:
function percolation(adjacency::Array{Float64,2})

    degrees = sum(adjacency, dims = 1)
    κ = mean(degrees .^ 2) / mean(degrees)

    return 1 - 1 / (κ - 1)
end


text:
#
# datasimul_tools.jl
#
# Provide tools to simulate synthetic parameters and dataset.
#
# ------------------------------------------------
#
# This file is part of Rhapsodie
#
#
# Copyright (c) 2017-2021 Laurence Denneulin (see LICENCE.md)

#------------------------------------------------

function data_generator(model::AbstractArray{T,N}, weights::AbstractArray{T,N};bad=zero(T), seed = 1992) where {T<:AbstractFloat,N}
    seed === nothing ||  Random.seed!(seed);

    data = Array{T}(undef, size(model));
    @inbounds for i in eachindex(data, weights)
        w=weights[i]
        (isfinite(w) && w >= 0 ) || error("invalid weights")
        if w >0
            data[i] = model[i]  +randn()/sqrt(w)
        elseif w ==0
            data[i]=bad;
        end
    end
    return data
end

function generate_model(S::PolarimetricMap, A::Mapping)
    @assert size(S) == get_par().cols[1:2];

    M=Array{Float64,3}(undef, get_par().rows[1],
                              get_par().rows[2],
                              get_par().dataset_length)

	ker= LinearInterpolators.CatmullRomSpline(Float64, LinearInterpolators.Flat)
    for k=1:get_par().dataset_length
        output_size=(get_par().rows[1], Int64(get_par().rows[2]/2));
        input_size= get_par().cols[1:2];
    	T1=TwoDimensionalTransformInterpolator(output_size,
    	                                       input_size,
    	                                       ker,
    	                                       ker,
    	                                       Trans_Table[k][1])
    	T2=TwoDimensionalTransformInterpolator(output_size,
    	                                       input_size,
    	                                       ker,
    	                                       ker,
    	                                       Trans_Table[k][2])

	    F=FieldTransformOperator(get_par().cols,
	                                        get_par().rows,
	                                        get_par().v[k][1],
	                                        get_par().v[k][2],
	                                        T1,
	                                        T2,
	                                        A)

	    M[:,:,k].=F * cat(S.I, S.Q, S.U, dims=3);
	end
    return M
end

function data_simulator(Good_Pix, tau, A::Mapping; ro_noise=8.5)
    map_size=get_par().cols[1:2];

    S = generate_parameters(map_size, tau);

    M=generate_model(S,A);

    VAR=max.(M,zero(eltype(M))) .+ro_noise^2
	W=Good_Pix ./ VAR
	D=data_generator(M, W)

	check_MSE(M,D,W);

    CS=PolarimetricMap("intensities", A*S.Iu, A*S.Ip, A*S.θ)
	return D,W,S,CS
end

function data_simulator(Good_Pix, tau, A::Mapping, S::PolarimetricMap; ro_noise=8.5)
    @assert size(S) == get_par().cols[1:2];

    M=generate_model(S,A);

    VAR=max.(M,zero(eltype(M))) .+ro_noise^2
	W=Good_Pix ./ VAR
	D=data_generator(M, W)

	check_MSE(M,D,W);
    CS=PolarimetricMap("intensities", A*S.Iu, A*S.Ip, A*S.θ)
	return D,W,CS
end

function check_MSE(model, data, weights)
	MSE = vdot(data-model, weights.*(data-model)) ;
	N=count(weights .> 0);
	println("MSE=$MSE, N=$N, MSE/N=$(MSE/N)");
end

function generate_parameters(map_size, tau)
	Ip=zeros(map_size);
	Iu=zeros(map_size);
	θ=zeros(map_size);
	STAR1=zeros(map_size);
	STAR2=zeros(map_size);

	for i=1:map_size[1]
    	for j=1:map_size[2]
    		r1=(map_size[1]+1)/2-i;
    		r2=(map_size[2]+1)/2-j;
    		if (r1^2+r2^2<=20^2)
        		Iu[i,j]=1000;
        		Ip[i,j]=tau*Iu[i,j]/(1-tau);
    		end
    		if ((r1^2+r2^2>=25^2)&&(r1^2+r2^2<=27^2))
        		Iu[i,j]=1000;
        		Ip[i,j]=tau*Iu[i,j]/(1-tau);
    		end
    		if ((r1^2+r2^2>=32^2)&&(r1^2+r2^2<=40^2))
        		Iu[i,j]=1000;
        		Ip[i,j]=tau*Iu[i,j]/(1-tau);
    		end
    		θ[i,map_size[2]+1-j]=atan(j-map_size[2]/2,i-map_size[1]/2);
			STAR1[i,j]=200*exp(-((i-map_size[1]/2)^2+(j-map_size[2]/2)^2)/(2*75^2))
			STAR2[i,j]=100000*exp(-((i-map_size[1]/2)^2+(j-map_size[2]/2)^2)/(2*7^2))
			if ((((map_size[1]+1)/2-i)^2+((map_size[2]+1)/2-j)^2)<=10^2)
        		STAR2[i,j]=800;
        		Iu[i,j]=0;
        		Ip[i,j]=0;
    		end
			if ((((map_size[1]+1)/2-i)^2+((map_size[2]+1)/2-j)^2)<=70^2)
        		STAR1[i,j]=50;
    		end
		end
	end
	θ=θ.*(Ip.!=0);
	STAR=STAR1+STAR2
	STAR[round(Int64,10*map_size[1]/16)-3,round(Int64,10*map_size[2]/16)]=20000.0;
	STAR[round(Int64,10*map_size[1]/16),round(Int64,10*map_size[2]/16)-3]=100000.0;

    return PolarimetricMap("intensities", Iu+STAR, Ip, θ);
end

max_stars_repo_name: LaurenceDenneulin/Rhapsodie


text:
@testset "Searches" begin

    @testset "Searches: Binary" begin
        sample = [0, 23, 52, 552, 555, 602, 1004]
        reversed_sample = reverse(sample)
        unsorted_sample = [124, 53, 21, 163]
        binary_search(sample, 52)
        binary_search(reversed_sample, 52, rev=true)
        @test_throws ErrorException binary_search(unsorted_sample, 21)  # throws an error
    end

    @testset "Searches: Linear" begin
        array = [1,3,4,7,8,11]
        linear_search(array, 3)
        linear_search(array, 8)
        linear_search(array, 12)
    end

    @testset "Searches: Exponential" begin
        arr = [1, 2, 3, 4, 13, 15, 20];
        x = 4;
        n = size(arr)[1]
        l = 1;
        r = n;

        exponential_search(arr, x)
    end

    @testset "Searches: Interpolation" begin
        arr = [1, 2, 3, 4, 13, 15, 20];
        x = 15;
        n = size(arr)[1]
        l = 1;
        r = n;

        interpolation_search(arr, l, r, x)
    end

    @testset "Searches: Jump" begin
        arr = [1, 2, 3, 31, 4, 13];
        x = 31;
        jump = 2; # optimum is sqroot(n)
        n = size(arr)[1];

        jump_search(arr, x, jump)
    end

end

max_stars_repo_name: ashwani-rathee/Julia

max_issues_repo_name: ashwani-rathee/Julia

max_forks_repo_name: ashwani-rathee/Julia


text:
"""
    AbstractEffectSize

An abstract type to represent an effect size.

Effect | Effect size
:---|---:
Small | 0.2
Medium | 0.5
Large | 0.8

Subtypes implement:

Method | Description
:--- | :---
`effectsize` | returns the effect size index
`confint` | returns the confidence interval
"""
abstract type AbstractEffectSize end

"""
    effectsize(es::AbstractEffectSize)

Return the effect size index.
"""
effectsize(::T) where T<:AbstractEffectSize =
    throw(ArgumentError("`effectsize` is not implemented for $(string(T))"))

"""
    confint(es::AbstractEffectSize) -> ConfidenceInterval

Return the confidence interval of an effect size as a `ConfidenceInterval` object.
"""
confint(::T) where T<:AbstractEffectSize =
    throw(ArgumentError("`confint` is not implemented for $(string(T))"))

"""
    quantile(es::AbstractEffectSize) -> Float64

Returns the quantile of a confidence interval.
"""
quantile(es::AbstractEffectSize) = quantile(confint(es))

# Used by: CohenD
function pooledstd(xs::AbstractVector{T}, ys::AbstractVector{T}) where T<:Real
    nx = length(xs)
    ny = length(ys)
    return √(((nx - 1) * var(xs) + (ny - 1) * var(ys)) / (nx + ny - 2))
end

function correction(n::Integer)
    n > 1 || throw(DomainError(n))
    m = n - 2
    if n < 40
        corrfact = gamma(m / 2) / (√(m / 2) * gamma((m - 1) / 2))
    else
        corrfact = 1 − (3 / (4 * m − 9))
    end
    return corrfact
end

_effectsize(μx::T, μy::T, σ::T) where T<:Real = ((μx - μy) / σ)

_effectsize(μx::T, μy::T, σ::T, n::Integer) where T<:Real = ((μx - μy) / σ) * correction(n)

"""
    CohenD(xs, ys[, bootstrap]; [quantile=0.95])

Calculate Cohen's ``d`` effect size index between two vectors `xs` and `ys`.

A confidence interval for the effect size is calculated at the `quantile` quantile. If
`bootstrap` is provided, the confidence interval is calculated by resampling from `xs`
and `ys` `bootstrap` times.

```math
    d = \\frac{m_A - m_B}{s}
```

where ``m`` is the mean and ``s`` is the pooled standard deviation:

```math
    s = \\sqrt{\\frac{(n_A - 1) s_A^2 + (n_B - 1) s_B^2}{n_A + n_B - 2}}
```

If ``m_A`` > ``m_B``, ``d`` will be positive and if ``m_A`` < ``m_B``, ``d`` will be negative.

!!! note

    `HedgeG` outperforms `CohenD` when sample sizes are < 20.

# Examples

```julia
xs = randn(100000)
ys = randn(100000) .+ 0.01

using EffectSizes
CohenD(xs, ys)

using HypothesisTests
EqualVarianceTTest(xs, ys)
```
"""
struct CohenD{T<:Real,CI<:AbstractConfidenceInterval{T}} <: AbstractEffectSize
    d::T
    ci::CI
end

function cohend(xs::AbstractVector{T}, ys::AbstractVector{T}) where T<:Real
    return _effectsize(
        mean(xs),
        mean(ys),
        pooledstd(xs, ys),
    )
end

effectsize(es::CohenD) = es.d
confint(es::CohenD) = es.ci

"""
    const EffectSize = CohenD

See [`CohenD`](@ref).
"""
const EffectSize = CohenD

"""
    HedgeG(xs, ys[, bootstrap]; [quantile=0.95])

Calculate Hedge's ``g`` effect size index between two vectors `xs` and `ys`.

A confidence interval for the effect size is calculated at the `quantile` quantile. If
`bootstrap` is provided, the confidence interval is calculated by resampling from `xs`
and `ys` `bootstrap` times.

```math
    g = \\frac{m_A - m_B}{s}
```

where ``m`` is the mean and ``s`` is the pooled standard deviation:

```math
    s = \\sqrt{\\frac{(n_A - 1) s_A^2 + (n_B - 1) s_B^2}{n_A + n_B}}
```

If ``m_A`` > ``m_B``, ``g`` will be positive and if ``m_A`` < ``m_B``, ``g`` will be
negative.

!!! note

    `HedgeG` outperforms `CohenD` when sample sizes are < 20.
"""
struct HedgeG{T<:Real,CI<:AbstractConfidenceInterval{T}} <: AbstractEffectSize
    g::T
    ci::CI
end

function hedgeg(xs::AbstractVector{T}, ys::AbstractVector{T}) where T<:Real
    return _effectsize(
        mean(xs),
        mean(ys),
        pooledstd(xs, ys),
        length(xs) + length(ys),
    )
end

effectsize(es::HedgeG) = es.g
confint(es::HedgeG) = es.ci

"""
    GlassΔ(treatment, control[, bootstrap]; [quantile=0.95])

Calculate Glass's ``Δ`` effect size index between two vectors `treatment` and `control`.

A confidence interval for the effect size is calculated at the `quantile` quantile. If
`bootstrap` is provided, the confidence interval is calculated by resampling from `xs`
and `ys` `bootstrap` times.

```math
    Δ = \\frac{m_T - m_C}{s_C}
```

where ``m`` is the mean, ``s`` is the standard deviation, ``T`` is the treatment group and
``C`` is the control group.

If ``m_T`` > ``m_C``, ``Δ`` will be positive and if ``m_T`` < ``m_C``, ``Δ`` will be negative.

!!! note

    `GlassΔ` should be used when the standard deviations between the two groups are very
    different.
"""
struct GlassΔ{T<:Real,CI<:AbstractConfidenceInterval{T}} <: AbstractEffectSize
    Δ::T
    ci::CI
end

function glassΔ(xs::AbstractVector{T}, ys::AbstractVector{T}) where T<:Real
    return _effectsize(
        mean(xs),
        mean(ys),
        std(ys),
    )
end

effectsize(es::GlassΔ) = es.Δ
confint(es::GlassΔ) = es.ci

# constructors

for (T, f) = [(:CohenD, cohend), (:GlassΔ, glassΔ), (:HedgeG, hedgeg)]
    @eval begin
        # Normal CI
        function $T(
            xs::AbstractVector{T},
            ys::AbstractVector{T};
            quantile::Float64=0.95,
        ) where T<:Real
            es = $f(xs, ys)
            ci = ConfidenceInterval(xs, ys, es; quantile=quantile)
            $T(es, ci)
        end

        # Bootstrap CI
        function $T(
            xs::AbstractVector{T},
            ys::AbstractVector{T},
            bootstrap::Integer;
            quantile::Float64=0.95,
        ) where T<:Real
            es = $f(xs, ys)
            ci = BootstrapConfidenceInterval($f, xs, ys, bootstrap; quantile=quantile)
            $T(es, ci)
        end
    end
end


text:
## https://developer.spotify.com/documentation/web-api/reference/#/operations/search

"""
    search_get(;q::String="Coldplay", item_type::String="track,artist", include_external::String="",
                    limit::Int64=20, market::String="US", offset::Int64=0)

**Summary**: Get Spotify catalog information about albums, artists, playlists, tracks,
             shows or episodes that match a keyword string.

# Optional keywords
- `q::String` : Search query, e.g. "Coldplay" which is also set as the default
- `item_type::String` : A comma-separated list of item types to search across. Search results include
                   hits from all the specified item types. For example, item_type = "album,tarck" returns
                   both albums and tracks with the search query included in their name.
- `include_external::String` : If include_external="audio" is specified then the response will include any
                               relevant audio content that is hosted externally.
- `limit::Int64` : Maximum number of items to return, default is set to 20
- `market::String` : An ISO 3166-1 alpha-2 country code. If a country code is specified,
                        only episodes that are available in that market will be returned.
                        Default is set to "US".
- `offset::Int64` : Index of the first item to return, default is set to 0

# Example
```julia-repl
julia> Spotify.search_get(;q = "Greenday", item_type = "album")[1]
JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
  :albums => {…
```
"""
function search_get(;q::String="Coldplay", item_type::String="track,artist", include_external::String="",
                    limit::Int64=20, market::String="US", offset::Int64=0)

    url1 = "search?q=$q&type=$item_type&include_external=$include_external"
    url2 = "&limit=$limit&market=$market&offset=$offset"

    return Spotify.spotify_request(url1 * url2)

end


text:
"""
    RunNeuralNetwork(Epochs, ActivationFunction, LossFunction, EarlyStopping, Patience, NeuralNetwork)

Train a neural network.

    Usage:
```julia-repl
RunNeuralNetwork(epochs, ActivationFunction, LossFunction, EarlyStopping, Patience, NeuralNetwork)
```
Arguments:
- `Epochs` : The number of iterations to train the network for.
- `ActivationFunction` : The activation function to use.
- `LossFunction` : The loss function to use.
- `EarlyStopping` : Whether to stop training early based on Patience.
- `Patience` : The number of epochs to assess improvement in loss reduction over.
- `NeuralNetwork` : The NeuralNetwork structure.
"""
function RunNeuralNetwork(Epochs::Int64 = 1000, ActivationFunction::String = "Sigmoid", LossFunction::String = "MeanSquareError", EarlyStopping::Bool = false, Patience::Int64 = 10, NeuralNetwork)

    # Check function arguments

    (ActivationFunction == "Sigmoid" || ActivationFunction == "Tanh" || ActivationFunction == "ReLU" || ActivationFunction == "Linear") || error("`ActivationFunction` should be a String of either 'Sigmoid', 'Tanh', 'ReLU' or 'Linear'.")

    (LossFunction == "SumOfSquaresError" || LossFunction == "MeanSquareError" || LossFunction == "CrossEntropy") || error("`LossFunction` should be a String of either 'SumOfSquaresError', 'MeanSquareError', or 'CrossEntropy'.")

    # Instantiate empty vector to store loss function results

    loss = zeros(Epochs)

    # Instantiate early stopping counter

    BadCounter = 0

    # Train the network

    for i in 1:Epochs
        NeuralNetwork = FeedForward(NeuralNetwork)
        NeuralNetwork = BackPropogation(NeuralNetwork, ActivationFunction)

        if LossFunction == "MeanSquareError"
            loss[i] = MeanSquareError(NeuralNetwork)
        elseif LossFunction == "SumOfSquaresError"
            loss[i] = SumOfSquaresError(NeuralNetwork)
        elseif LossFunction == "CrossEntropy"
            loss[i] = CrossEntropy(NeuralNetwork)
        end
        print(string("Epoch: ", i, " of ", Epochs, ". Loss: ", loss[i]))

        if i >= 0.1 * Epochs
            if EarlyStopping == true
                if loss[i] >= loss[i-1]
                    BadCounter = BadCounter + 1
                    if BadCounter == Patience
                        break
                    end
                else
                    BadCounter = 0 # Rest if there is an improvement
                end
            else
            end
        end
    end

    return NeuralNetwork, loss
end


text:
using OrdinaryDiffEq, DiffEqProblemLibrary, Base.Test

sol =solve(prob_ode_linear,Discrete())

@test sol[1] == sol[end]

@test sol(0.5:0.1:0.7) == [sol[1],sol[1],sol[1]]

sol =solve(prob_ode_2Dlinear,Discrete())

@test sol[1] == sol[end]

@test sol(0.5) == sol[1]

sol =solve(prob_ode_linear,FunctionMap())

@test sol[end] ≈ .505

sol =solve(prob_ode_linear,FunctionMap(scale_by_time=true),dt=1/4)

sol2 =solve(prob_ode_linear,Euler(),dt=1/4)

@test sol[end] == sol2[end]

@test sol(0.53) != sol2(0.53)

sol =solve(prob_ode_2Dlinear,FunctionMap())

sol2 =solve(prob_ode_2Dlinear,Euler(),dt=1)

sol =solve(prob_ode_2Dlinear,FunctionMap(scale_by_time=true),dt=1/4)

sol2 =solve(prob_ode_2Dlinear,Euler(),dt=1/4)

@test sol[end] == sol2[end]

@test sol(0.35) != sol2(0.53)


text:
using Test
using MPI
using ClimateMachine.Mesh.BrickMesh

function main()
    MPI.Init()
    comm = MPI.COMM_WORLD

    (elemtovert, elemtocorner, facecode) = brickmesh(
        (2.0:5.0, 4.0:6.0),
        (false, true);
        part = MPI.Comm_rank(comm) + 1,
        numparts = MPI.Comm_size(comm),
    )

    code = centroidtocode(comm, elemtocorner)
    (d, nelem) = size(code)

    root = 0
    counts = MPI.Allgather(Cint(length(code)), comm)
    code_all = MPI.Gatherv(code, counts, root, comm)

    if MPI.Comm_rank(comm) == root
        code_all = reshape(code_all, d, div(sum(counts), d))

        code_expect = UInt64[
            0x0000000000000000 0x1555555555555555 0xffffffffffffffff 0x5555555555555555 0x6aaaaaaaaaaaaaaa 0xaaaaaaaaaaaaaaaa
            0x0000000000000000 0x5555555555555555 0xffffffffffffffff 0x5555555555555555 0xaaaaaaaaaaaaaaaa 0xaaaaaaaaaaaaaaaa
        ]
        @test code_all == code_expect
    end
end

main()


text:
export create_πcmp

# Unlike curl, divergence, gradient for which the field dimension Kf and the space dimension
# K are the same, here we assume they can be different.

# Wrapper to convert AbstractVector's to SVec's.
create_πcmp(N::AbsVecInteger,
            permute::AbsVecInteger;  # permute[w]: component of output field where w-component of input field is placed; e.g., permute = [3,1,2] transforms [F1,F2,F3] to [F2,F3,F1]
            scale::AbsVecNumber=ones(length(permute)),  # scale[w]: scale factor to w-component of input field
            order_cmpfirst::Bool=true) =  # true to use Cartesian-component-major ordering for more tightly banded matrix
    (K = length(N); Kf = length(permute); create_πcmp(SInt{K}(N), SInt{Kf}(permute), scale=SVec{Kf}(scale), order_cmpfirst=order_cmpfirst))

# Create the permutation matrix that permutes the order of Cartesian components of a vector
# field.
function create_πcmp(N::SInt{K},  # size of grid
                     permute::SInt{Kf};  # permute[w]: component of output field where w-component of input field is placed; e.g., permute = [3,1,2] transforms [F1,F2,F3] to [F2,F3,F1]
                     scale::SVec{Kf,T}=SVec{Kf}(ntuple(k->1.0, Val(Kf))),  # scale[w]: scale factor to w-component of input field
                     order_cmpfirst::Bool=true  # true to use Cartesian-component-major ordering for more tightly banded matrix
                     ) where {K,Kf,T<:Number}
    M = prod(N)
    KfM = Kf * M

    Itot = VecInt(undef, KfM)
    Jtot = VecInt(undef, KfM)
    Vtot = Vector{T}(undef, KfM)

    for nw = 1:Kf  # component of input
        nv = permute[nw]  # component of output where w-component of input is placed

        istr, ioff = order_cmpfirst ? (Kf, nv-Kf) : (1, M*(nv-1))  # (row stride, row offset)
        jstr, joff = order_cmpfirst ? (Kf, nw-Kf) : (1, M*(nw-1))  # (column stride, column offset)

        indₛ, indₑ = (nw-1)*M + 1, nw*M
        @. Itot[indₛ:indₑ] = istr * (1:M) + ioff
        @. Jtot[indₛ:indₑ] = jstr * (1:M) + joff
        @. Vtot[indₛ:indₑ] = scale[nw]
    end

    return dropzeros!(sparse(Itot, Jtot, Vtot, KfM, KfM))  # dropzeros!() are in case some scale[nw] is zero
end