text:
using Rubin
using Tests
using Elliptic
using HypergeometricFunctions
using Polylogarithms
using SpecialFunctions

@test integrate(productlog(a+b*x)^4, x) == :(96x+b^-1*productlog(a+b*x)^2*(16a+16*b*x)+b^-1*productlog(a+b*x)^4*(a+b*x)+-1*b^-1*productlog(a+b*x)^-1*(96a+96*b*x)+-1*b^-1*productlog(a+b*x)^3*(4a+4*b*x)+-1*b^-1*(48a+48*b*x)*productlog(a+b*x))
@test integrate(productlog(a+b*x)^3, x) == :(-18x+b^-1*productlog(a+b*x)^-1*(18a+18*b*x)+b^-1*productlog(a+b*x)^3*(a+b*x)+b^-1*(9a+9*b*x)*productlog(a+b*x)+-1*b^-1*productlog(a+b*x)^2*(3a+3*b*x))
@test integrate(productlog(a+b*x)^2, x) == :(4x+b^-1*productlog(a+b*x)^2*(a+b*x)+-1*b^-1*productlog(a+b*x)^-1*(4a+4*b*x)+-1*b^-1*(2a+2*b*x)*productlog(a+b*x))
@test integrate(productlog(a+b*x), x) == :(-1x+b^-1*productlog(a+b*x)^-1*(a+b*x)+b^-1*(a+b*x)*productlog(a+b*x))
@test integrate(productlog(a+b*x)^-1, x) == :(b^-1*expintegralei(productlog(a+b*x))+b^-1*productlog(a+b*x)^-1*(a+b*x))
@test integrate(productlog(a+b*x)^-2, x) == :(2*b^-1*expintegralei(productlog(a+b*x))+-1*b^-1*productlog(a+b*x)^-2*(a+b*x))
@test integrate(productlog(a+b*x)^-3, x) == :(3//2*b^-1*expintegralei(productlog(a+b*x))+-1//2*b^-1*productlog(a+b*x)^-3*(a+b*x)+-1//2*b^-1*productlog(a+b*x)^-2*(3a+3*b*x))
@test integrate(productlog(a+b*x)^-4, x) == :(2//3*b^-1*expintegralei(productlog(a+b*x))+-1//3*b^-1*productlog(a+b*x)^-4*(a+b*x)+-1//3*b^-1*productlog(a+b*x)^-3*(2a+2*b*x)+-1//3*b^-1*productlog(a+b*x)^-2*(2a+2*b*x))
@test integrate(productlog(a+b*x)^-5, x) == :(5//24*b^-1*expintegralei(productlog(a+b*x))+-1//4*b^-1*productlog(a+b*x)^-5*(a+b*x)+-1//12*b^-1*productlog(a+b*x)^-4*(5a+5*b*x)+-1//24*b^-1*productlog(a+b*x)^-3*(5a+5*b*x)+-1//24*b^-1*productlog(a+b*x)^-2*(5a+5*b*x))
@test integrate((c*productlog(a+b*x))^5//2, x) == :(b^-1*(c*productlog(a+b*x))^5//2*(a+b*x)+-75//8*b^-1*c^3*(c*productlog(a+b*x))^-1//2*(a+b*x)+-5//2*c*b^-1*(c*productlog(a+b*x))^3//2*(a+b*x)+25//4*b^-1*c^2*(c*productlog(a+b*x))^(1/2)*(a+b*x)+75//16*pi^(1/2)*b^-1*c^5//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^3//2, x) == :(b^-1*(c*productlog(a+b*x))^3//2*(a+b*x)+-9//8*pi^(1/2)*b^-1*c^3//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2))+-3//2*c*b^-1*(c*productlog(a+b*x))^(1/2)*(a+b*x)+9//4*b^-1*c^2*(c*productlog(a+b*x))^-1//2*(a+b*x))
@test integrate((c*productlog(a+b*x))^(1/2), x) == :(b^-1*(c*productlog(a+b*x))^(1/2)*(a+b*x)+-1//2*c*b^-1*(c*productlog(a+b*x))^-1//2*(a+b*x)+1//4*pi^(1/2)*b^-1*c^(1/2)*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^-1//2, x) == :(b^-1*(c*productlog(a+b*x))^-1//2*(a+b*x)+(1/2)*pi^(1/2)*b^-1*c^-1//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^-3//2, x) == :(-1*b^-1*(c*productlog(a+b*x))^-3//2*(2a+2*b*x)+3*pi^(1/2)*b^-1*c^-3//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^-5//2, x) == :(-1//3*b^-1*(c*productlog(a+b*x))^-5//2*(2a+2*b*x)+-1//3*b^-1*c^-1*(c*productlog(a+b*x))^-3//2*(10a+10*b*x)+10//3*pi^(1/2)*b^-1*c^-5//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^-7//2, x) == :(-1//5*b^-1*(c*productlog(a+b*x))^-7//2*(2a+2*b*x)+-1//15*b^-1*c^-1*(c*productlog(a+b*x))^-5//2*(14a+14*b*x)+-1//15*b^-1*c^-2*(c*productlog(a+b*x))^-3//2*(28a+28*b*x)+28//15*pi^(1/2)*b^-1*c^-7//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^5//2, x) == :(b^-1*(-1*c*productlog(a+b*x))^5//2*(a+b*x)+5//2*c*b^-1*(-1*c*productlog(a+b*x))^3//2*(a+b*x)+25//4*b^-1*c^2*(-1*c*productlog(a+b*x))^(1/2)*(a+b*x)+75//8*b^-1*c^3*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+75//16*pi^(1/2)*b^-1*c^5//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^3//2, x) == :(b^-1*(-1*c*productlog(a+b*x))^3//2*(a+b*x)+3//2*c*b^-1*(-1*c*productlog(a+b*x))^(1/2)*(a+b*x)+9//4*b^-1*c^2*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+9//8*pi^(1/2)*b^-1*c^3//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^(1/2), x) == :(b^-1*(-1*c*productlog(a+b*x))^(1/2)*(a+b*x)+(1/2)*c*b^-1*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+1//4*pi^(1/2)*b^-1*c^(1/2)*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^-1//2, x) == :(b^-1*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+-1//2*pi^(1/2)*b^-1*c^-1//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^-3//2, x) == :(-1*b^-1*(-1*c*productlog(a+b*x))^-3//2*(2a+2*b*x)+3*pi^(1/2)*b^-1*c^-3//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^-5//2, x) == :(-1//3*b^-1*(-1*c*productlog(a+b*x))^-5//2*(2a+2*b*x)+-10//3*pi^(1/2)*b^-1*c^-5//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+1//3*b^-1*c^-1*(-1*c*productlog(a+b*x))^-3//2*(10a+10*b*x))
@test integrate((-1*c*productlog(a+b*x))^-7//2, x) == :(-1//5*b^-1*(-1*c*productlog(a+b*x))^-7//2*(2a+2*b*x)+-1//15*b^-1*c^-2*(-1*c*productlog(a+b*x))^-3//2*(28a+28*b*x)+1//15*b^-1*c^-1*(-1*c*productlog(a+b*x))^-5//2*(14a+14*b*x)+28//15*pi^(1/2)*b^-1*c^-7//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^n, x) == :(b^-1*(c*productlog(a+b*x))^n*(a+b*x)+-1*n*b^-1*(-1*productlog(a+b*x))^(-1n)*(c*productlog(a+b*x))^n*SpecialFunctions.gamma(1+n,-1*productlog(a+b*x)))
@test integrate(x^3*productlog(a+b*x), x) == :(-1//16*b^-4*(a+b*x)^4+x*a^3*b^-3+-3//4*a^2*b^-4*(a+b*x)^2+-3//64*b^-4*(a+b*x)^4*productlog(a+b*x)^-2+-3//512*b^-4*(a+b*x)^4*productlog(a+b*x)^-4+1//3*a*b^-4*(a+b*x)^3+1//4*b^-4*(a+b*x)^4*productlog(a+b*x)+1//16*b^-4*(a+b*x)^4*productlog(a+b*x)^-1+3//128*b^-4*(a+b*x)^4*productlog(a+b*x)^-3+-1*a*b^-4*(a+b*x)^3*productlog(a+b*x)+-1*a^3*b^-4*productlog(a+b*x)^-1*(a+b*x)+-1*a^3*b^-4*(a+b*x)*productlog(a+b*x)+-3//8*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)^-2+-2//27*a*b^-4*(a+b*x)^3*productlog(a+b*x)^-3+-1//3*a*b^-4*(a+b*x)^3*productlog(a+b*x)^-1+2//9*a*b^-4*(a+b*x)^3*productlog(a+b*x)^-2+3//2*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)+3//4*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)^-1)
@test integrate(x^2*productlog(a+b*x), x) == :(-1//9*b^-3*(a+b*x)^3+(1/2)*a*b^-3*(a+b*x)^2+-1*x*a^2*b^-2+-2//27*b^-3*(a+b*x)^3*productlog(a+b*x)^-2+1//3*b^-3*(a+b*x)^3*productlog(a+b*x)+1//9*b^-3*(a+b*x)^3*productlog(a+b*x)^-1+2//81*b^-3*(a+b*x)^3*productlog(a+b*x)^-3+a^2*b^-3*productlog(a+b*x)^-1*(a+b*x)+a^2*b^-3*(a+b*x)*productlog(a+b*x)+-1*a*b^-3*(a+b*x)^2*productlog(a+b*x)+-1//2*a*b^-3*(a+b*x)^2*productlog(a+b*x)^-1+1//4*a*b^-3*(a+b*x)^2*productlog(a+b*x)^-2)
@test integrate(x*productlog(a+b*x), x) == :(-1//4*b^-2*(a+b*x)^2+a*x*b^-1+(1/2)*b^-2*(a+b*x)^2*productlog(a+b*x)+-1//8*b^-2*(a+b*x)^2*productlog(a+b*x)^-2+1//4*b^-2*(a+b*x)^2*productlog(a+b*x)^-1+-1*a*b^-2*productlog(a+b*x)^-1*(a+b*x)+-1*a*b^-2*(a+b*x)*productlog(a+b*x))
@test integrate(productlog(a+b*x), x) == :(-1x+b^-1*productlog(a+b*x)^-1*(a+b*x)+b^-1*(a+b*x)*productlog(a+b*x))
@test integrate(x^3*productlog(a+b*x)^2, x) == :(5//32*b^-4*(a+b*x)^4+-4*x*a^3*b^-3+-15//256*b^-4*(a+b*x)^4*productlog(a+b*x)^-3+-8//9*a*b^-4*(a+b*x)^3+-5//32*b^-4*(a+b*x)^4*productlog(a+b*x)^-1+-1//8*b^-4*(a+b*x)^4*productlog(a+b*x)+1//4*b^-4*(a+b*x)^4*productlog(a+b*x)^2+9//4*a^2*b^-4*(a+b*x)^2+15//128*b^-4*(a+b*x)^4*productlog(a+b*x)^-2+15//1024*b^-4*(a+b*x)^4*productlog(a+b*x)^-4+-1*a*b^-4*(a+b*x)^3*productlog(a+b*x)^2+-1*a^3*b^-4*productlog(a+b*x)^2*(a+b*x)+2*a^3*b^-4*(a+b*x)*productlog(a+b*x)+4*a^3*b^-4*productlog(a+b*x)^-1*(a+b*x)+-16//27*a*b^-4*(a+b*x)^3*productlog(a+b*x)^-2+-9//4*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)^-1+-3//2*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)+2//3*a*b^-4*(a+b*x)^3*productlog(a+b*x)+3//2*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)^2+8//9*a*b^-4*(a+b*x)^3*productlog(a+b*x)^-1+9//8*a^2*b^-4*(a+b*x)^2*productlog(a+b*x)^-2+16//81*a*b^-4*(a+b*x)^3*productlog(a+b*x)^-3)
@test integrate(x^2*productlog(a+b*x)^2, x) == :(8//27*b^-3*(a+b*x)^3+4*x*a^2*b^-2+-16//243*b^-3*(a+b*x)^3*productlog(a+b*x)^-3+-8//27*b^-3*(a+b*x)^3*productlog(a+b*x)^-1+-3//2*a*b^-3*(a+b*x)^2+-2//9*b^-3*(a+b*x)^3*productlog(a+b*x)+1//3*b^-3*(a+b*x)^3*productlog(a+b*x)^2+16//81*b^-3*(a+b*x)^3*productlog(a+b*x)^-2+a*b^-3*(a+b*x)^2*productlog(a+b*x)+a^2*b^-3*productlog(a+b*x)^2*(a+b*x)+-1*a*b^-3*(a+b*x)^2*productlog(a+b*x)^2+-4*a^2*b^-3*productlog(a+b*x)^-1*(a+b*x)+-2*a^2*b^-3*(a+b*x)*productlog(a+b*x)+-3//4*a*b^-3*(a+b*x)^2*productlog(a+b*x)^-2+3//2*a*b^-3*(a+b*x)^2*productlog(a+b*x)^-1)
@test integrate(x*productlog(a+b*x)^2, x) == :(3//4*b^-2*(a+b*x)^2+(1/2)*b^-2*(a+b*x)^2*productlog(a+b*x)^2+-4*a*x*b^-1+-3//4*b^-2*(a+b*x)^2*productlog(a+b*x)^-1+-1//2*b^-2*(a+b*x)^2*productlog(a+b*x)+3//8*b^-2*(a+b*x)^2*productlog(a+b*x)^-2+-1*a*b^-2*productlog(a+b*x)^2*(a+b*x)+2*a*b^-2*(a+b*x)*productlog(a+b*x)+4*a*b^-2*productlog(a+b*x)^-1*(a+b*x))
@test integrate(productlog(a+b*x)^2, x) == :(4x+b^-1*productlog(a+b*x)^2*(a+b*x)+-1*b^-1*productlog(a+b*x)^-1*(4a+4*b*x)+-1*b^-1*(2a+2*b*x)*productlog(a+b*x))
@test integrate(x^3*(c*productlog(a+b*x))^-1//2, x) == :(1//4*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)^4+-1*a*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)^3+-1*a^3*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)+-15//8192*pi^(1/2)*b^-4*c^-1//2*erfi(2*c^-1//2*(c*productlog(a+b*x))^(1/2))+-5//256*b^-4*c^2*(c*productlog(a+b*x))^-5//2*(a+b*x)^4+1//32*c*b^-4*(c*productlog(a+b*x))^-3//2*(a+b*x)^4+3//2*a^2*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)^2+15//2048*b^-4*c^3*(c*productlog(a+b*x))^-7//2*(a+b*x)^4+-1//2*pi^(1/2)*a^3*b^-4*c^-1//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2))+-1//6*a*c*b^-4*(c*productlog(a+b*x))^-3//2*(a+b*x)^3+1//12*a*b^-4*c^2*(c*productlog(a+b*x))^-5//2*(a+b*x)^3+3//8*c*a^2*b^-4*(c*productlog(a+b*x))^-3//2*(a+b*x)^2+-3//32*2^(1/2)*pi^(1/2)*a^2*b^-4*c^-1//2*erfi(2^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2))+-1//72*a*3^(1/2)*pi^(1/2)*b^-4*c^-1//2*erfi(3^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate(x^2*(c*productlog(a+b*x))^-1//2, x) == :(1//3*b^-3*(c*productlog(a+b*x))^-1//2*(a+b*x)^3+a^2*b^-3*(c*productlog(a+b*x))^-1//2*(a+b*x)+-1*a*b^-3*(c*productlog(a+b*x))^-1//2*(a+b*x)^2+-1//36*b^-3*c^2*(c*productlog(a+b*x))^-5//2*(a+b*x)^3+1//18*c*b^-3*(c*productlog(a+b*x))^-3//2*(a+b*x)^3+(1/2)*pi^(1/2)*a^2*b^-3*c^-1//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2))+-1//4*a*c*b^-3*(c*productlog(a+b*x))^-3//2*(a+b*x)^2+1//216*3^(1/2)*pi^(1/2)*b^-3*c^-1//2*erfi(3^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2))+1//16*a*2^(1/2)*pi^(1/2)*b^-3*c^-1//2*erfi(2^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate(x*(c*productlog(a+b*x))^-1//2, x) == :((1/2)*b^-2*(c*productlog(a+b*x))^-1//2*(a+b*x)^2+-1*a*b^-2*(c*productlog(a+b*x))^-1//2*(a+b*x)+1//8*c*b^-2*(c*productlog(a+b*x))^-3//2*(a+b*x)^2+-1//2*a*pi^(1/2)*b^-2*c^-1//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2))+-1//32*2^(1/2)*pi^(1/2)*b^-2*c^-1//2*erfi(2^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^-1//2, x) == :(b^-1*(c*productlog(a+b*x))^-1//2*(a+b*x)+(1/2)*pi^(1/2)*b^-1*c^-1//2*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate(x^3*(-1*c*productlog(a+b*x))^-1//2, x) == :(1//4*b^-4*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)^4+-1*a*b^-4*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)^3+-1*a^3*b^-4*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+-15//2048*b^-4*c^3*(-1*c*productlog(a+b*x))^-7//2*(a+b*x)^4+-5//256*b^-4*c^2*(-1*c*productlog(a+b*x))^-5//2*(a+b*x)^4+-1//32*c*b^-4*(-1*c*productlog(a+b*x))^-3//2*(a+b*x)^4+3//2*a^2*b^-4*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)^2+15//8192*pi^(1/2)*b^-4*c^-1//2*erf(2*c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+(1/2)*pi^(1/2)*a^3*b^-4*c^-1//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+-3//8*c*a^2*b^-4*(-1*c*productlog(a+b*x))^-3//2*(a+b*x)^2+1//6*a*c*b^-4*(-1*c*productlog(a+b*x))^-3//2*(a+b*x)^3+1//12*a*b^-4*c^2*(-1*c*productlog(a+b*x))^-5//2*(a+b*x)^3+1//72*a*3^(1/2)*pi^(1/2)*b^-4*c^-1//2*erf(3^(1/2)*c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+3//32*2^(1/2)*pi^(1/2)*a^2*b^-4*c^-1//2*erf(2^(1/2)*c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate(x^2*(-1*c*productlog(a+b*x))^-1//2, x) == :(1//3*b^-3*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)^3+a^2*b^-3*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+-1*a*b^-3*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)^2+-1//18*c*b^-3*(-1*c*productlog(a+b*x))^-3//2*(a+b*x)^3+-1//36*b^-3*c^2*(-1*c*productlog(a+b*x))^-5//2*(a+b*x)^3+-1//2*pi^(1/2)*a^2*b^-3*c^-1//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+-1//216*3^(1/2)*pi^(1/2)*b^-3*c^-1//2*erf(3^(1/2)*c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+1//4*a*c*b^-3*(-1*c*productlog(a+b*x))^-3//2*(a+b*x)^2+-1//16*a*2^(1/2)*pi^(1/2)*b^-3*c^-1//2*erf(2^(1/2)*c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate(x*(-1*c*productlog(a+b*x))^-1//2, x) == :((1/2)*b^-2*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)^2+-1*a*b^-2*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+-1//8*c*b^-2*(-1*c*productlog(a+b*x))^-3//2*(a+b*x)^2+(1/2)*a*pi^(1/2)*b^-2*c^-1//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2))+1//32*2^(1/2)*pi^(1/2)*b^-2*c^-1//2*erf(2^(1/2)*c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate((-1*c*productlog(a+b*x))^-1//2, x) == :(b^-1*(-1*c*productlog(a+b*x))^-1//2*(a+b*x)+-1//2*pi^(1/2)*b^-1*c^-1//2*erf(c^-1//2*(-1*c*productlog(a+b*x))^(1/2)))
@test integrate(x^3*(c*productlog(a+b*x))^(1/2), x) == :(1//4*b^-4*(c*productlog(a+b*x))^(1/2)*(a+b*x)^4+-1*a*b^-4*(c*productlog(a+b*x))^(1/2)*(a+b*x)^3+-1*a^3*b^-4*(c*productlog(a+b*x))^(1/2)*(a+b*x)+-105//65536*pi^(1/2)*b^-4*c^(1/2)*erfi(2*c^-1//2*(c*productlog(a+b*x))^(1/2))+-35//2048*b^-4*c^3*(c*productlog(a+b*x))^-5//2*(a+b*x)^4+-1//32*c*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)^4+3//2*a^2*b^-4*(c*productlog(a+b*x))^(1/2)*(a+b*x)^2+7//256*b^-4*c^2*(c*productlog(a+b*x))^-3//2*(a+b*x)^4+105//16384*b^-4*c^4*(c*productlog(a+b*x))^-7//2*(a+b*x)^4+(1/2)*c*a^3*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)+-5//36*a*b^-4*c^2*(c*productlog(a+b*x))^-3//2*(a+b*x)^3+-3//8*c*a^2*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)^2+-1//4*pi^(1/2)*a^3*b^-4*c^(1/2)*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2))+1//6*a*c*b^-4*(c*productlog(a+b*x))^-1//2*(a+b*x)^3+5//72*a*b^-4*c^3*(c*productlog(a+b*x))^-5//2*(a+b*x)^3+9//32*a^2*b^-4*c^2*(c*productlog(a+b*x))^-3//2*(a+b*x)^2+-9//128*2^(1/2)*pi^(1/2)*a^2*b^-4*c^(1/2)*erfi(2^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2))+-5//432*a*3^(1/2)*pi^(1/2)*b^-4*c^(1/2)*erfi(3^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate(x^2*(c*productlog(a+b*x))^(1/2), x) == :(1//3*b^-3*(c*productlog(a+b*x))^(1/2)*(a+b*x)^3+a^2*b^-3*(c*productlog(a+b*x))^(1/2)*(a+b*x)+-1*a*b^-3*(c*productlog(a+b*x))^(1/2)*(a+b*x)^2+-5//216*b^-3*c^3*(c*productlog(a+b*x))^-5//2*(a+b*x)^3+-1//18*c*b^-3*(c*productlog(a+b*x))^-1//2*(a+b*x)^3+5//108*b^-3*c^2*(c*productlog(a+b*x))^-3//2*(a+b*x)^3+-3//16*a*b^-3*c^2*(c*productlog(a+b*x))^-3//2*(a+b*x)^2+-1//2*c*a^2*b^-3*(c*productlog(a+b*x))^-1//2*(a+b*x)+1//4*a*c*b^-3*(c*productlog(a+b*x))^-1//2*(a+b*x)^2+1//4*pi^(1/2)*a^2*b^-3*c^(1/2)*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2))+5//1296*3^(1/2)*pi^(1/2)*b^-3*c^(1/2)*erfi(3^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2))+3//64*a*2^(1/2)*pi^(1/2)*b^-3*c^(1/2)*erfi(2^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate(x*(c*productlog(a+b*x))^(1/2), x) == :((1/2)*b^-2*(c*productlog(a+b*x))^(1/2)*(a+b*x)^2+-1*a*b^-2*(c*productlog(a+b*x))^(1/2)*(a+b*x)+-1//8*c*b^-2*(c*productlog(a+b*x))^-1//2*(a+b*x)^2+3//32*b^-2*c^2*(c*productlog(a+b*x))^-3//2*(a+b*x)^2+(1/2)*a*c*b^-2*(c*productlog(a+b*x))^-1//2*(a+b*x)+-3//128*2^(1/2)*pi^(1/2)*b^-2*c^(1/2)*erfi(2^(1/2)*c^-1//2*(c*productlog(a+b*x))^(1/2))+-1//4*a*pi^(1/2)*b^-2*c^(1/2)*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate((c*productlog(a+b*x))^(1/2), x) == :(b^-1*(c*productlog(a+b*x))^(1/2)*(a+b*x)+-1//2*c*b^-1*(c*productlog(a+b*x))^-1//2*(a+b*x)+1//4*pi^(1/2)*b^-1*c^(1/2)*erfi(c^-1//2*(c*productlog(a+b*x))^(1/2)))
@test integrate(x^3*(d+d*productlog(a+b*x))^-1, x) == :(-3//16*b^-4*d^-1*(a+b*x)^4*productlog(a+b*x)^-2+-3//128*b^-4*d^-1*(a+b*x)^4*productlog(a+b*x)^-4+1//4*b^-4*d^-1*(a+b*x)^4*productlog(a+b*x)^-1+3//32*b^-4*d^-1*(a+b*x)^4*productlog(a+b*x)^-3+-1*a*b^-4*d^-1*(a+b*x)^3*productlog(a+b*x)^-1+-1*a^3*b^-4*d^-1*productlog(a+b*x)^-1*(a+b*x)+-3//4*a^2*b^-4*d^-1*(a+b*x)^2*productlog(a+b*x)^-2+-2//9*a*b^-4*d^-1*(a+b*x)^3*productlog(a+b*x)^-3+2//3*a*b^-4*d^-1*(a+b*x)^3*productlog(a+b*x)^-2+3//2*a^2*b^-4*d^-1*(a+b*x)^2*productlog(a+b*x)^-1)
@test integrate(x^2*(d+d*productlog(a+b*x))^-1, x) == :(-2//9*b^-3*d^-1*(a+b*x)^3*productlog(a+b*x)^-2+1//3*b^-3*d^-1*(a+b*x)^3*productlog(a+b*x)^-1+2//27*b^-3*d^-1*(a+b*x)^3*productlog(a+b*x)^-3+a^2*b^-3*d^-1*productlog(a+b*x)^-1*(a+b*x)+(1/2)*a*b^-3*d^-1*(a+b*x)^2*productlog(a+b*x)^-2+-1*a*b^-3*d^-1*(a+b*x)^2*productlog(a+b*x)^-1)
@test integrate(x*(d+d*productlog(a+b*x))^-1, x) == :((1/2)*b^-2*d^-1*(a+b*x)^2*productlog(a+b*x)^-1+-1//4*b^-2*d^-1*(a+b*x)^2*productlog(a+b*x)^-2+-1*a*b^-2*d^-1*productlog(a+b*x)^-1*(a+b*x))
@test integrate((d+d*productlog(a+b*x))^-1, x) == :(b^-1*d^-1*productlog(a+b*x)^-1*(a+b*x))
@test integrate(x^3*productlog(a*x), x) == :(-1//16*x^4+-3//64*x^4*productlog(a*x)^-2+-3//512*x^4*productlog(a*x)^-4+1//4*x^4*productlog(a*x)+1//16*x^4*productlog(a*x)^-1+3//128*x^4*productlog(a*x)^-3)
@test integrate(x^2*productlog(a*x), x) == :(-1//9*x^3+-2//27*x^3*productlog(a*x)^-2+1//3*x^3*productlog(a*x)+1//9*x^3*productlog(a*x)^-1+2//81*x^3*productlog(a*x)^-3)
@test integrate(x*productlog(a*x), x) == :(-1//4*x^2+(1/2)*x^2*productlog(a*x)+-1//8*x^2*productlog(a*x)^-2+1//4*x^2*productlog(a*x)^-1)
@test integrate(productlog(a*x), x) == :(-1x+x*productlog(a*x)^-1+x*productlog(a*x))
@test integrate(x^-1*productlog(a*x), x) == :((1/2)*productlog(a*x)^2+productlog(a*x))
@test integrate(x^-2*productlog(a*x), x) == :(a*expintegralei(-1*productlog(a*x))+-1*x^-1*productlog(a*x))
@test integrate(x^-3*productlog(a*x), x) == :(-1*a^2*expintegralei(-2*productlog(a*x))+-1*x^-2*productlog(a*x))
@test integrate(x^-4*productlog(a*x), x) == :((1/2)*x^-3*productlog(a*x)^2+-1//2*x^-3*productlog(a*x)+3//2*a^3*expintegralei(-3*productlog(a*x)))
@test integrate(x^-5*productlog(a*x), x) == :(-8//3*a^4*expintegralei(-4*productlog(a*x))+-2//3*x^-4*productlog(a*x)^3+-1//3*x^-4*productlog(a*x)+1//6*x^-4*productlog(a*x)^2)
@test integrate(x^-6*productlog(a*x), x) == :(-5//24*x^-5*productlog(a*x)^3+-1//4*x^-5*productlog(a*x)+1//12*x^-5*productlog(a*x)^2+25//24*x^-5*productlog(a*x)^4+125//24*a^5*expintegralei(-5*productlog(a*x)))
@test integrate(x^2*productlog(a*x)^2, x) == :(8//27*x^3+-16//243*x^3*productlog(a*x)^-3+-8//27*x^3*productlog(a*x)^-1+-2//9*x^3*productlog(a*x)+1//3*x^3*productlog(a*x)^2+16//81*x^3*productlog(a*x)^-2)
@test integrate(x*productlog(a*x)^2, x) == :(3//4*x^2+(1/2)*x^2*productlog(a*x)^2+-3//4*x^2*productlog(a*x)^-1+-1//2*x^2*productlog(a*x)+3//8*x^2*productlog(a*x)^-2)
@test integrate(productlog(a*x)^2, x) == :(4x+x*productlog(a*x)^2+-4*x*productlog(a*x)^-1+-2*x*productlog(a*x))
@test integrate(x^-1*productlog(a*x)^2, x) == :((1/2)*productlog(a*x)^2+1//3*productlog(a*x)^3)
@test integrate(x^-2*productlog(a*x)^2, x) == :(-1*x^-1*productlog(a*x)^2+-2*x^-1*productlog(a*x))
@test integrate(x^-3*productlog(a*x)^2, x) == :(a^2*expintegralei(-2*productlog(a*x))+-1//2*x^-2*productlog(a*x)^2)
@test integrate(x^-4*productlog(a*x)^2, x) == :(-1*x^-3*productlog(a*x)^2+-2*a^3*expintegralei(-3*productlog(a*x)))
@test integrate(x^-5*productlog(a*x)^2, x) == :(x^-4*productlog(a*x)^3+4*a^4*expintegralei(-4*productlog(a*x))+-1//2*x^-4*productlog(a*x)^2)
@test integrate(x^-6*productlog(a*x)^2, x) == :(-25//3*a^5*expintegralei(-5*productlog(a*x))+-5//3*x^-5*productlog(a*x)^4+-1//3*x^-5*productlog(a*x)^2+1//3*x^-5*productlog(a*x)^3)
@test integrate(x^-7*productlog(a*x)^2, x) == :(3*x^-6*productlog(a*x)^5+18*a^6*expintegralei(-6*productlog(a*x))+-1//2*x^-6*productlog(a*x)^4+-1//4*x^-6*productlog(a*x)^2+1//6*x^-6*productlog(a*x)^3)
@test integrate(x^2*productlog(a*x)^3, x) == :(-20//27*x^3+-40//81*x^3*productlog(a*x)^-2+-1//3*x^3*productlog(a*x)^2+1//3*x^3*productlog(a*x)^3+5//9*x^3*productlog(a*x)+20//27*x^3*productlog(a*x)^-1+40//243*x^3*productlog(a*x)^-3)
@test integrate(x*productlog(a*x)^3, x) == :(-9//4*x^2+(1/2)*x^2*productlog(a*x)^3+-9//8*x^2*productlog(a*x)^-2+-3//4*x^2*productlog(a*x)^2+3//2*x^2*productlog(a*x)+9//4*x^2*productlog(a*x)^-1)
@test integrate(productlog(a*x)^3, x) == :(-18x+x*productlog(a*x)^3+-3*x*productlog(a*x)^2+9*x*productlog(a*x)+18*x*productlog(a*x)^-1)
@test integrate(x^-1*productlog(a*x)^3, x) == :(1//3*productlog(a*x)^3+1//4*productlog(a*x)^4)
@test integrate(x^-2*productlog(a*x)^3, x) == :(-1*x^-1*productlog(a*x)^3+-3*x^-1*productlog(a*x)^2+-3*x^-1*productlog(a*x))
@test integrate(x^-3*productlog(a*x)^3, x) == :(-3//4*x^-2*productlog(a*x)^2+-1//2*x^-2*productlog(a*x)^3)
@test integrate(x^-4*productlog(a*x)^3, x) == :(a^3*expintegralei(-3*productlog(a*x))+-1//3*x^-3*productlog(a*x)^3)
@test integrate(x^-5*productlog(a*x)^3, x) == :(-1*x^-4*productlog(a*x)^3+-3*a^4*expintegralei(-4*productlog(a*x)))
@test integrate(x^-6*productlog(a*x)^3, x) == :(-1//2*x^-5*productlog(a*x)^3+3//2*x^-5*productlog(a*x)^4+15//2*a^5*expintegralei(-5*productlog(a*x)))
@test integrate(x^-7*productlog(a*x)^3, x) == :((1/2)*x^-6*productlog(a*x)^4+-18*a^6*expintegralei(-6*productlog(a*x))+-3*x^-6*productlog(a*x)^5+-1//3*x^-6*productlog(a*x)^3)
@test integrate(x^-8*productlog(a*x)^3, x) == :(-7//8*x^-7*productlog(a*x)^5+-1//4*x^-7*productlog(a*x)^3+1//4*x^-7*productlog(a*x)^4+49//8*x^-7*productlog(a*x)^6+343//8*a^7*expintegralei(-7*productlog(a*x)))
@test integrate(x^4*productlog(a*x)^-1, x) == :(-6//3125*x^5*productlog(a*x)^-5+-3//125*x^5*productlog(a*x)^-3+1//5*x^5*productlog(a*x)^-1+1//25*x^5*productlog(a*x)^-2+6//625*x^5*productlog(a*x)^-4)
@test integrate(x^3*productlog(a*x)^-1, x) == :(-1//32*x^4*productlog(a*x)^-3+1//4*x^4*productlog(a*x)^-1+1//16*x^4*productlog(a*x)^-2+1//128*x^4*productlog(a*x)^-4)
@test integrate(x^2*productlog(a*x)^-1, x) == :(-1//27*x^3*productlog(a*x)^-3+1//3*x^3*productlog(a*x)^-1+1//9*x^3*productlog(a*x)^-2)
@test integrate(x*productlog(a*x)^-1, x) == :((1/2)*x^2*productlog(a*x)^-1+1//4*x^2*productlog(a*x)^-2)
@test integrate(productlog(a*x)^-1, x) == :(x*productlog(a*x)^-1+a^-1*expintegralei(productlog(a*x)))
@test integrate(x^-1*productlog(a*x)^-1, x) == :(-1*productlog(a*x)^-1+log(productlog(a*x)))
@test integrate(x^-2*productlog(a*x)^-1, x) == :(-1//2*x^-1+-1//2*a*expintegralei(-1*productlog(a*x))+-1//2*x^-1*productlog(a*x)^-1)
@test integrate(x^-3*productlog(a*x)^-1, x) == :(-1//6*x^-2+-1//3*x^-2*productlog(a*x)^-1+1//3*x^-2*productlog(a*x)+2//3*a^2*expintegralei(-2*productlog(a*x)))
@test integrate(x^-4*productlog(a*x)^-1, x) == :(-1//12*x^-3+-9//8*a^3*expintegralei(-3*productlog(a*x))+-3//8*x^-3*productlog(a*x)^2+-1//4*x^-3*productlog(a*x)^-1+1//8*x^-3*productlog(a*x))
@test integrate(x^5*productlog(a*x)^-2, x) == :(-1//36*x^6*productlog(a*x)^-4+-1//648*x^6*productlog(a*x)^-6+1//6*x^6*productlog(a*x)^-2+1//18*x^6*productlog(a*x)^-3+1//108*x^6*productlog(a*x)^-5)
@test integrate(x^4*productlog(a*x)^-2, x) == :(-4//125*x^5*productlog(a*x)^-4+1//5*x^5*productlog(a*x)^-2+2//25*x^5*productlog(a*x)^-3+4//625*x^5*productlog(a*x)^-5)
@test integrate(x^3*productlog(a*x)^-2, x) == :(-1//32*x^4*productlog(a*x)^-4+1//4*x^4*productlog(a*x)^-2+1//8*x^4*productlog(a*x)^-3)
@test integrate(x^2*productlog(a*x)^-2, x) == :(1//3*x^3*productlog(a*x)^-2+2//9*x^3*productlog(a*x)^-3)
@test integrate(x*productlog(a*x)^-2, x) == :(a^-2*expintegralei(2*productlog(a*x))+(1/2)*x^2*productlog(a*x)^-2)
@test integrate(productlog(a*x)^-2, x) == :(-1*x*productlog(a*x)^-2+2*a^-1*expintegralei(productlog(a*x)))
@test integrate(x^-1*productlog(a*x)^-2, x) == :(-1*productlog(a*x)^-1+-1//2*productlog(a*x)^-2)
@test integrate(x^-2*productlog(a*x)^-2, x) == :(1//3*x^-1+-1//3*x^-1*productlog(a*x)^-1+-1//3*x^-1*productlog(a*x)^-2+1//3*a*expintegralei(-1*productlog(a*x)))
@test integrate(x^-3*productlog(a*x)^-2, x) == :(1//6*x^-2+-2//3*a^2*expintegralei(-2*productlog(a*x))+-1//3*x^-2*productlog(a*x)+-1//4*x^-2*productlog(a*x)^-2+-1//6*x^-2*productlog(a*x)^-1)
@test integrate(x^6*productlog(a*x)^-3, x) == :(-18//16807*x^7*productlog(a*x)^-7+-9//343*x^7*productlog(a*x)^-5+1//7*x^7*productlog(a*x)^-3+3//49*x^7*productlog(a*x)^-4+18//2401*x^7*productlog(a*x)^-6)
@test integrate(x^5*productlog(a*x)^-3, x) == :(-1//36*x^6*productlog(a*x)^-5+1//6*x^6*productlog(a*x)^-3+1//12*x^6*productlog(a*x)^-4+1//216*x^6*productlog(a*x)^-6)
@test integrate(x^4*productlog(a*x)^-3, x) == :(-3//125*x^5*productlog(a*x)^-5+1//5*x^5*productlog(a*x)^-3+3//25*x^5*productlog(a*x)^-4)
@test integrate(x^3*productlog(a*x)^-3, x) == :(1//4*x^4*productlog(a*x)^-3+3//16*x^4*productlog(a*x)^-4)
@test integrate(x^2*productlog(a*x)^-3, x) == :(a^-3*expintegralei(3*productlog(a*x))+1//3*x^3*productlog(a*x)^-3)
@test integrate(x*productlog(a*x)^-3, x) == :(-1*x^2*productlog(a*x)^-3+3*a^-2*expintegralei(2*productlog(a*x)))
@test integrate(productlog(a*x)^-3, x) == :(-3//2*x*productlog(a*x)^-2+-1//2*x*productlog(a*x)^-3+3//2*a^-1*expintegralei(productlog(a*x)))
@test integrate(x^-1*productlog(a*x)^-3, x) == :(-1//2*productlog(a*x)^-2+-1//3*productlog(a*x)^-3)
@test integrate(x^-2*productlog(a*x)^-3, x) == :(-1//8*x^-1+-1//4*x^-1*productlog(a*x)^-3+-1//4*x^-1*productlog(a*x)^-2+-1//8*a*expintegralei(-1*productlog(a*x))+1//8*x^-1*productlog(a*x)^-1)
@test integrate(x^-3*productlog(a*x)^-3, x) == :(-1//10*x^-2+-3//20*x^-2*productlog(a*x)^-2+-1//5*x^-2*productlog(a*x)^-3+1//5*x^-2*productlog(a*x)+1//10*x^-2*productlog(a*x)^-1+2//5*a^2*expintegralei(-2*productlog(a*x)))
@test integrate(x^3*(c*productlog(a*x))^(1/2), x) == :(1//4*x^4*(c*productlog(a*x))^(1/2)+-35//2048*c^3*x^4*(c*productlog(a*x))^-5//2+-1//32*c*x^4*(c*productlog(a*x))^-1//2+7//256*c^2*x^4*(c*productlog(a*x))^-3//2+105//16384*c^4*x^4*(c*productlog(a*x))^-7//2+-105//65536*pi^(1/2)*a^-4*c^(1/2)*erfi(2*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^2*(c*productlog(a*x))^(1/2), x) == :(1//3*x^3*(c*productlog(a*x))^(1/2)+-5//216*c^3*x^3*(c*productlog(a*x))^-5//2+-1//18*c*x^3*(c*productlog(a*x))^-1//2+5//108*c^2*x^3*(c*productlog(a*x))^-3//2+5//1296*3^(1/2)*pi^(1/2)*a^-3*c^(1/2)*erfi(3^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x*(c*productlog(a*x))^(1/2), x) == :((1/2)*x^2*(c*productlog(a*x))^(1/2)+-1//8*c*x^2*(c*productlog(a*x))^-1//2+3//32*c^2*x^2*(c*productlog(a*x))^-3//2+-3//128*2^(1/2)*pi^(1/2)*a^-2*c^(1/2)*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate((c*productlog(a*x))^(1/2), x) == :(x*(c*productlog(a*x))^(1/2)+-1//2*c*x*(c*productlog(a*x))^-1//2+1//4*pi^(1/2)*a^-1*c^(1/2)*erfi(c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-1*(c*productlog(a*x))^(1/2), x) == :(2*(c*productlog(a*x))^(1/2)+2//3*c^-1*(c*productlog(a*x))^3//2)
@test integrate(x^-2*(c*productlog(a*x))^(1/2), x) == :(-2*x^-1*(c*productlog(a*x))^(1/2)+-1*a*pi^(1/2)*c^(1/2)*erf(c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-3*(c*productlog(a*x))^(1/2), x) == :(-2//3*x^-2*(c*productlog(a*x))^(1/2)+2//3*c^-1*x^-2*(c*productlog(a*x))^3//2+2//3*2^(1/2)*pi^(1/2)*a^2*c^(1/2)*erf(2^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-4*(c*productlog(a*x))^(1/2), x) == :(-2//5*x^-3*(c*productlog(a*x))^(1/2)+-4//5*c^-2*x^-3*(c*productlog(a*x))^5//2+2//15*c^-1*x^-3*(c*productlog(a*x))^3//2+-4//5*3^(1/2)*pi^(1/2)*a^3*c^(1/2)*erf(3^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-5*(c*productlog(a*x))^(1/2), x) == :(-2//7*x^-4*(c*productlog(a*x))^(1/2)+-16//105*c^-2*x^-4*(c*productlog(a*x))^5//2+2//35*c^-1*x^-4*(c*productlog(a*x))^3//2+128//105*c^-3*x^-4*(c*productlog(a*x))^7//2+256//105*pi^(1/2)*a^4*c^(1/2)*erf(2*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-6*(c*productlog(a*x))^(1/2), x) == :(-2//9*x^-5*(c*productlog(a*x))^(1/2)+-400//189*c^-4*x^-5*(c*productlog(a*x))^9//2+-4//63*c^-2*x^-5*(c*productlog(a*x))^5//2+2//63*c^-1*x^-5*(c*productlog(a*x))^3//2+40//189*c^-3*x^-5*(c*productlog(a*x))^7//2+-400//189*5^(1/2)*pi^(1/2)*a^5*c^(1/2)*erf(5^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^4*(c*productlog(a*x))^-1//2, x) == :(1//5*x^5*(c*productlog(a*x))^-1//2+-21//10000*c^4*x^5*(c*productlog(a*x))^-9//2+-7//500*c^2*x^5*(c*productlog(a*x))^-5//2+1//50*c*x^5*(c*productlog(a*x))^-3//2+7//1000*c^3*x^5*(c*productlog(a*x))^-7//2+21//100000*5^(1/2)*pi^(1/2)*a^-5*c^-1//2*erfi(5^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^3*(c*productlog(a*x))^-1//2, x) == :(1//4*x^4*(c*productlog(a*x))^-1//2+-5//256*c^2*x^4*(c*productlog(a*x))^-5//2+1//32*c*x^4*(c*productlog(a*x))^-3//2+15//2048*c^3*x^4*(c*productlog(a*x))^-7//2+-15//8192*pi^(1/2)*a^-4*c^-1//2*erfi(2*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^2*(c*productlog(a*x))^-1//2, x) == :(1//3*x^3*(c*productlog(a*x))^-1//2+-1//36*c^2*x^3*(c*productlog(a*x))^-5//2+1//18*c*x^3*(c*productlog(a*x))^-3//2+1//216*3^(1/2)*pi^(1/2)*a^-3*c^-1//2*erfi(3^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x*(c*productlog(a*x))^-1//2, x) == :((1/2)*x^2*(c*productlog(a*x))^-1//2+1//8*c*x^2*(c*productlog(a*x))^-3//2+-1//32*2^(1/2)*pi^(1/2)*a^-2*c^-1//2*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate((c*productlog(a*x))^-1//2, x) == :(x*(c*productlog(a*x))^-1//2+(1/2)*pi^(1/2)*a^-1*c^-1//2*erfi(c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-1*(c*productlog(a*x))^-1//2, x) == :(-2*(c*productlog(a*x))^-1//2+2*c^-1*(c*productlog(a*x))^(1/2))
@test integrate(x^-2*(c*productlog(a*x))^-1//2, x) == :(-2//3*x^-1*(c*productlog(a*x))^-1//2+-2//3*c^-1*x^-1*(c*productlog(a*x))^(1/2)+-2//3*a*pi^(1/2)*c^-1//2*erf(c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-3*(c*productlog(a*x))^-1//2, x) == :(-2//5*x^-2*(c*productlog(a*x))^-1//2+-2//15*c^-1*x^-2*(c*productlog(a*x))^(1/2)+8//15*c^-2*x^-2*(c*productlog(a*x))^3//2+8//15*2^(1/2)*pi^(1/2)*a^2*c^-1//2*erf(2^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-4*(c*productlog(a*x))^-1//2, x) == :(-2//7*x^-3*(c*productlog(a*x))^-1//2+-24//35*c^-3*x^-3*(c*productlog(a*x))^5//2+-2//35*c^-1*x^-3*(c*productlog(a*x))^(1/2)+4//35*c^-2*x^-3*(c*productlog(a*x))^3//2+-24//35*3^(1/2)*pi^(1/2)*a^3*c^-1//2*erf(3^(1/2)*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^-5*(c*productlog(a*x))^-1//2, x) == :(-2//9*x^-4*(c*productlog(a*x))^-1//2+-128//945*c^-3*x^-4*(c*productlog(a*x))^5//2+-2//63*c^-1*x^-4*(c*productlog(a*x))^(1/2)+16//315*c^-2*x^-4*(c*productlog(a*x))^3//2+1024//945*c^-4*x^-4*(c*productlog(a*x))^7//2+2048//945*pi^(1/2)*a^4*c^-1//2*erf(2*c^-1//2*(c*productlog(a*x))^(1/2)))
@test integrate(x^2*(c*productlog(a*x))^p, x) == :(3^(-3+-1p)*a^-1*x^2*(-1*productlog(a*x))^(-2+-1p)*(c*productlog(a*x))^p*SpecialFunctions.gamma(3+p,-3*productlog(a*x))*exp(-2*productlog(a*x))+3^(-4+-1p)*a^-1*c^-1*x^2*(-1*productlog(a*x))^(-3+-1p)*(c*productlog(a*x))^(1+p)*SpecialFunctions.gamma(4+p,-3*productlog(a*x))*exp(-2*productlog(a*x)))
@test integrate(x*(c*productlog(a*x))^p, x) == :(x*2^(-2+-1p)*a^-1*(-1*productlog(a*x))^(-1+-1p)*(c*productlog(a*x))^p*SpecialFunctions.gamma(2+p,-2*productlog(a*x))*exp(-1*productlog(a*x))+x*2^(-3+-1p)*a^-1*c^-1*(-1*productlog(a*x))^(-2+-1p)*(c*productlog(a*x))^(1+p)*SpecialFunctions.gamma(3+p,-2*productlog(a*x))*exp(-1*productlog(a*x)))
@test integrate(x^-1*(c*productlog(a*x))^p, x) == :(p^-1*(c*productlog(a*x))^p+c^-1*(c*productlog(a*x))^(1+p)*(1+p)^-1)
@test integrate(x^-2*(c*productlog(a*x))^p, x) == :(-1*a^-1*x^-2*(c*productlog(a*x))^p*productlog(a*x)^(2+-1p)*SpecialFunctions.gamma(-1+p,productlog(a*x))*exp(2*productlog(a*x))+-1*a^-1*c^-1*x^-2*(c*productlog(a*x))^(1+p)*productlog(a*x)^(1+-1p)*SpecialFunctions.gamma(p,productlog(a*x))*exp(2*productlog(a*x)))
@test integrate(x^-3*(c*productlog(a*x))^p, x) == :(-1*2^(2+-1p)*a^-1*x^-3*(c*productlog(a*x))^p*productlog(a*x)^(3+-1p)*SpecialFunctions.gamma(-2+p,2*productlog(a*x))*exp(3*productlog(a*x))+-1*2^(1+-1p)*a^-1*c^-1*x^-3*(c*productlog(a*x))^(1+p)*productlog(a*x)^(2+-1p)*SpecialFunctions.gamma(-1+p,2*productlog(a*x))*exp(3*productlog(a*x)))
@test integrate(x^m*productlog(a*x), x) == :(a^-1*x^m*((-1+-1m)*productlog(a*x))^(-1+-1m)*(1+m)^-1*SpecialFunctions.gamma(2+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))*productlog(a*x)+a^-1*x^m*((-1+-1m)*productlog(a*x))^(-2+-1m)*(1+m)^-1*productlog(a*x)^2*SpecialFunctions.gamma(3+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^m*productlog(a*x)^2, x) == :(a^-1*x^m*((-1+-1m)*productlog(a*x))^(-3+-1m)*(1+m)^-1*productlog(a*x)^3*SpecialFunctions.gamma(4+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))+a^-1*x^m*((-1+-1m)*productlog(a*x))^(-2+-1m)*(1+m)^-1*productlog(a*x)^2*SpecialFunctions.gamma(3+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^m*productlog(a*x)^-1, x) == :(a^-1*x^m*((-1+-1m)*productlog(a*x))^(-1m)*(1+m)^-1*SpecialFunctions.gamma(1+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))+a^-1*x^m*((-1+-1m)*productlog(a*x))^(1+-1m)*(1+m)^-1*productlog(a*x)^-1*SpecialFunctions.gamma(m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^m*productlog(a*x)^-2, x) == :(a^-1*x^m*((-1+-1m)*productlog(a*x))^(1+-1m)*(1+m)^-1*productlog(a*x)^-1*SpecialFunctions.gamma(m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))+a^-1*x^m*((-1+-1m)*productlog(a*x))^(2+-1m)*(1+m)^-1*productlog(a*x)^-2*SpecialFunctions.gamma(-1+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^m*(c*productlog(a*x))^(1/2), x) == :(a^-1*x^m*(c*productlog(a*x))^(1/2)*((-1+-1m)*productlog(a*x))^(-1//2+-1m)*(1+m)^-1*SpecialFunctions.gamma(3//2+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))+a^-1*c^-1*x^m*(c*productlog(a*x))^3//2*((-1+-1m)*productlog(a*x))^(-3//2+-1m)*(1+m)^-1*SpecialFunctions.gamma(5//2+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^m*(c*productlog(a*x))^-1//2, x) == :(a^-1*x^m*(c*productlog(a*x))^-1//2*((-1+-1m)*productlog(a*x))^(1/2+-1m)*(1+m)^-1*SpecialFunctions.gamma(1/2+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))+a^-1*c^-1*x^m*(c*productlog(a*x))^(1/2)*((-1+-1m)*productlog(a*x))^(-1//2+-1m)*(1+m)^-1*SpecialFunctions.gamma(3//2+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^m*(c*productlog(a*x))^p, x) == :(a^-1*x^m*(c*productlog(a*x))^p*((-1+-1m)*productlog(a*x))^(-1m+-1p)*(1+m)^-1*SpecialFunctions.gamma(1+m+p,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x))+a^-1*c^-1*x^m*(c*productlog(a*x))^(1+p)*((-1+-1m)*productlog(a*x))^(-1+-1m+-1p)*(1+m)^-1*SpecialFunctions.gamma(2+m+p,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate(x^3*productlog(a*x^2), x) == :(-1//8*x^4+-1//16*x^4*productlog(a*x^2)^-2+1//4*x^4*productlog(a*x^2)+1//8*x^4*productlog(a*x^2)^-1)
@test integrate(x*productlog(a*x^2), x) == :(-1//2*x^2+(1/2)*x^2*productlog(a*x^2)^-1+(1/2)*x^2*productlog(a*x^2))
@test integrate(x^-1*productlog(a*x^2), x) == :((1/2)*productlog(a*x^2)+1//4*productlog(a*x^2)^2)
@test integrate(x^-3*productlog(a*x^2), x) == :((1/2)*a*expintegralei(-1*productlog(a*x^2))+-1//2*x^-2*productlog(a*x^2))
@test integrate(x^-5*productlog(a*x^2), x) == :(-1//2*a^2*expintegralei(-2*productlog(a*x^2))+-1//2*x^-4*productlog(a*x^2))
@test integrate(x^-7*productlog(a*x^2), x) == :(-1//4*x^-6*productlog(a*x^2)+1//4*x^-6*productlog(a*x^2)^2+3//4*a^3*expintegralei(-3*productlog(a*x^2)))
@test integrate(x^3*productlog(a*x^2)^2, x) == :(3//8*x^4+-3//8*x^4*productlog(a*x^2)^-1+-1//4*x^4*productlog(a*x^2)+1//4*x^4*productlog(a*x^2)^2+3//16*x^4*productlog(a*x^2)^-2)
@test integrate(x*productlog(a*x^2)^2, x) == :(2*x^2+(1/2)*x^2*productlog(a*x^2)^2+-1*x^2*productlog(a*x^2)+-2*x^2*productlog(a*x^2)^-1)
@test integrate(x^-1*productlog(a*x^2)^2, x) == :(1//4*productlog(a*x^2)^2+1//6*productlog(a*x^2)^3)
@test integrate(x^-3*productlog(a*x^2)^2, x) == :(-1*x^-2*productlog(a*x^2)+-1//2*x^-2*productlog(a*x^2)^2)
@test integrate(x^-5*productlog(a*x^2)^2, x) == :((1/2)*a^2*expintegralei(-2*productlog(a*x^2))+-1//4*x^-4*productlog(a*x^2)^2)
@test integrate(x^-7*productlog(a*x^2)^2, x) == :(-1*a^3*expintegralei(-3*productlog(a*x^2))+-1//2*x^-6*productlog(a*x^2)^2)
@test integrate(x^-9*productlog(a*x^2)^2, x) == :((1/2)*x^-8*productlog(a*x^2)^3+2*a^4*expintegralei(-4*productlog(a*x^2))+-1//4*x^-8*productlog(a*x^2)^2)
@test integrate(x*productlog(a*x^2)^3, x) == :(-9*x^2+(1/2)*x^2*productlog(a*x^2)^3+9*x^2*productlog(a*x^2)^-1+-3//2*x^2*productlog(a*x^2)^2+9//2*x^2*productlog(a*x^2))
@test integrate(x^-1*productlog(a*x^2)^3, x) == :(1//6*productlog(a*x^2)^3+1//8*productlog(a*x^2)^4)
@test integrate(x^-3*productlog(a*x^2)^3, x) == :(-3//2*x^-2*productlog(a*x^2)^2+-3//2*x^-2*productlog(a*x^2)+-1//2*x^-2*productlog(a*x^2)^3)
@test integrate(x^-5*productlog(a*x^2)^3, x) == :(-3//8*x^-4*productlog(a*x^2)^2+-1//4*x^-4*productlog(a*x^2)^3)
@test integrate(x^-7*productlog(a*x^2)^3, x) == :((1/2)*a^3*expintegralei(-3*productlog(a*x^2))+-1//6*x^-6*productlog(a*x^2)^3)
@test integrate(x^-9*productlog(a*x^2)^3, x) == :(-3//2*a^4*expintegralei(-4*productlog(a*x^2))+-1//2*x^-8*productlog(a*x^2)^3)
@test integrate(x^5*productlog(a*x^2)^-1, x) == :(-1//54*x^6*productlog(a*x^2)^-3+1//6*x^6*productlog(a*x^2)^-1+1//18*x^6*productlog(a*x^2)^-2)
@test integrate(x^3*productlog(a*x^2)^-1, x) == :(1//4*x^4*productlog(a*x^2)^-1+1//8*x^4*productlog(a*x^2)^-2)
@test integrate(x*productlog(a*x^2)^-1, x) == :((1/2)*a^-1*expintegralei(productlog(a*x^2))+(1/2)*x^2*productlog(a*x^2)^-1)
@test integrate(x^-1*productlog(a*x^2)^-1, x) == :((1/2)*log(productlog(a*x^2))+-1//2*productlog(a*x^2)^-1)
@test integrate(x^-3*productlog(a*x^2)^-1, x) == :(-1//4*x^-2+-1//4*a*expintegralei(-1*productlog(a*x^2))+-1//4*x^-2*productlog(a*x^2)^-1)
@test integrate(x^-5*productlog(a*x^2)^-1, x) == :(-1//12*x^-4+-1//6*x^-4*productlog(a*x^2)^-1+1//3*a^2*expintegralei(-2*productlog(a*x^2))+1//6*x^-4*productlog(a*x^2))
@test integrate(x^7*productlog(a*x^2)^-2, x) == :(-1//64*x^8*productlog(a*x^2)^-4+1//8*x^8*productlog(a*x^2)^-2+1//16*x^8*productlog(a*x^2)^-3)
@test integrate(x^5*productlog(a*x^2)^-2, x) == :(1//6*x^6*productlog(a*x^2)^-2+1//9*x^6*productlog(a*x^2)^-3)
@test integrate(x^3*productlog(a*x^2)^-2, x) == :((1/2)*a^-2*expintegralei(2*productlog(a*x^2))+1//4*x^4*productlog(a*x^2)^-2)
@test integrate(x*productlog(a*x^2)^-2, x) == :(a^-1*expintegralei(productlog(a*x^2))+-1//2*x^2*productlog(a*x^2)^-2)
@test integrate(x^-1*productlog(a*x^2)^-2, x) == :(-1//2*productlog(a*x^2)^-1+-1//4*productlog(a*x^2)^-2)
@test integrate(x^-3*productlog(a*x^2)^-2, x) == :(1//6*x^-2+-1//6*x^-2*productlog(a*x^2)^-1+-1//6*x^-2*productlog(a*x^2)^-2+1//6*a*expintegralei(-1*productlog(a*x^2)))
@test integrate(x^7*(c*productlog(a*x^2))^(1/2), x) == :(1//8*x^8*(c*productlog(a*x^2))^(1/2)+-35//4096*c^3*x^8*(c*productlog(a*x^2))^-5//2+-1//64*c*x^8*(c*productlog(a*x^2))^-1//2+7//512*c^2*x^8*(c*productlog(a*x^2))^-3//2+105//32768*c^4*x^8*(c*productlog(a*x^2))^-7//2+-105//131072*pi^(1/2)*a^-4*c^(1/2)*erfi(2*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^6*(c*productlog(a*x^2))^(1/2), x) == :(1//7*x^7*(c*productlog(a*x^2))^(1/2)+-24//2401*c^3*x^7*(c*productlog(a*x^2))^-5//2+-1//49*c*x^7*(c*productlog(a*x^2))^-1//2+6//343*c^2*x^7*(c*productlog(a*x^2))^-3//2+48//16807*c^4*x^7*(c*productlog(a*x^2))^-7//2)
@test integrate(x^5*(c*productlog(a*x^2))^(1/2), x) == :(1//6*x^6*(c*productlog(a*x^2))^(1/2)+-5//432*c^3*x^6*(c*productlog(a*x^2))^-5//2+-1//36*c*x^6*(c*productlog(a*x^2))^-1//2+5//216*c^2*x^6*(c*productlog(a*x^2))^-3//2+5//2592*3^(1/2)*pi^(1/2)*a^-3*c^(1/2)*erfi(3^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^4*(c*productlog(a*x^2))^(1/2), x) == :(1//5*x^5*(c*productlog(a*x^2))^(1/2)+-8//625*c^3*x^5*(c*productlog(a*x^2))^-5//2+-1//25*c*x^5*(c*productlog(a*x^2))^-1//2+4//125*c^2*x^5*(c*productlog(a*x^2))^-3//2)
@test integrate(x^3*(c*productlog(a*x^2))^(1/2), x) == :(1//4*x^4*(c*productlog(a*x^2))^(1/2)+-1//16*c*x^4*(c*productlog(a*x^2))^-1//2+3//64*c^2*x^4*(c*productlog(a*x^2))^-3//2+-3//256*2^(1/2)*pi^(1/2)*a^-2*c^(1/2)*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^2*(c*productlog(a*x^2))^(1/2), x) == :(1//3*x^3*(c*productlog(a*x^2))^(1/2)+-1//9*c*x^3*(c*productlog(a*x^2))^-1//2+2//27*c^2*x^3*(c*productlog(a*x^2))^-3//2)
@test integrate(x*(c*productlog(a*x^2))^(1/2), x) == :((1/2)*x^2*(c*productlog(a*x^2))^(1/2)+-1//4*c*x^2*(c*productlog(a*x^2))^-1//2+1//8*pi^(1/2)*a^-1*c^(1/2)*erfi(c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate((c*productlog(a*x^2))^(1/2), x) == :(x*(c*productlog(a*x^2))^(1/2)+-1*c*x*(c*productlog(a*x^2))^-1//2)
@test integrate(x^-1*(c*productlog(a*x^2))^(1/2), x) == :((c*productlog(a*x^2))^(1/2)+1//3*c^-1*(c*productlog(a*x^2))^3//2)
@test integrate(x^-3*(c*productlog(a*x^2))^(1/2), x) == :(-1*x^-2*(c*productlog(a*x^2))^(1/2)+-1//2*a*pi^(1/2)*c^(1/2)*erf(c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^-5*(c*productlog(a*x^2))^(1/2), x) == :(-1//3*x^-4*(c*productlog(a*x^2))^(1/2)+1//3*c^-1*x^-4*(c*productlog(a*x^2))^3//2+1//3*2^(1/2)*pi^(1/2)*a^2*c^(1/2)*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^-7*(c*productlog(a*x^2))^(1/2), x) == :(-1//5*x^-6*(c*productlog(a*x^2))^(1/2)+-2//5*c^-2*x^-6*(c*productlog(a*x^2))^5//2+1//15*c^-1*x^-6*(c*productlog(a*x^2))^3//2+-2//5*3^(1/2)*pi^(1/2)*a^3*c^(1/2)*erf(3^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^7*(c*productlog(a*x^2))^-1//2, x) == :(1//8*x^8*(c*productlog(a*x^2))^-1//2+-5//512*c^2*x^8*(c*productlog(a*x^2))^-5//2+1//64*c*x^8*(c*productlog(a*x^2))^-3//2+15//4096*c^3*x^8*(c*productlog(a*x^2))^-7//2+-15//16384*pi^(1/2)*a^-4*c^-1//2*erfi(2*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^6*(c*productlog(a*x^2))^-1//2, x) == :(1//7*x^7*(c*productlog(a*x^2))^-1//2+-4//343*c^2*x^7*(c*productlog(a*x^2))^-5//2+1//49*c*x^7*(c*productlog(a*x^2))^-3//2+8//2401*c^3*x^7*(c*productlog(a*x^2))^-7//2)
@test integrate(x^5*(c*productlog(a*x^2))^-1//2, x) == :(1//6*x^6*(c*productlog(a*x^2))^-1//2+-1//72*c^2*x^6*(c*productlog(a*x^2))^-5//2+1//36*c*x^6*(c*productlog(a*x^2))^-3//2+1//432*3^(1/2)*pi^(1/2)*a^-3*c^-1//2*erfi(3^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^4*(c*productlog(a*x^2))^-1//2, x) == :(1//5*x^5*(c*productlog(a*x^2))^-1//2+-2//125*c^2*x^5*(c*productlog(a*x^2))^-5//2+1//25*c*x^5*(c*productlog(a*x^2))^-3//2)
@test integrate(x^3*(c*productlog(a*x^2))^-1//2, x) == :(1//4*x^4*(c*productlog(a*x^2))^-1//2+1//16*c*x^4*(c*productlog(a*x^2))^-3//2+-1//64*2^(1/2)*pi^(1/2)*a^-2*c^-1//2*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^2*(c*productlog(a*x^2))^-1//2, x) == :(1//3*x^3*(c*productlog(a*x^2))^-1//2+1//9*c*x^3*(c*productlog(a*x^2))^-3//2)
@test integrate(x*(c*productlog(a*x^2))^-1//2, x) == :((1/2)*x^2*(c*productlog(a*x^2))^-1//2+1//4*pi^(1/2)*a^-1*c^-1//2*erfi(c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^-1*(c*productlog(a*x^2))^-1//2, x) == :(-1*(c*productlog(a*x^2))^-1//2+c^-1*(c*productlog(a*x^2))^(1/2))
@test integrate(x^-3*(c*productlog(a*x^2))^-1//2, x) == :(-1//3*x^-2*(c*productlog(a*x^2))^-1//2+-1//3*c^-1*x^-2*(c*productlog(a*x^2))^(1/2)+-1//3*a*pi^(1/2)*c^-1//2*erf(c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^-5*(c*productlog(a*x^2))^-1//2, x) == :(-1//5*x^-4*(c*productlog(a*x^2))^-1//2+-1//15*c^-1*x^-4*(c*productlog(a*x^2))^(1/2)+4//15*c^-2*x^-4*(c*productlog(a*x^2))^3//2+4//15*2^(1/2)*pi^(1/2)*a^2*c^-1//2*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x^-7*(c*productlog(a*x^2))^-1//2, x) == :(-1//7*x^-6*(c*productlog(a*x^2))^-1//2+-12//35*c^-3*x^-6*(c*productlog(a*x^2))^5//2+-1//35*c^-1*x^-6*(c*productlog(a*x^2))^(1/2)+2//35*c^-2*x^-6*(c*productlog(a*x^2))^3//2+-12//35*3^(1/2)*pi^(1/2)*a^3*c^-1//2*erf(3^(1/2)*c^-1//2*(c*productlog(a*x^2))^(1/2)))
@test integrate(x*(c*productlog(a*x^2))^p, x) == :((1/2)*x^2*(c*productlog(a*x^2))^p+-1//2*p*a^-1*(-1*productlog(a*x^2))^(-1p)*(c*productlog(a*x^2))^p*SpecialFunctions.gamma(1+p,-1*productlog(a*x^2)))
@test integrate(x^-1*(c*productlog(a*x^2))^p, x) == :((1/2)*p^-1*(c*productlog(a*x^2))^p+(1/2)*c^-1*(c*productlog(a*x^2))^(1+p)*(1+p)^-1)
@test integrate(x^-3*(c*productlog(a*x^2))^p, x) == :(-1//2*a^-1*x^-4*(c*productlog(a*x^2))^p*productlog(a*x^2)^(2+-1p)*SpecialFunctions.gamma(p,productlog(a*x^2))*exp(2*productlog(a*x^2))+-1//2*a^-1*x^-4*(c*productlog(a*x^2))^p*productlog(a*x^2)^(2+-1p)*SpecialFunctions.gamma(-1+p,productlog(a*x^2))*exp(2*productlog(a*x^2)))
@test integrate(x^4*productlog(a*x^-1), x) == :(-125//24*a^5*expintegralei(-5*productlog(a*x^-1))+-25//24*x^5*productlog(a*x^-1)^4+-1//12*x^5*productlog(a*x^-1)^2+1//4*x^5*productlog(a*x^-1)+5//24*x^5*productlog(a*x^-1)^3)
@test integrate(x^3*productlog(a*x^-1), x) == :(-1//6*x^4*productlog(a*x^-1)^2+1//3*x^4*productlog(a*x^-1)+2//3*x^4*productlog(a*x^-1)^3+8//3*a^4*expintegralei(-4*productlog(a*x^-1)))
@test integrate(x^2*productlog(a*x^-1), x) == :((1/2)*x^3*productlog(a*x^-1)+-3//2*a^3*expintegralei(-3*productlog(a*x^-1))+-1//2*x^3*productlog(a*x^-1)^2)
@test integrate(x*productlog(a*x^-1), x) == :(a^2*expintegralei(-2*productlog(a*x^-1))+x^2*productlog(a*x^-1))
@test integrate(productlog(a*x^-1), x) == :(x*productlog(a*x^-1)+-1*a*expintegralei(-1*productlog(a*x^-1)))
@test integrate(x^-1*productlog(a*x^-1), x) == :(-1*productlog(a*x^-1)+-1//2*productlog(a*x^-1)^2)
@test integrate(x^-2*productlog(a*x^-1), x) == :(x^-1+-1*x^-1*productlog(a*x^-1)^-1+-1*x^-1*productlog(a*x^-1))
@test integrate(x^-3*productlog(a*x^-1), x) == :(1//4*x^-2+-1//2*x^-2*productlog(a*x^-1)+-1//4*x^-2*productlog(a*x^-1)^-1+1//8*x^-2*productlog(a*x^-1)^-2)
@test integrate(x^-4*productlog(a*x^-1), x) == :(1//9*x^-3+-2//81*x^-3*productlog(a*x^-1)^-3+-1//3*x^-3*productlog(a*x^-1)+-1//9*x^-3*productlog(a*x^-1)^-1+2//27*x^-3*productlog(a*x^-1)^-2)
@test integrate(x^-5*productlog(a*x^-1), x) == :(1//16*x^-4+-3//128*x^-4*productlog(a*x^-1)^-3+-1//4*x^-4*productlog(a*x^-1)+-1//16*x^-4*productlog(a*x^-1)^-1+3//64*x^-4*productlog(a*x^-1)^-2+3//512*x^-4*productlog(a*x^-1)^-4)
@test integrate(x^4*productlog(a*x^-1)^2, x) == :(-1//3*x^5*productlog(a*x^-1)^3+1//3*x^5*productlog(a*x^-1)^2+5//3*x^5*productlog(a*x^-1)^4+25//3*a^5*expintegralei(-5*productlog(a*x^-1)))
@test integrate(x^3*productlog(a*x^-1)^2, x) == :((1/2)*x^4*productlog(a*x^-1)^2+-1*x^4*productlog(a*x^-1)^3+-4*a^4*expintegralei(-4*productlog(a*x^-1)))
@test integrate(x^2*productlog(a*x^-1)^2, x) == :(x^3*productlog(a*x^-1)^2+2*a^3*expintegralei(-3*productlog(a*x^-1)))
@test integrate(x*productlog(a*x^-1)^2, x) == :((1/2)*x^2*productlog(a*x^-1)^2+-1*a^2*expintegralei(-2*productlog(a*x^-1)))
@test integrate(productlog(a*x^-1)^2, x) == :(x*productlog(a*x^-1)^2+2*x*productlog(a*x^-1))
@test integrate(x^-1*productlog(a*x^-1)^2, x) == :(-1//2*productlog(a*x^-1)^2+-1//3*productlog(a*x^-1)^3)
@test integrate(x^-2*productlog(a*x^-1)^2, x) == :(-4*x^-1+-1*x^-1*productlog(a*x^-1)^2+2*x^-1*productlog(a*x^-1)+4*x^-1*productlog(a*x^-1)^-1)
@test integrate(x^-3*productlog(a*x^-1)^2, x) == :(-3//4*x^-2+(1/2)*x^-2*productlog(a*x^-1)+-3//8*x^-2*productlog(a*x^-1)^-2+-1//2*x^-2*productlog(a*x^-1)^2+3//4*x^-2*productlog(a*x^-1)^-1)
@test integrate(x^-4*productlog(a*x^-1)^2, x) == :(-8//27*x^-3+-16//81*x^-3*productlog(a*x^-1)^-2+-1//3*x^-3*productlog(a*x^-1)^2+2//9*x^-3*productlog(a*x^-1)+8//27*x^-3*productlog(a*x^-1)^-1+16//243*x^-3*productlog(a*x^-1)^-3)
@test integrate(x^-5*productlog(a*x^-1)^2, x) == :(-5//32*x^-4+-15//128*x^-4*productlog(a*x^-1)^-2+-15//1024*x^-4*productlog(a*x^-1)^-4+-1//4*x^-4*productlog(a*x^-1)^2+1//8*x^-4*productlog(a*x^-1)+5//32*x^-4*productlog(a*x^-1)^-1+15//256*x^-4*productlog(a*x^-1)^-3)
@test integrate(x^3*productlog(a*x^-1)^(1/2), x) == :(-128//105*x^4*productlog(a*x^-1)^7//2+-2//35*x^4*productlog(a*x^-1)^3//2+2//7*x^4*productlog(a*x^-1)^(1/2)+16//105*x^4*productlog(a*x^-1)^5//2+-256//105*pi^(1/2)*a^4*erf(2*productlog(a*x^-1)^(1/2)))
@test integrate(x^2*productlog(a*x^-1)^(1/2), x) == :(-2//15*x^3*productlog(a*x^-1)^3//2+2//5*x^3*productlog(a*x^-1)^(1/2)+4//5*x^3*productlog(a*x^-1)^5//2+4//5*3^(1/2)*pi^(1/2)*a^3*erf(3^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(x*productlog(a*x^-1)^(1/2), x) == :(-2//3*x^2*productlog(a*x^-1)^3//2+2//3*x^2*productlog(a*x^-1)^(1/2)+-2//3*2^(1/2)*pi^(1/2)*a^2*erf(2^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(productlog(a*x^-1)^(1/2), x) == :(2*x*productlog(a*x^-1)^(1/2)+a*pi^(1/2)*erf(productlog(a*x^-1)^(1/2)))
@test integrate(x^-1*productlog(a*x^-1)^(1/2), x) == :(-2*productlog(a*x^-1)^(1/2)+-2//3*productlog(a*x^-1)^3//2)
@test integrate(x^-2*productlog(a*x^-1)^(1/2), x) == :((1/2)*x^-1*productlog(a*x^-1)^-1//2+-1*x^-1*productlog(a*x^-1)^(1/2)+-1//4*pi^(1/2)*a^-1*erfi(productlog(a*x^-1)^(1/2)))
@test integrate(x^-3*productlog(a*x^-1)^(1/2), x) == :(-3//32*x^-2*productlog(a*x^-1)^-3//2+-1//2*x^-2*productlog(a*x^-1)^(1/2)+1//8*x^-2*productlog(a*x^-1)^-1//2+3//128*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(x^-4*productlog(a*x^-1)^(1/2), x) == :(-5//108*x^-3*productlog(a*x^-1)^-3//2+-1//3*x^-3*productlog(a*x^-1)^(1/2)+1//18*x^-3*productlog(a*x^-1)^-1//2+5//216*x^-3*productlog(a*x^-1)^-5//2+-5//1296*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(x^3*productlog(a*x^-1)^-1//2, x) == :(-1024//945*x^4*productlog(a*x^-1)^7//2+-16//315*x^4*productlog(a*x^-1)^3//2+2//9*x^4*productlog(a*x^-1)^-1//2+2//63*x^4*productlog(a*x^-1)^(1/2)+128//945*x^4*productlog(a*x^-1)^5//2+-2048//945*pi^(1/2)*a^4*erf(2*productlog(a*x^-1)^(1/2)))
@test integrate(x^2*productlog(a*x^-1)^-1//2, x) == :(-4//35*x^3*productlog(a*x^-1)^3//2+2//7*x^3*productlog(a*x^-1)^-1//2+2//35*x^3*productlog(a*x^-1)^(1/2)+24//35*x^3*productlog(a*x^-1)^5//2+24//35*3^(1/2)*pi^(1/2)*a^3*erf(3^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(x*productlog(a*x^-1)^-1//2, x) == :(-8//15*x^2*productlog(a*x^-1)^3//2+2//5*x^2*productlog(a*x^-1)^-1//2+2//15*x^2*productlog(a*x^-1)^(1/2)+-8//15*2^(1/2)*pi^(1/2)*a^2*erf(2^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(productlog(a*x^-1)^-1//2, x) == :(2//3*x*productlog(a*x^-1)^(1/2)+2//3*x*productlog(a*x^-1)^-1//2+2//3*a*pi^(1/2)*erf(productlog(a*x^-1)^(1/2)))
@test integrate(x^-1*productlog(a*x^-1)^-1//2, x) == :(-2*productlog(a*x^-1)^(1/2)+2*productlog(a*x^-1)^-1//2)
@test integrate(x^-2*productlog(a*x^-1)^-1//2, x) == :(-1*x^-1*productlog(a*x^-1)^-1//2+-1//2*pi^(1/2)*a^-1*erfi(productlog(a*x^-1)^(1/2)))
@test integrate(x^-3*productlog(a*x^-1)^-1//2, x) == :(-1//2*x^-2*productlog(a*x^-1)^-1//2+-1//8*x^-2*productlog(a*x^-1)^-3//2+1//32*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(x^-4*productlog(a*x^-1)^-1//2, x) == :(-1//3*x^-3*productlog(a*x^-1)^-1//2+-1//18*x^-3*productlog(a*x^-1)^-3//2+1//36*x^-3*productlog(a*x^-1)^-5//2+-1//216*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*productlog(a*x^-1)^(1/2)))
@test integrate(x^2*(c*productlog(a*x^-1))^p, x) == :(3^(3+-1p)*a^-1*x^4*(c*productlog(a*x^-1))^p*productlog(a*x^-1)^(4+-1p)*SpecialFunctions.gamma(-3+p,3*productlog(a*x^-1))*exp(4*productlog(a*x^-1))+3^(2+-1p)*a^-1*c^-1*x^4*(c*productlog(a*x^-1))^(1+p)*productlog(a*x^-1)^(3+-1p)*SpecialFunctions.gamma(-2+p,3*productlog(a*x^-1))*exp(4*productlog(a*x^-1)))
@test integrate(x*(c*productlog(a*x^-1))^p, x) == :(2^(2+-1p)*a^-1*x^3*(c*productlog(a*x^-1))^p*productlog(a*x^-1)^(3+-1p)*SpecialFunctions.gamma(-2+p,2*productlog(a*x^-1))*exp(3*productlog(a*x^-1))+2^(1+-1p)*a^-1*c^-1*x^3*(c*productlog(a*x^-1))^(1+p)*productlog(a*x^-1)^(2+-1p)*SpecialFunctions.gamma(-1+p,2*productlog(a*x^-1))*exp(3*productlog(a*x^-1)))
@test integrate(x^-1*(c*productlog(a*x^-1))^p, x) == :(-1*p^-1*(c*productlog(a*x^-1))^p+-1*c^-1*(c*productlog(a*x^-1))^(1+p)*(1+p)^-1)
@test integrate(x^-2*(c*productlog(a*x^-1))^p, x) == :(-1*x^-1*(c*productlog(a*x^-1))^p+p*a^-1*(-1*productlog(a*x^-1))^(-1p)*(c*productlog(a*x^-1))^p*SpecialFunctions.gamma(1+p,-1*productlog(a*x^-1)))
@test integrate(x^-3*(c*productlog(a*x^-1))^p, x) == :(-1*2^(-2+-1p)*a^-1*x^-1*(-1*productlog(a*x^-1))^(-1+-1p)*(c*productlog(a*x^-1))^p*SpecialFunctions.gamma(2+p,-2*productlog(a*x^-1))*exp(-1*productlog(a*x^-1))+-1*2^(-3+-1p)*a^-1*c^-1*x^-1*(-1*productlog(a*x^-1))^(-2+-1p)*(c*productlog(a*x^-1))^(1+p)*SpecialFunctions.gamma(3+p,-2*productlog(a*x^-1))*exp(-1*productlog(a*x^-1)))
@test integrate(productlog(a*x^-1//4)^5, x) == :(x*productlog(a*x^-1//4)^5+5//4*x*productlog(a*x^-1//4)^4)
@test integrate(productlog(a*x^-1//3)^4, x) == :(x*productlog(a*x^-1//3)^4+4//3*x*productlog(a*x^-1//3)^3)
@test integrate(productlog(a*x^-1//2)^3, x) == :(x*productlog(a*x^-1//2)^3+3//2*x*productlog(a*x^-1//2)^2)
@test integrate(productlog(a*x^-1)^2, x) == :(x*productlog(a*x^-1)^2+2*x*productlog(a*x^-1))
@test integrate(productlog(a*x^(1/2))^-1, x) == :(x*productlog(a*x^(1/2))^-1+(1/2)*x*productlog(a*x^(1/2))^-2)
@test integrate(productlog(a*x^1//3)^-2, x) == :(x*productlog(a*x^1//3)^-2+2//3*x*productlog(a*x^1//3)^-3)
@test integrate(productlog(a*x^1//4)^-3, x) == :(x*productlog(a*x^1//4)^-3+3//4*x*productlog(a*x^1//4)^-4)
@test integrate(productlog(a*x^-1//5)^4, x) == :(5*x*productlog(a*x^-1//5)^4+20*a^5*expintegralei(-5*productlog(a*x^-1//5)))
@test integrate(productlog(a*x^-1//4)^3, x) == :(4*x*productlog(a*x^-1//4)^3+12*a^4*expintegralei(-4*productlog(a*x^-1//4)))
@test integrate(productlog(a*x^-1//3)^2, x) == :(3*x*productlog(a*x^-1//3)^2+6*a^3*expintegralei(-3*productlog(a*x^-1//3)))
@test integrate(productlog(a*x^-1//2), x) == :(2*x*productlog(a*x^-1//2)+2*a^2*expintegralei(-2*productlog(a*x^-1//2)))
@test integrate(productlog(a*x)^-2, x) == :(-1*x*productlog(a*x)^-2+2*a^-1*expintegralei(productlog(a*x)))
@test integrate(productlog(a*x^(1/2))^-3, x) == :(-2*x*productlog(a*x^(1/2))^-3+6*a^-2*expintegralei(2*productlog(a*x^(1/2))))
@test integrate(productlog(a*x^1//3)^-4, x) == :(-3*x*productlog(a*x^1//3)^-4+12*a^-3*expintegralei(3*productlog(a*x^1//3)))
@test integrate(productlog(a*x^1//4)^-5, x) == :(-4*x*productlog(a*x^1//4)^-5+20*a^-4*expintegralei(4*productlog(a*x^1//4)))
@test integrate(productlog(a*x^n)^(n^-1*(-1+n)), x) == :(x*productlog(a*x^n)^(-1*n^-1*(1+-1n))+x*productlog(a*x^n)^(-1*n^-1)*(1+-1n))
@test integrate(productlog(a*x^((1+-1p)^-1))^p, x) == :(x*productlog(a*x^((1+-1p)^-1))^p+-1*p*x*(1+-1p)^-1*productlog(a*x^((1+-1p)^-1))^(-1+p))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^9//2, x) == :(-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^9//2+-135//8*c^3*n^-1*x^(-1n)*(c*productlog(a*x^n))^3//2+-45//4*c^2*n^-1*x^(-1n)*(c*productlog(a*x^n))^5//2+-9//2*c*n^-1*x^(-1n)*(c*productlog(a*x^n))^7//2+135//16*a*pi^(1/2)*c^9//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^7//2, x) == :(-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^7//2+-21//4*c^2*n^-1*x^(-1n)*(c*productlog(a*x^n))^3//2+-7//2*c*n^-1*x^(-1n)*(c*productlog(a*x^n))^5//2+21//8*a*pi^(1/2)*c^7//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^5//2, x) == :(-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^5//2+-5//2*c*n^-1*x^(-1n)*(c*productlog(a*x^n))^3//2+5//4*a*pi^(1/2)*c^5//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^3//2, x) == :(-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^3//2+3//2*a*pi^(1/2)*c^3//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^(1/2), x) == :(-2*n^-1*x^(-1n)*(c*productlog(a*x^n))^(1/2)+-1*a*pi^(1/2)*c^(1/2)*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^-1//2, x) == :(-2//3*n^-1*x^(-1n)*(c*productlog(a*x^n))^-1//2+-2//3*c^-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^(1/2)+-2//3*a*pi^(1/2)*c^-1//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^-3//2, x) == :(-2//5*n^-1*x^(-1n)*(c*productlog(a*x^n))^-3//2+-2//5*c^-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^-1//2+4//5*c^-2*n^-1*x^(-1n)*(c*productlog(a*x^n))^(1/2)+4//5*a*pi^(1/2)*c^-3//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-1n)*(c*productlog(a*x^n))^-5//2, x) == :(-2//7*n^-1*x^(-1n)*(c*productlog(a*x^n))^-5//2+-8//21*c^-3*n^-1*x^(-1n)*(c*productlog(a*x^n))^(1/2)+-2//7*c^-1*n^-1*x^(-1n)*(c*productlog(a*x^n))^-3//2+4//21*c^-2*n^-1*x^(-1n)*(c*productlog(a*x^n))^-1//2+-8//21*a*pi^(1/2)*c^-5//2*n^-1*erf(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^11//2, x) == :(-1//2*n^-1*x^(-2n)*(c*productlog(a*x^n))^11//2+-165//128*c^3*n^-1*x^(-2n)*(c*productlog(a*x^n))^5//2+-55//32*c^2*n^-1*x^(-2n)*(c*productlog(a*x^n))^7//2+-11//8*c*n^-1*x^(-2n)*(c*productlog(a*x^n))^9//2+165//512*2^(1/2)*pi^(1/2)*a^2*c^11//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^9//2, x) == :(-1//2*n^-1*x^(-2n)*(c*productlog(a*x^n))^9//2+-27//32*c^2*n^-1*x^(-2n)*(c*productlog(a*x^n))^5//2+-9//8*c*n^-1*x^(-2n)*(c*productlog(a*x^n))^7//2+27//128*2^(1/2)*pi^(1/2)*a^2*c^9//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^7//2, x) == :(-1//2*n^-1*x^(-2n)*(c*productlog(a*x^n))^7//2+-7//8*c*n^-1*x^(-2n)*(c*productlog(a*x^n))^5//2+7//32*2^(1/2)*pi^(1/2)*a^2*c^7//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^5//2, x) == :(-1//2*n^-1*x^(-2n)*(c*productlog(a*x^n))^5//2+5//8*2^(1/2)*pi^(1/2)*a^2*c^5//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^3//2, x) == :(-2*n^-1*x^(-2n)*(c*productlog(a*x^n))^3//2+-3//2*2^(1/2)*pi^(1/2)*a^2*c^3//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^(1/2), x) == :(-2//3*n^-1*x^(-2n)*(c*productlog(a*x^n))^(1/2)+2//3*c^-1*n^-1*x^(-2n)*(c*productlog(a*x^n))^3//2+2//3*2^(1/2)*pi^(1/2)*a^2*c^(1/2)*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^-1//2, x) == :(-2//5*n^-1*x^(-2n)*(c*productlog(a*x^n))^-1//2+-2//15*c^-1*n^-1*x^(-2n)*(c*productlog(a*x^n))^(1/2)+8//15*c^-2*n^-1*x^(-2n)*(c*productlog(a*x^n))^3//2+8//15*2^(1/2)*pi^(1/2)*a^2*c^-1//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-2n)*(c*productlog(a*x^n))^-3//2, x) == :(-2//7*n^-1*x^(-2n)*(c*productlog(a*x^n))^-3//2+-32//35*c^-3*n^-1*x^(-2n)*(c*productlog(a*x^n))^3//2+-6//35*c^-1*n^-1*x^(-2n)*(c*productlog(a*x^n))^-1//2+8//35*c^-2*n^-1*x^(-2n)*(c*productlog(a*x^n))^(1/2)+-32//35*2^(1/2)*pi^(1/2)*a^2*c^-3//2*n^-1*erf(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^5//2, x) == :(n^-1*x^n*(c*productlog(a*x^n))^5//2+-75//8*c^3*n^-1*x^n*(c*productlog(a*x^n))^-1//2+-5//2*c*n^-1*x^n*(c*productlog(a*x^n))^3//2+25//4*c^2*n^-1*x^n*(c*productlog(a*x^n))^(1/2)+75//16*pi^(1/2)*a^-1*c^5//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^3//2, x) == :(n^-1*x^n*(c*productlog(a*x^n))^3//2+-3//2*c*n^-1*x^n*(c*productlog(a*x^n))^(1/2)+9//4*c^2*n^-1*x^n*(c*productlog(a*x^n))^-1//2+-9//8*pi^(1/2)*a^-1*c^3//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^(1/2), x) == :(n^-1*x^n*(c*productlog(a*x^n))^(1/2)+-1//2*c*n^-1*x^n*(c*productlog(a*x^n))^-1//2+1//4*pi^(1/2)*a^-1*c^(1/2)*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^-1//2, x) == :(n^-1*x^n*(c*productlog(a*x^n))^-1//2+(1/2)*pi^(1/2)*a^-1*c^-1//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^-3//2, x) == :(-2*n^-1*x^n*(c*productlog(a*x^n))^-3//2+3*pi^(1/2)*a^-1*c^-3//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^-5//2, x) == :(-2//3*n^-1*x^n*(c*productlog(a*x^n))^-5//2+-10//3*c^-1*n^-1*x^n*(c*productlog(a*x^n))^-3//2+10//3*pi^(1/2)*a^-1*c^-5//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^-7//2, x) == :(-2//5*n^-1*x^n*(c*productlog(a*x^n))^-7//2+-28//15*c^-2*n^-1*x^n*(c*productlog(a*x^n))^-3//2+-14//15*c^-1*n^-1*x^n*(c*productlog(a*x^n))^-5//2+28//15*pi^(1/2)*a^-1*c^-7//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+n)*(c*productlog(a*x^n))^-9//2, x) == :(-2//7*n^-1*x^n*(c*productlog(a*x^n))^-9//2+-24//35*c^-3*n^-1*x^n*(c*productlog(a*x^n))^-3//2+-18//35*c^-1*n^-1*x^n*(c*productlog(a*x^n))^-7//2+-12//35*c^-2*n^-1*x^n*(c*productlog(a*x^n))^-5//2+24//35*pi^(1/2)*a^-1*c^-9//2*n^-1*erfi(c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^3//2, x) == :((1/2)*n^-1*x^(2n)*(c*productlog(a*x^n))^3//2+-45//128*c^3*n^-1*x^(2n)*(c*productlog(a*x^n))^-3//2+-3//8*c*n^-1*x^(2n)*(c*productlog(a*x^n))^(1/2)+15//32*c^2*n^-1*x^(2n)*(c*productlog(a*x^n))^-1//2+45//512*2^(1/2)*pi^(1/2)*a^-2*c^3//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^(1/2), x) == :((1/2)*n^-1*x^(2n)*(c*productlog(a*x^n))^(1/2)+-1//8*c*n^-1*x^(2n)*(c*productlog(a*x^n))^-1//2+3//32*c^2*n^-1*x^(2n)*(c*productlog(a*x^n))^-3//2+-3//128*2^(1/2)*pi^(1/2)*a^-2*c^(1/2)*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^-1//2, x) == :((1/2)*n^-1*x^(2n)*(c*productlog(a*x^n))^-1//2+1//8*c*n^-1*x^(2n)*(c*productlog(a*x^n))^-3//2+-1//32*2^(1/2)*pi^(1/2)*a^-2*c^-1//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^-3//2, x) == :((1/2)*n^-1*x^(2n)*(c*productlog(a*x^n))^-3//2+3//8*2^(1/2)*pi^(1/2)*a^-2*c^-3//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^-5//2, x) == :(-2*n^-1*x^(2n)*(c*productlog(a*x^n))^-5//2+5//2*2^(1/2)*pi^(1/2)*a^-2*c^-5//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^-7//2, x) == :(-2//3*n^-1*x^(2n)*(c*productlog(a*x^n))^-7//2+-14//3*c^-1*n^-1*x^(2n)*(c*productlog(a*x^n))^-5//2+14//3*2^(1/2)*pi^(1/2)*a^-2*c^-7//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^-9//2, x) == :(-2//5*n^-1*x^(2n)*(c*productlog(a*x^n))^-9//2+-24//5*c^-2*n^-1*x^(2n)*(c*productlog(a*x^n))^-5//2+-6//5*c^-1*n^-1*x^(2n)*(c*productlog(a*x^n))^-7//2+24//5*2^(1/2)*pi^(1/2)*a^-2*c^-9//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+2n)*(c*productlog(a*x^n))^-11//2, x) == :(-2//7*n^-1*x^(2n)*(c*productlog(a*x^n))^-11//2+-352//105*c^-3*n^-1*x^(2n)*(c*productlog(a*x^n))^-5//2+-88//105*c^-2*n^-1*x^(2n)*(c*productlog(a*x^n))^-7//2+-22//35*c^-1*n^-1*x^(2n)*(c*productlog(a*x^n))^-9//2+352//105*2^(1/2)*pi^(1/2)*a^-2*c^-11//2*n^-1*erfi(2^(1/2)*c^-1//2*(c*productlog(a*x^n))^(1/2)))
@test integrate(x^(-1+-3n)*productlog(a*x^n)^4, x) == :(-4//9*n^-1*x^(-3n)*productlog(a*x^n)^3+-1//3*n^-1*x^(-3n)*productlog(a*x^n)^4)
@test integrate(x^(-1+-2n)*productlog(a*x^n)^3, x) == :(-3//4*n^-1*x^(-2n)*productlog(a*x^n)^2+-1//2*n^-1*x^(-2n)*productlog(a*x^n)^3)
@test integrate(x^(-1+-1n)*productlog(a*x^n)^2, x) == :(-1*n^-1*x^(-1n)*productlog(a*x^n)^2+-2*n^-1*x^(-1n)*productlog(a*x^n))
@test integrate(x^(-1+2n)*productlog(a*x^n)^-1, x) == :((1/2)*n^-1*x^(2n)*productlog(a*x^n)^-1+1//4*n^-1*x^(2n)*productlog(a*x^n)^-2)
@test integrate(x^(-1+3n)*productlog(a*x^n)^-2, x) == :(1//3*n^-1*x^(3n)*productlog(a*x^n)^-2+2//9*n^-1*x^(3n)*productlog(a*x^n)^-3)
@test integrate(x^(-1+4n)*productlog(a*x^n)^-3, x) == :(1//4*n^-1*x^(4n)*productlog(a*x^n)^-3+3//16*n^-1*x^(4n)*productlog(a*x^n)^-4)
@test integrate(x^(-1+n*(1+-1p))*(c*productlog(a*x^n))^p, x) == :(n^-1*x^(n*(1+-1p))*(c*productlog(a*x^n))^p*(1+-1p)^-1+-1*c*p*n^-1*x^(n*(1+-1p))*(c*productlog(a*x^n))^(-1+p)*(1+-1p)^-2)
@test integrate(x^(-1+n*(2+-1p))*(c*productlog(a*x^n))^p, x) == :(n^-1*x^(n*(2+-1p))*(c*productlog(a*x^n))^p*(2+-1p)^-1+p*c^2*n^-1*x^(n*(2+-1p))*(c*productlog(a*x^n))^(-2+p)*(2+-1p)^-3+-1*c*p*n^-1*x^(n*(2+-1p))*(c*productlog(a*x^n))^(-1+p)*(2+-1p)^-2)
@test integrate(x^(-1+n*(3+-1p))*(c*productlog(a*x^n))^p, x) == :(n^-1*x^(n*(3+-1p))*(c*productlog(a*x^n))^p*(3+-1p)^-1+-1*c*p*n^-1*x^(n*(3+-1p))*(c*productlog(a*x^n))^(-1+p)*(3+-1p)^-2+-2*p*c^3*n^-1*x^(n*(3+-1p))*(c*productlog(a*x^n))^(-3+p)*(3+-1p)^-4+2*p*c^2*n^-1*x^(n*(3+-1p))*(c*productlog(a*x^n))^(-2+p)*(3+-1p)^-3)
@test integrate(x^3*(1+productlog(a*x))^-1, x) == :(-3//16*x^4*productlog(a*x)^-2+-3//128*x^4*productlog(a*x)^-4+1//4*x^4*productlog(a*x)^-1+3//32*x^4*productlog(a*x)^-3)
@test integrate(x^2*(1+productlog(a*x))^-1, x) == :(-2//9*x^3*productlog(a*x)^-2+1//3*x^3*productlog(a*x)^-1+2//27*x^3*productlog(a*x)^-3)
@test integrate(x*(1+productlog(a*x))^-1, x) == :((1/2)*x^2*productlog(a*x)^-1+-1//4*x^2*productlog(a*x)^-2)
@test integrate((1+productlog(a*x))^-1, x) == :(x*productlog(a*x)^-1)
@test integrate(x^-1*(1+productlog(a*x))^-1, x) == :(log(productlog(a*x)))
@test integrate(x^-2*(1+productlog(a*x))^-1, x) == :(-1*x^-1+-1*a*expintegralei(-1*productlog(a*x)))
@test integrate(x^-3*(1+productlog(a*x))^-1, x) == :(-1//2*x^-2+x^-2*productlog(a*x)+2*a^2*expintegralei(-2*productlog(a*x)))
@test integrate(x^-4*(1+productlog(a*x))^-1, x) == :(-1//3*x^-3+(1/2)*x^-3*productlog(a*x)+-9//2*a^3*expintegralei(-3*productlog(a*x))+-3//2*x^-3*productlog(a*x)^2)
@test integrate(x^3*(1+productlog(a*x^2))^-1, x) == :(-1//8*x^4*productlog(a*x^2)^-2+1//4*x^4*productlog(a*x^2)^-1)
@test integrate(x*(1+productlog(a*x^2))^-1, x) == :((1/2)*x^2*productlog(a*x^2)^-1)
@test integrate(x^-1*(1+productlog(a*x^2))^-1, x) == :((1/2)*log(productlog(a*x^2)))
@test integrate(x^-3*(1+productlog(a*x^2))^-1, x) == :(-1//2*x^-2+-1//2*a*expintegralei(-1*productlog(a*x^2)))
@test integrate(x^3*(1+productlog(a*x^-1))^-1, x) == :(1//4*x^4+-32//3*a^4*expintegralei(-4*productlog(a*x^-1))+-8//3*x^4*productlog(a*x^-1)^3+-1//3*x^4*productlog(a*x^-1)+2//3*x^4*productlog(a*x^-1)^2)
@test integrate(x^2*(1+productlog(a*x^-1))^-1, x) == :(1//3*x^3+-1//2*x^3*productlog(a*x^-1)+3//2*x^3*productlog(a*x^-1)^2+9//2*a^3*expintegralei(-3*productlog(a*x^-1)))
@test integrate(x*(1+productlog(a*x^-1))^-1, x) == :((1/2)*x^2+-1*x^2*productlog(a*x^-1)+-2*a^2*expintegralei(-2*productlog(a*x^-1)))
@test integrate((1+productlog(a*x^-1))^-1, x) == :(x+a*expintegralei(-1*productlog(a*x^-1)))
@test integrate(x^-1*(1+productlog(a*x^-1))^-1, x) == :(-1*log(productlog(a*x^-1)))
@test integrate(x^-2*(1+productlog(a*x^-1))^-1, x) == :(-1*x^-1*productlog(a*x^-1)^-1)
@test integrate(x^-3*(1+productlog(a*x^-1))^-1, x) == :(-1//2*x^-2*productlog(a*x^-1)^-1+1//4*x^-2*productlog(a*x^-1)^-2)
@test integrate(x^-4*(1+productlog(a*x^-1))^-1, x) == :(-2//27*x^-3*productlog(a*x^-1)^-3+-1//3*x^-3*productlog(a*x^-1)^-1+2//9*x^-3*productlog(a*x^-1)^-2)
@test integrate(x^5*(1+productlog(a*x^-2))^-1, x) == :(1//6*x^6+-1//4*x^6*productlog(a*x^-2)+3//4*x^6*productlog(a*x^-2)^2+9//4*a^3*expintegralei(-3*productlog(a*x^-2)))
@test integrate(x^3*(1+productlog(a*x^-2))^-1, x) == :(1//4*x^4+-1*a^2*expintegralei(-2*productlog(a*x^-2))+-1//2*x^4*productlog(a*x^-2))
@test integrate(x*(1+productlog(a*x^-2))^-1, x) == :((1/2)*x^2+(1/2)*a*expintegralei(-1*productlog(a*x^-2)))
@test integrate(x^-1*(1+productlog(a*x^-2))^-1, x) == :(-1//2*log(productlog(a*x^-2)))
@test integrate(x^-3*(1+productlog(a*x^-2))^-1, x) == :(-1//2*x^-2*productlog(a*x^-2)^-1)
@test integrate(x^m*(d+d*productlog(a*x))^-1, x) == :(a^-1*d^-1*x^m*((-1+-1m)*productlog(a*x))^(-1m)*(1+m)^-1*SpecialFunctions.gamma(1+m,(-1+-1m)*productlog(a*x))*exp(-1*m*productlog(a*x)))
@test integrate((1+productlog(a*x^-1//4))^-1*productlog(a*x^-1//4)^5, x) == :(x*productlog(a*x^-1//4)^4)
@test integrate((1+productlog(a*x^-1//3))^-1*productlog(a*x^-1//3)^4, x) == :(x*productlog(a*x^-1//3)^3)
@test integrate((1+productlog(a*x^-1//2))^-1*productlog(a*x^-1//2)^3, x) == :(x*productlog(a*x^-1//2)^2)
@test integrate((1+productlog(a*x^-1))^-1*productlog(a*x^-1)^2, x) == :(x*productlog(a*x^-1))
@test integrate((1+productlog(a*x^(1/2)))^-1*productlog(a*x^(1/2))^-1, x) == :(x*productlog(a*x^(1/2))^-2)
@test integrate((1+productlog(a*x^1//3))^-1*productlog(a*x^1//3)^-2, x) == :(x*productlog(a*x^1//3)^-3)
@test integrate((1+productlog(a*x^1//4))^-1*productlog(a*x^1//4)^-3, x) == :(x*productlog(a*x^1//4)^-4)
@test integrate((1+productlog(a*x^-1//4))^-1*productlog(a*x^-1//4)^4, x) == :(-4*a^4*expintegralei(-4*productlog(a*x^-1//4)))
@test integrate((1+productlog(a*x^-1//3))^-1*productlog(a*x^-1//3)^3, x) == :(-3*a^3*expintegralei(-3*productlog(a*x^-1//3)))
@test integrate((1+productlog(a*x^-1//2))^-1*productlog(a*x^-1//2)^2, x) == :(-2*a^2*expintegralei(-2*productlog(a*x^-1//2)))
@test integrate((1+productlog(a*x^-1))^-1*productlog(a*x^-1), x) == :(-1*a*expintegralei(-1*productlog(a*x^-1)))
@test integrate((1+productlog(a*x))^-1*productlog(a*x)^-1, x) == :(a^-1*expintegralei(productlog(a*x)))
@test integrate((1+productlog(a*x^(1/2)))^-1*productlog(a*x^(1/2))^-2, x) == :(2*a^-2*expintegralei(2*productlog(a*x^(1/2))))
@test integrate((1+productlog(a*x^1//3))^-1*productlog(a*x^1//3)^-3, x) == :(3*a^-3*expintegralei(3*productlog(a*x^1//3)))
@test integrate((1+productlog(a*x^1//4))^-1*productlog(a*x^1//4)^-4, x) == :(4*a^-4*expintegralei(4*productlog(a*x^1//4)))
@test integrate((1+productlog(a*x^n))^-1*productlog(a*x^n)^(1+-1*n^-1), x) == :(x*productlog(a*x^n)^(-1*n^-1))
@test integrate((1+productlog(a*x^((1+-1p)^-1)))^-1*productlog(a*x^((1+-1p)^-1))^p, x) == :(x*productlog(a*x^((1+-1p)^-1))^(-1+p))

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


text:
using Test
using Cyclotomics

@testset "Cyclotomics" begin

    @testset "zumbroich" begin

        @test Cyclotomics._forbidden_residues(45, 5, 1) == BitSet([ 0 ])
        @test Cyclotomics._forbidden_residues(45, 3, 2) == BitSet([ 4, 0, 5 ])

        @test last(first(Cyclotomics.ForbiddenResidues(9))) isa BitSet
        fb = Cyclotomics.ForbiddenResidues(9)
        @test 0 in fb
        @test 1 in fb
        @test !(2 in fb)

        cs(x) = sort!(collect(x))

        @test cs(Cyclotomics.zumbroich_basis(9)) == [ 2, 3, 4, 5, 6, 7 ]

        @test !any(in(fb), Cyclotomics.zumbroich_basis(9))

        @test Cyclotomics.zumbroich_plain(8) ==
            cs(Cyclotomics.zumbroich_basis(8)) == [ 0, 1, 2, 3 ]
        @test Cyclotomics.zumbroich_plain(9) ==
            cs(Cyclotomics.zumbroich_basis(9)) == [ 2, 3, 4, 5, 6, 7 ]

        @test cs(Cyclotomics.zumbroich_basis(45)) == [ 1, 2, 3, 6, 7, 8, 11, 12, 16, 17, 19, 21, 24, 26, 28, 29, 33, 34, 37, 38, 39, 42, 43, 44 ]

        @test all(Cyclotomics.zumbroich_plain(i) ==
            cs(Cyclotomics.zumbroich_basis(i)) ==
            Cyclotomics.zumbroich_direct(i) for i in 1:5000)
    end

    @testset "elementary ops" begin
        @test E(5) isa Number
        @test E(5) isa Cyclotomic{Int}
        @test E(5, 0) isa Cyclotomic{Int}
        @test E(5, 6) isa Cyclotomic{Int}

        E₅ = E(5)
        @test valtype(E₅) == Int
        @test Cyclotomic{Float64}(E₅) isa Cyclotomic{Float64}

        E₅fl = Cyclotomic{Float64}(E₅)
        @test valtype(E₅fl) == Float64

        @test similar(E₅) isa Cyclotomic{Int}
        @test similar(E₅fl) isa Cyclotomic{Float64}

        @test zero(E₅) isa Cyclotomic{Int}
        @test zero(E₅fl) isa Cyclotomic{Float64}

        @test one(E₅) isa Cyclotomic{Int}
        @test one(E₅fl) isa Cyclotomic{Float64}

        @test deepcopy(E₅).coeffs !== E₅.coeffs
        @test deepcopy(E₅).coeffs == E₅.coeffs
    end

    @testset "io strings" begin
        @test sprint(print, E(5)) == " 1*E(5)^1"
        @test sprint(show, 2E(5)) == " 2*ζ₅"
        @test sprint(print, -E(5)) == "-1*E(5)^1"
        @test sprint(show, -E(5)) == "-ζ₅"

        @test sprint(show, -1.0*E(5)) == "-1.0*ζ₅"

        @test sprint(show, 0.0*E(4)) == "0.0"
        @test sprint(print, 0.0*E(4)) == "0.0"
        @test sprint(show, E(1)) == "1"
        @test sprint(print, 1.0*E(1)) == " 1.0*E(1)^0"

        using Base.Meta
        x = E(5) + 2E(5)^2
        @test sprint(print, x) == " 1*E(5)^1 + 2*E(5)^2"
        @test sprint(show, x) == " ζ₅ + 2*ζ₅²"
        @test eval(Base.Meta.parse(sprint(print, x))) == x

        x = E(5) - 2E(5)^2
        @test sprint(print, x) == " 1*E(5)^1 -2*E(5)^2"
        @test sprint(show, x) == " ζ₅ -2*ζ₅²"
        @test eval(Base.Meta.parse(sprint(print, x))) == x

        x = -2E(5) + 2E(5)^2
        @test sprint(print, x) == "-2*E(5)^1 + 2*E(5)^2"
        @test sprint(show, x) == "-2*ζ₅ + 2*ζ₅²"
        @test eval(Base.Meta.parse(sprint(print, x))) == x

    end

    @testset "indexing and iteration" begin
        x = E(5)
        @test x[0] == 0
        @test x[1] == 1
        @test all(iszero, x[2:5])
        @test x[-1] == 0
        @test x[-4] == 1
        @test x[6] == 1

        @test setindex!(x, 1, 2) == 1
        x[2] = 3
        @test x[0] == 0
        @test x[1] == 1
        @test x[2] == 3
        @test x[-3] == 3
        @test x[7] == 3

        @test collect(Cyclotomics.exps_coeffs(E(6))) == [(1,1)]
        @test collect(Cyclotomics.exps_coeffs(Cyclotomics.normalform!(E(6)))) == [(4,-1)]
    end

    @testset "aritmetic: +, -, module: *, //" begin
        x = E(5)
        y = E(5,2)

        @test 2x isa Cyclotomic{Int}
        @test 2.0x isa Cyclotomic{Float64}
        @test x*2.0 isa Cyclotomic{Float64}
        @test div(x, 2) isa Cyclotomic{Int}
        @test x//2 isa Cyclotomic{Rational{Int}}
        @test x/2.0 isa Cyclotomic{Float64}
        @test x/2 isa Cyclotomic{Float64}

        @test x+2y isa Cyclotomic{Int}
        xy = x+2y
        @test xy[0] == 0
        @test xy[1] == 1
        @test xy[2] == 2
        @test all(iszero, xy[3:5])

        @test 2.0xy[0] isa Float64
        @test 2.0xy[1] == 2

        @test (xy - 2y)[1] == 1
        @test all(iszero, (xy - 2y)[2:5])

        @test 1 + x isa Cyclotomic{Int}
        @test (1+x)[0] == 1
        @test x + 1 isa Cyclotomic{Int}
        @test 2.0 + x isa Cyclotomic{Float64}
        @test 2.0 - x isa Cyclotomic{Float64}
        @test x + 2.0 isa Cyclotomic{Float64}
        @test (x+2.0)[0] == 2.0

        # Bug: normalform! is needed in div
        x = E(4,0) - E(4,2)
        @test isone(div(x,2))
        x = Cyclotomics.embed(5*E(4,0), 60);
        Cyclotomics.normalform!(x)
        @test isone(div(x-2, 3))

        # broadcasting on 1.6 is broken

        @test E(3) .* [1,2] == [E(3), 2E(3)]
        @test eltype(E(3) .* [1.0,2.0]) <: Cyclotomic{Float64}
        @test eltype(1//1*E(3) .* [1,2]) <: Cyclotomic{Rational{Int}}
    end

    @testset "*, powering" begin
        x = E(5)
        y = E(5,2)

        w = x*(x+2y)
        @test x*y isa Cyclotomic{Int}
        @test (x*y)[1] == 0
        @test (x*y)[2] == 0
        @test (x*y)[3] == 1
        w = (1+x)*(1+y)
        @test w[0] == 1
        @test w[1] == 1
        @test w[2] == 1
        @test w[3] == 1

        @test (x^2)[1] == 0
        @test (x^2)[2] == 1

        @test ((1+x)^2)[0] == 1
        @test ((1+x)^2)[1] == 2
        @test ((1+x)^2)[2] == 1
        @test ((1+x)^2)[3] == 0

        @test ((1+x^3)^2)[0] == 1
        @test ((1+x^3)^2)[1] == 1
        @test ((1+x^3)^2)[3] == 2
    end

    @testset "normal form" begin
        x = E(45) + E(45, 5);
        x.coeffs
        @test deepcopy(x) !== x

        y = Cyclotomics.normalform(x);

        e = E(45)
        w = e + e^2 + e^8 + e^11 + e^17 + e^26 + e^29 + e^38 + e^44

        @test w == y
        @test x.coeffs != y.coeffs
        @test y.coeffs == w.coeffs

        @test deepcopy(x) == deepcopy(y)
        @test x !== deepcopy(x)
        @test x.coeffs === copy(x).coeffs

        @test hash(deepcopy(x)) == hash(deepcopy(y))
        @test length(Set([deepcopy(x), deepcopy(y), deepcopy(x), deepcopy(y)])) == 1

        @test iszero(1 + x - x - 1)

        @test isone(sum(-E(5)^i for i in 1:4))
        @test isone(E(5)^5)
        x = E(5)^5
        @test x == sum(-E(5)^i for i in 1:4)
    end

    @testset "predicates" begin

        @test isreal(1+E(5)-E(5))
        @test isreal(E(5,1) + E(5,4))
        @test isreal(E(5,2) + E(5,3))
        @test !isreal(E(5,1) + E(5,2))
        @test !isreal(E(5,1) + E(5,3))

        @test isreal(abs2(E(5,1) + E(5,2)))

        @test 1 == E(5)^5
        @test E(5)^2+E(5)^3 ≈ (-1-sqrt(5))/2
        @test E(5)^2+E(5)^3 != (-1-sqrt(5))/2
        @test float(E(5)^2+E(5)^3) == (-1-sqrt(5))/2
        @test 2.0(E(5)^2+E(5)^3) ≈ (-1-sqrt(5))
        @test 2.0(E(5)^2+E(5)^3) != (-1-sqrt(5))

        @test isapprox(1e-17E(5), 0.0, atol=1e-12)
        @test isapprox(0.0, 1e-17E(5), atol=1e-12)
    end

    @testset "embedding" begin
        let x = E(45)^5 + E(45)^10
            @test conductor(Cyclotomics.reduced_embedding(x)) == 9
            y = Cyclotomics.reduced_embedding(x)
            @test y == E(9)^2 - E(9)^4 - E(9)^7
            Cyclotomics.normalform!(x)
            @test conductor(Cyclotomics.reduced_embedding(x)) == 9
        end

        @test conductor(Cyclotomics.reduced_embedding(E(6))) == 3
        @test conductor(Cyclotomics.reduced_embedding(E(14))) == 7
        @test conductor(Cyclotomics.reduced_embedding(E(1234))) == 617
    end

    @testset "tests against GAP" begin
        @test E(9) == -E(9)^4 - E(9)^7
        @test E(9)^3 == E(3)
        @test E(6) == -E(3)^2
        @test E(12)//3 == -1//3*E(12)^7

        @test E(45)^ 4 == -E(45)^19-E(45)^34
        @test E(45)^13 == -E(45)^28-E(45)^43
        @test E(45)^14 == -E(45)^29-E(45)^44
        @test E(45)^22 == -E(45)^ 7-E(45)^37

        @test E(5) + E(3) == -E(15)^2-2*E(15)^8-E(15)^11-E(15)^13-E(15)^14
        @test (E(5) + E(5)^4) ^ 2 == -2*E(5)-E(5)^2-E(5)^3-2*E(5)^4
        @test E(5) / E(3) == E(15)^13
        @test E(5) * E(3) == E(15)^8
    end

    @testset "conjugation and inverse" begin

        function rand1(α::Cyclotomic, u::AbstractRange, k=5)
            x = zero(eltype(u))*α
            for (idx, c) in zip(rand(0:conductor(α), k), rand(u, k))
                x[idx] = c
            end
            return x
        end

        for x in [E(45) + E(45)^2, E(45)+ E(45)^2//1]
            @test conj(x,1) == x
            y = prod(conj(x,i) for i in 2:conductor(x) if gcd(conductor(x), i)==1)
            @test isreal(x*y)
            @test y ==
            E(45)^2+E(45)^3-E(45)^6-E(45)^8+E(45)^11-E(45)^12-2*E(45)^16+
            E(45)^17+E(45)^19+E(45)^21-2*E(45)^24-E(45)^26-E(45)^28+
            2*E(45)^29-E(45)^34+E(45)^37-2*E(45)^42-E(45)^43+E(45)^44

            @test Cyclotomics.galois_conj(x, 1) == x
            @test_throws AssertionError Cyclotomics.galois_conj(x, 5)
        end

        for x in [E(45)^5 + E(45)^10,
                E(45) - E(45)^5,
                rand1(E(45), -5:5, 3),
                rand1(E(45), -1:1, 5)]
            iszero(x) || @test isone(x*inv(x//big(1)))
        end

        for x in [E(45)^5 + big(1)*E(45)^10, (E(45)^5)//1 + big(1)*E(45)^10]
            y = Cyclotomics.normalform(x)
            @test inv(y) == -E(9)^2+E(9)^3-E(9)^4 == inv(x)
            @test inv(y)*x == inv(x)*x == one(x)
        end

        for x in [E(45)^5 + big(1)*E(45)^10, (E(45)^5)//1 + big(1)*E(45)^10]
            y = Cyclotomics.reduced_embedding(x)
            @test inv(y) == -E(9)^2+E(9)^3-E(9)^4 == inv(x)
            @test inv(y)*x == inv(x)*x == one(x)
        end

        for x in [0.5 + 0.75*E(4), 1//2 + 3//4*E(4)]
            @test real(x) == 0.5
            @test imag(x) == 0.75
            @test float(real(x)) isa Float64
            @test float(imag(x)) isa Float64
            @test x == real(x) + im*imag(x)
            @test_throws InexactError float(x)
            @test_throws InexactError Rational{Int}(x)
            @test Rational{Int}(x + conj(x)) isa Rational{Int}
            @test Rational{Int}(x + conj(x)) == x + conj(x)
            if valtype(x) <: Rational
                @test Rational(x+conj(x)) isa Rational{Int}
                @test Rational(x+conj(x)) == 1//1
            else
                @test_throws MethodError Rational(x+conj(x))
            end
        end

        let x = E(45)^5 + E(45)^10
            @test isreal(x+conj(x))
            @test float(x+conj(x)) isa Float64
            @test !first(Cyclotomics._isreal(x))
            @test_throws InexactError Float64(x)
            @test_throws InexactError Rational(x)
        end

        let x = 0.9999999999999787*E(5)^1 + 0.999999999999992*E(5)^2 + 0.9999999999999889*E(5)^3 + 0.9999999999999796*E(5)^4
            z = Cyclotomics.roundcoeffs!(deepcopy(x), digits=12)
            @test x != -1.0
            @test z == -1.0
            @test inv(z) == -1.0
            @test Cyclotomics.droptol!(inv(x) - inv(z), 1e-12) == 0
        end

    end

    @testset "Conversions" begin

        Cyc = typeof(E(3))

        @test iszero(Cyc(0))
        @test isone(Cyc(1))
        @test isone(Cyc(1.0))
        @test valtype(Cyc(1.0)) == Int
        @test zeros(typeof(E(3)), 2, 2) isa Matrix{<:Cyclotomic}

        v = [E(3)^i for i in 1:3]

        @test (v[1] = 1.0*E(5)) isa Cyclotomic{Float64}
        @test eltype(v) <: Cyclotomic{Int}
        @test v[1] isa Cyclotomic{Int}
        @test (v[1] = 2.0*E(5)) isa Cyclotomic{Float64}
        @test v[1] == 2E(5)
        @test_throws InexactError v[1] = 2.5*E(5)
    end

    @testset "Conversions to julia types" begin
        x = E(3)
        y = x + x^2

        @test Int(y) == -1
        @test y == -1
        @test_throws InexactError Int(x)

        @test float(y) == -1.0
        @test y == -1.0
        @test_throws InexactError float(x)

        @test Float64(y) == -1.0
        # @test y == -1.0
        @test_throws InexactError Float64(x)

        @test float(y//big(1)) isa BigFloat
        @test Float64(y//big(1)) isa Float64

        @test ComplexF64(x) isa ComplexF64
        @test Complex{BigFloat}(x) isa Complex{BigFloat}
        γ = 2*π/3
        bγ = 2*big(π)/3
        @test Complex{BigFloat}(x) ≈ cos(bγ) + im*sin(bγ)

        @test ComplexF64(x)^2 ≈ ComplexF64(x^2)

        @test complex(x) isa ComplexF64
        @test complex(x) == cos(γ) + im*sin(γ)

        @test complex(big(1)*x) isa Complex{BigFloat}
        @test complex(big(1)*x) ≈ cos(bγ) + im*sin(bγ)

        @test abs(x) ≈ 1.0
        @test abs(big(1)/3*x) ≈ big(1)/3

        @test ComplexF64 == typeof(@inferred ComplexF64(x))
        @test ComplexF64 == typeof(@inferred ComplexF64(y))
        @test ComplexF64 == typeof(@inferred ComplexF64(big(1) * x))
        @test ComplexF64 == typeof(@inferred ComplexF64(big(1) * y))
    end

    @testset "Complex arithmetic" begin
        @test real(E(4)) == 0
        @test imag(-E(4)) == -1
        @test Cyclotomic(1+2im) isa Cyclotomic
        @test Cyclotomic(1.0-2.0im) isa Cyclotomic
        @test reim(Cyclotomic(2-3im)) == (2,-3)

        @test E(4)*im == -1
        @test E(4)-im == 0
    end

    @testset "dense/sparse" begin
        x = E(3)
        @test Cyclotomics.dense(x) isa Cyclotomic{Int, <:DenseVector}
        y = Cyclotomics.dense(x)
        @test Cyclotomics.sparse(y) isa Cyclotomic{Int, <:Cyclotomics.SparseVector}

        @test coeffs(x) isa Cyclotomics.SparseVector
        @test coeffs(Cyclotomics.sparse(y)) isa Cyclotomics.SparseVector

        @test coeffs(y) isa Vector
        @test coeffs(Cyclotomics.dense(x)) isa Vector

        @test x == y
    end
end

ext: jl


text:
"""
    wetted!(area_size, drop_pos, maxheight, height, t; hthresh = 0.055)

Measures the wetted area and maximal height of the film at time step `t`.
"""
function wetted!(area_size, maxheight, height, t; hthresh = 0.055)
    area_size[t] = length(findall(height .> hthresh))
    maxheight[t] = maximum(height)

    return nothing
end

"""
    fluid_dry!(fluid, dummy, height, t; hthresh = 0.055)

Tracks the location of the thin film as a boolean field.
"""
function fluid_dry!(fluid, dummy, height, t; hthresh = 0.055)
    dummy .= false
    dummy[height .> hthresh] .= true
    fluid[t, :] .= vec(dummy)

    return nothing
end

"""
    t0(;hᵦ=0.07, γ=0.01, μ=1/6, θ=1/6)

Computes a characteristic time scale for an unstable film.
"""
function t0(;hᵦ=0.07, γ=0.01, μ=1/6, θ=1/6)
    qsq = hᵦ * (1 - cospi(θ)) * (2 - 3 * hᵦ)
    charT = 3 * μ / (γ * qsq^2)

    return charT
end

"""
    snapshot!(snap, field, t; dumping)

Makes a copy of the current state of an input array `in` and saves the vectorized values as a column to `out`.

Function that fills a preallocated array out with a time series of system snap shots of e.g. the height field `h`.

# Arguments

- `snap :: Array{Number,2}`: Array that stores the snap shots as columns
- `field :: Array{Number,2}`: Input argument, e.g. ``h(\\mathbf{x},t)``
- `t :: Int`: The current time step
- `dumping :: Int`: Sampling frequency

# Examples

```jldoctest
julia> using Swalbe, Test

julia> h1 = reshape(collect(1:25),5,5); h2 = reshape(collect(5:5:125),5,5);

julia> snapshot = zeros(2, 25);

julia> Swalbe.snapshot!(snapshot,h1,10,dumping=10)

julia> Swalbe.snapshot!(snapshot,h2,20,dumping=10)

julia> @test all(h1 .== reshape(snapshot[1,:],5,5))
Test Passed

julia> @test all(h2 .== reshape(snapshot[2,:],5,5))
Test Passed

```
# References

See also: The [scripts folder](https://github.com/Zitzeronion/Swalbe.jl/tree/master/scripts)
"""
function snapshot!(snap, field, t; dumping = 1000)
    if t % dumping == 0
        snap[t÷dumping, :] .= vec(Array(field))
    end

    return nothing
end

"""
    surfacearea!(area_lv, red_energy, height, θ, ∇hx, ∇hy, dgrad, surface)

Measures the surface area of the liquid vapor interface and the reduced surface energy.
"""
function surfacearea!(area_lv, red_energy, height, θ, ∇hx, ∇hy, dgrad, surface, t; htresh = 0.055)
    ∇f_simple!(∇hx, ∇hy, height, dgrad)
    surf = 0.0
    surface .= sqrt.(∇hx.^2 .+ ∇hy.^2 .+ 1)
    surf = sum(surface[height .> htresh])
    area_lv[t] = surf
    red_energy[t] = surf - sum(cospi.(θ[height .> htresh]))

    return nothing
end

"""
    ∇f_simple!(outputx, outputy, f, dgrad)

Simple gradient calculation for the differential surface area.
"""
function ∇f_simple!(outputx, outputy, f, dgrad)
    fip, fjp, fim, fjm, fipjp, fimjp, fimjm, fipjm = Swalbe.viewneighbors(dgrad)
    # Straight elements  j+1, i+1, i-1, j-1
    circshift!(fip, f, (1,0))
    circshift!(fjp, f, (0,1))
    circshift!(fim, f, (-1,0))
    circshift!(fjm, f, (0,-1))
    # Diagonal elements
    circshift!(fipjp, f, (1,1))
    circshift!(fimjp, f, (-1,1))
    circshift!(fimjm, f, (-1,-1))
    circshift!(fipjm, f, (1,-1))
    # In the end it is just a weighted sum...
    outputx .= -1/3 .* (fip .- fim) .- 1/12 .* (fipjp .- fimjp .- fimjm .+ fipjm)
    outputy .= -1/3 .* (fjp .- fjm) .- 1/12 .* (fipjp .+ fimjp .- fimjm .- fipjm)

    return nothing
end


text:
using DataDeps

register(DataDep(
  "balance-scale",
  "http://archive.ics.uci.edu/ml/datasets/Balance+Scale",
  "http://archive.ics.uci.edu/ml/machine-learning-databases/balance-scale/balance-scale.data",
  "5611187ef7345d807aa8ae22615945ade52a190537c0b1434bd44c3e877c5bb4",
  post_fetch_method=(path -> begin
    UCIData.process_dataset(path,
        target_index=1,
        feature_indices=2:5,
    )
  end),
))

max_stars_repo_name: JackDunnNZ/uci-data

max_issues_repo_name: JackDunnNZ/uci-data

max_forks_repo_name: JackDunnNZ/uci-data


text:
function cc_add(x::Neuro1DRealSignal, y::Neuro1DRealSignal)::Neuro1DRealSignal
    if x.sample_rate != y.sample_rate
        throw(ArgumentError("the sample rate of x and y should be identical"))
    end

    if size(x.signal) != size(x.signal)
        throw(ArgumentError("the size of x and y should be identical"))
    end

    Neuro1DRealSignal(
        signal = x.signal .+ y.signal,
        sample_rate = x.sample_rate
    )
end


text:
"""
$(TYPEDEF)

Constrain only the yaw angle of a Pose2, generally used for Gyrocompass, Magnetometer, Dual-GNSS heading type measurements, or any other similar construct.
"""
mutable struct PartialPriorYawPose2{T} <: IIF.FunctorSingleton  where {T <: IIF.SamplableBelief}
    Z::T
    partial::Tuple{Int}
    PartialPriorYawPose2{T}() where T = new{T}()
    PartialPriorYawPose2{T}(x::T) where {T <: IIF.SamplableBelief}  = new{T}(x, (3,))
end
PartialPriorYawPose2(x::T) where {T <: IIF.SamplableBelief} = PartialPriorYawPose2{T}(x)

function getSample(p2::PartialPriorYawPose2, N::Int=1)
  return (reshape(rand(p2.Z,N),1,N), )
end

## Serialization support

"""
$(TYPEDEF)
"""
mutable struct PackedPartialPriorYawPose2 <: IIF.PackedInferenceType
    Z::String
    PackedPartialPriorYawPose2() = new()
    PackedPartialPriorYawPose2(x::T) where {T <: AbstractString}  = new(x)
end

function convert(::Type{PackedPartialPriorYawPose2}, d::PartialPriorYawPose2)
  PackedPartialPriorYawPose2(string(d.Z))
end
function convert(::Type{PartialPriorYawPose2}, d::PackedPartialPriorYawPose2)
  PartialPriorYawPose2(extractdistribution(d.Z))
end


text:
function convlayeravx!(out::AbstractArray{<:Any,4}, img, kern)
    @avx for j₁ ∈ axes(out,1), j₂ ∈ axes(out,2), d ∈ axes(out,4), o ∈ axes(kern,4)
        s = zero(eltype(out))
        for k₁ ∈ axes(kern,1), k₂ ∈ axes(kern,2), i ∈ axes(kern,3)
            s += img[j₁ + k₁ - 1, j₂ + k₂ - 1, i, d] * kern[k₁, k₂, i, o]
        end
        out[j₁, j₂, o, d] = s
    end
    out
end

function convlayeradjkern!(kernadj::AbstractArray{<:Any,4}, img, outadj)
    @avx for k₁ ∈ axes(kernadj,1), k₂ ∈ axes(kernadj,2), i ∈ axes(kernadj,3), o ∈ axes(kernadj,4)
        s = zero(eltype(kernadj))
        for j₁ ∈ axes(outadj,1), j₂ ∈ axes(outadj,2), d ∈ axes(outadj,4)
            s += img[j₁ + k₁ - 1, j₂ + k₂ - 1, i, d] * outadj[j₁, j₂, o, d]
        end
        kernadj[k₁, k₂, i, o] = s
    end
    kernadj
end
@generated function convlayeradjimg!(imgadj, kern::AbstractStrideArray{Tuple{K₁,K₂,I,O},T,4}, outadj) where {K₁,K₂,I,O,T}
    quote
        for j₁ ∈ axes(imgadj,1), j₂ ∈ axes(imgadj,2), i ∈ axes(kern,3), d ∈ axes(outadj,4)
            s = zero($T)
            for k₁ ∈ axes(kern,1), k₂ ∈ axes(kern,2), o ∈ axes(kern,4)
                s += kern[k₁, k₂, i, o] * outadj[j₁ - k₁ + $K₁, j₂ - k₂ + $K₂, o, d]
            end
            imgadj[j₁, j₂, i, d] = s
        end
        imgadj
    end
end

function conv_output_size(img, kern)
    H = maybestaticsize(img, Val{1}())
    W = maybestaticsize(img, Val{2}())
    O = maybestaticsize(kern,Val{4}())
    D = maybestaticsize(img, Val{4}())
    (H, W, O, D)
end
function convlayeravx(img::AbstractArray{T}, kern) where {T}
    s = conv_output_size(img, kern)
    _, p = PaddedMatrices.size_permute_tuples(img)
    out = PermutedDimsArray(allocarray(T, s), p)
    convlayeravx!(out, img, kern)
end
function convlayeravx(sp::StackPointer, img::AbstractArray{T}, kern) where {T}
    s = conv_output_size(img, kern)
    _, p = PaddedMatrices.size_permute_tuples(img)
    sp, B = PtrArray{T}(sp, s)
    out = PermutedDimsArray(B, p)
    sp, convlayeravx!(out, img, kern)
end

struct ConvolutionLayer{Κ,Κ̄,O} <: AbstractLayer
    κ::Κ
    # κ̄::Κ̄
    # o::O
end
paramters(cl::ConvolutionLayer) = cl.κ
grad(cl::ConvolutionLayer) = cl.κ̄
returns(cl::ConvolutionLayer) = cl.o

# returns out, pullback, and preallocated ∂out
function forward(cl::ConvolutionLayer, img)
    out = convlayeravx(sp, img, cl.κ)
    out, img, out
end
function forward(sp::StackPointer, cl::ConvolutionLayer, img)
    sp, out = convlayeravx(sp, img, cl.κ)
    sp, (out, img, out)
end

# function forward!(cl::ConvolutionLayer, img)
#     out = returns(cl)
#     convlayeravx!(clippedimageview(returns(cl)), img, parameters(cl))
#     img, out, out
# end
function reverse_grad!(cl::ConvolutionLayer, img, ōūt̄)
    convlayeradjkern!(grad(cl), img, clippedimageview(ōūt̄))
end
function reverse_chain!(cl::ConvolutionLayer, img, ōūt̄)
    convlayeradjimg!(clippedimageview(img), parameters(cl), ōūt̄)
end


text:
struct MyNumber
	x::Float64
end

for op in (:sin, :cos, :tan, :log, :exp)
	@eval Base.$op(a::MyNumber) = MyNumber($op(a.x))
end

x = MyNumber(π)
println(sin(x), cos(x), tan(x))

max_stars_repo_name: cdluminate/MyNotes

max_issues_repo_name: cdluminate/MyNotes

max_forks_repo_name: cdluminate/MyNotes