text:
@testset "3.2.3 u log(e (f (a+b x)^p (c+d x)^q)^r)^s" begin
    (A, B, a, b, c, d, e, f, g, h, i, j, k, m, n, p, q, r, s, t, u, x, ) = @variables A B a b c d e f g h i j k m n p q r s t u x

    #= ::Package:: =#

    #= ::Title:: =#
    #=Integrands*of*the*form*u*(A+B*log(e*((a+b*x)/(c+d*x))^n))^p=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(f+g*x^q)^m*(A+B*log(e*((a+b*x)/(c+d*x))^n))^p=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(f+g/x)^m*(A+B*log(e*((a+b*x)/(c+d*x))^n))^p=#

    @test_int [(f + g/x)^3*(A + B*log(e*((a + b*x)/(c + d*x))^n)), x, 16, -((B*(b*c - a*d)*g^3*n)/(2*a*c*x)) + A*f^3*x - (1/2)*B*(b^2/a^2 - d^2/c^2)*g^3*n*log(x) + (b^2*B*g^3*n*log(a + b*x))/(2*a^2) - 3*B*f^2*g*n*log(x)*log(1 + (b*x)/a) + (B*f^3*(a + b*x)*log(e*((a + b*x)/(c + d*x))^n))/b - (g^3*(A + B*log(e*((a + b*x)/(c + d*x))^n)))/(2*x^2) + (3*(b*c - a*d)*f*g^2*(a + b*x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)))/(a*(c + d*x)*(a - (c*(a + b*x))/(c + d*x))) + 3*f^2*g*log(x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)) - (B*(b*c - a*d)*f^3*n*log(c + d*x))/(b*d) - (B*d^2*g^3*n*log(c + d*x))/(2*c^2) + 3*B*f^2*g*n*log(x)*log(1 + (d*x)/c) + (3*B*(b*c - a*d)*f*g^2*n*log(a - (c*(a + b*x))/(c + d*x)))/(a*c) - 3*B*f^2*g*n*PolyLog(2, -((b*x)/a)) + 3*B*f^2*g*n*PolyLog(2, -((d*x)/c))]
    @test_int [(f + g/x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n)), x, 13, A*f^2*x - 2*B*f*g*n*log(x)*log(1 + (b*x)/a) + (B*f^2*(a + b*x)*log(e*((a + b*x)/(c + d*x))^n))/b + ((b*c - a*d)*g^2*(a + b*x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)))/(a*(c + d*x)*(a - (c*(a + b*x))/(c + d*x))) + 2*f*g*log(x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)) - (B*(b*c - a*d)*f^2*n*log(c + d*x))/(b*d) + 2*B*f*g*n*log(x)*log(1 + (d*x)/c) + (B*(b*c - a*d)*g^2*n*log(a - (c*(a + b*x))/(c + d*x)))/(a*c) - 2*B*f*g*n*PolyLog(2, -((b*x)/a)) + 2*B*f*g*n*PolyLog(2, -((d*x)/c))]
    @test_int [(f + g/x)^1*(A + B*log(e*((a + b*x)/(c + d*x))^n)), x, 10, A*f*x - B*g*n*log(x)*log(1 + (b*x)/a) + (B*f*(a + b*x)*log(e*((a + b*x)/(c + d*x))^n))/b + g*log(x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)) - (B*(b*c - a*d)*f*n*log(c + d*x))/(b*d) + B*g*n*log(x)*log(1 + (d*x)/c) - B*g*n*PolyLog(2, -((b*x)/a)) + B*g*n*PolyLog(2, -((d*x)/c))]
    @test_int [(A + B*log(e*((a + b*x)/(c + d*x))^n))/(f + g/x)^1, x, 12, (A*x)/f + (B*(a + b*x)*log(e*((a + b*x)/(c + d*x))^n))/(b*f) - (B*(b*c - a*d)*n*log(c + d*x))/(b*d*f) + (B*g*n*log((f*(a + b*x))/(a*f - b*g))*log(g + f*x))/f^2 - (g*(A + B*log(e*((a + b*x)/(c + d*x))^n))*log(g + f*x))/f^2 - (B*g*n*log((f*(c + d*x))/(c*f - d*g))*log(g + f*x))/f^2 + (B*g*n*PolyLog(2, -((b*(g + f*x))/(a*f - b*g))))/f^2 - (B*g*n*PolyLog(2, -((d*(g + f*x))/(c*f - d*g))))/f^2]
    @test_int [(A + B*log(e*((a + b*x)/(c + d*x))^n))/(f + g/x)^2, x, 15, (A*x)/f^2 + (B*(a + b*x)*log(e*((a + b*x)/(c + d*x))^n))/(b*f^2) - (g^2*(a + b*x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)))/(f^2*(a*f - b*g)*(g + f*x)) - (B*(b*c - a*d)*n*log(c + d*x))/(b*d*f^2) + (2*B*g*n*log((f*(a + b*x))/(a*f - b*g))*log(g + f*x))/f^3 - (2*g*(A + B*log(e*((a + b*x)/(c + d*x))^n))*log(g + f*x))/f^3 - (2*B*g*n*log((f*(c + d*x))/(c*f - d*g))*log(g + f*x))/f^3 + (B*(b*c - a*d)*g^2*n*log((g + f*x)/(c + d*x)))/(f^2*(a*f - b*g)*(c*f - d*g)) + (2*B*g*n*PolyLog(2, -((b*(g + f*x))/(a*f - b*g))))/f^3 - (2*B*g*n*PolyLog(2, -((d*(g + f*x))/(c*f - d*g))))/f^3]
    @test_int [(A + B*log(e*((a + b*x)/(c + d*x))^n))/(f + g/x)^3, x, 18, (A*x)/f^3 + (B*(b*c - a*d)*g^3*n)/(2*f^3*(a*f - b*g)*(c*f - d*g)*(g + f*x)) - (b^2*B*g^3*n*log(a + b*x))/(2*f^4*(a*f - b*g)^2) + (B*(a + b*x)*log(e*((a + b*x)/(c + d*x))^n))/(b*f^3) + (g^3*(A + B*log(e*((a + b*x)/(c + d*x))^n)))/(2*f^4*(g + f*x)^2) - (3*g^2*(a + b*x)*(A + B*log(e*((a + b*x)/(c + d*x))^n)))/(f^3*(a*f - b*g)*(g + f*x)) - (B*(b*c - a*d)*n*log(c + d*x))/(b*d*f^3) + (B*d^2*g^3*n*log(c + d*x))/(2*f^4*(c*f - d*g)^2) + (B*(b*c - a*d)*g^3*(b*c*f + a*d*f - 2*b*d*g)*n*log(g + f*x))/(2*f^3*(a*f - b*g)^2*(c*f - d*g)^2) + (3*B*g*n*log((f*(a + b*x))/(a*f - b*g))*log(g + f*x))/f^4 - (3*g*(A + B*log(e*((a + b*x)/(c + d*x))^n))*log(g + f*x))/f^4 - (3*B*g*n*log((f*(c + d*x))/(c*f - d*g))*log(g + f*x))/f^4 + (3*B*(b*c - a*d)*g^2*n*log((g + f*x)/(c + d*x)))/(f^3*(a*f - b*g)*(c*f - d*g)) + (3*B*g*n*PolyLog(2, -((b*(g + f*x))/(a*f - b*g))))/f^4 - (3*B*g*n*PolyLog(2, -((d*(g + f*x))/(c*f - d*g))))/f^4]

    #= ::Title:: =#
    #=Integrands*of*the*form*u*(A+B*log(e*(f*(a+b*x)^s*(c+d*x)^t)^n))^p=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(g+h*x)^m*(A+B*log(e*(f*(a+b*x)^s*(c+d*x)^t)^n))^p=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(g+h*x)^m*(A+B*log(e*(f*(a+b*x)^s*(c+d*x)^t)^n))^p*when*b*g-a*h=0=#

    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(a + b*x)^4, x, 4, -(((b*c - a*d)^4*q*r*x)/(5*d^4)) + ((b*c - a*d)^3*q*r*(a + b*x)^2)/(10*b*d^3) - ((b*c - a*d)^2*q*r*(a + b*x)^3)/(15*b*d^2) + ((b*c - a*d)*q*r*(a + b*x)^4)/(20*b*d) - (p*r*(a + b*x)^5)/(25*b) - (q*r*(a + b*x)^5)/(25*b) + ((b*c - a*d)^5*q*r*log(c + d*x))/(5*b*d^5) + ((a + b*x)^5*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(5*b)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(a + b*x)^3, x, 4, ((b*c - a*d)^3*q*r*x)/(4*d^3) - ((b*c - a*d)^2*q*r*(a + b*x)^2)/(8*b*d^2) + ((b*c - a*d)*q*r*(a + b*x)^3)/(12*b*d) - (p*r*(a + b*x)^4)/(16*b) - (q*r*(a + b*x)^4)/(16*b) - ((b*c - a*d)^4*q*r*log(c + d*x))/(4*b*d^4) + ((a + b*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(4*b)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(a + b*x)^2, x, 4, -(((b*c - a*d)^2*q*r*x)/(3*d^2)) + ((b*c - a*d)*q*r*(a + b*x)^2)/(6*b*d) - (p*r*(a + b*x)^3)/(9*b) - (q*r*(a + b*x)^3)/(9*b) + ((b*c - a*d)^3*q*r*log(c + d*x))/(3*b*d^3) + ((a + b*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(a + b*x)^1, x, 4, (-(1/2))*a*p*r*x + ((b*c - a*d)*q*r*x)/(2*d) - (1/4)*b*p*r*x^2 - (q*r*(a + b*x)^2)/(4*b) - ((b*c - a*d)^2*q*r*log(c + d*x))/(2*b*d^2) + ((a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(a + b*x)^1, x, 6, -((p*r*log(a + b*x)^2)/(2*b)) - (q*r*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/b + (log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/b - (q*r*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/b]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(a + b*x)^2, x, 5, -((p*r)/(b*(a + b*x))) + (d*q*r*log(a + b*x))/(b*(b*c - a*d)) - (d*q*r*log(c + d*x))/(b*(b*c - a*d)) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(b*(a + b*x))]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(a + b*x)^3, x, 4, -((p*r)/(4*b*(a + b*x)^2)) - (d*q*r)/(2*b*(b*c - a*d)*(a + b*x)) - (d^2*q*r*log(a + b*x))/(2*b*(b*c - a*d)^2) + (d^2*q*r*log(c + d*x))/(2*b*(b*c - a*d)^2) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(2*b*(a + b*x)^2)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(a + b*x)^4, x, 4, -((p*r)/(9*b*(a + b*x)^3)) - (d*q*r)/(6*b*(b*c - a*d)*(a + b*x)^2) + (d^2*q*r)/(3*b*(b*c - a*d)^2*(a + b*x)) + (d^3*q*r*log(a + b*x))/(3*b*(b*c - a*d)^3) - (d^3*q*r*log(c + d*x))/(3*b*(b*c - a*d)^3) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(3*b*(a + b*x)^3)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(a + b*x)^5, x, 4, -((p*r)/(16*b*(a + b*x)^4)) - (d*q*r)/(12*b*(b*c - a*d)*(a + b*x)^3) + (d^2*q*r)/(8*b*(b*c - a*d)^2*(a + b*x)^2) - (d^3*q*r)/(4*b*(b*c - a*d)^3*(a + b*x)) - (d^4*q*r*log(a + b*x))/(4*b*(b*c - a*d)^4) + (d^4*q*r*log(c + d*x))/(4*b*(b*c - a*d)^4) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(4*b*(a + b*x)^4)]

    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(a + b*x)^4, x, 32, -((a*(b*c - a*d)^3*p*q*r^2*x)/(5*d^3)) + (2*(b*c - a*d)^4*p*q*r^2*x)/(25*d^4) + (77*(b*c - a*d)^4*q^2*r^2*x)/(150*d^4) + (2*(b*c - a*d)^4*q*(p + q)*r^2*x)/(5*d^4) - (b*(b*c - a*d)^3*p*q*r^2*x^2)/(10*d^3) - ((b*c - a*d)^3*p*q*r^2*(a + b*x)^2)/(25*b*d^3) - (77*(b*c - a*d)^3*q^2*r^2*(a + b*x)^2)/(300*b*d^3) + (16*(b*c - a*d)^2*p*q*r^2*(a + b*x)^3)/(225*b*d^2) + (47*(b*c - a*d)^2*q^2*r^2*(a + b*x)^3)/(450*b*d^2) - (9*(b*c - a*d)*p*q*r^2*(a + b*x)^4)/(200*b*d) - (9*(b*c - a*d)*q^2*r^2*(a + b*x)^4)/(200*b*d) + (2*p^2*r^2*(a + b*x)^5)/(125*b) + (4*p*q*r^2*(a + b*x)^5)/(125*b) + (2*q^2*r^2*(a + b*x)^5)/(125*b) - (2*(b*c - a*d)^5*p*q*r^2*log(c + d*x))/(25*b*d^5) - (137*(b*c - a*d)^5*q^2*r^2*log(c + d*x))/(150*b*d^5) - (2*(b*c - a*d)^5*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(5*b*d^5) - ((b*c - a*d)^5*q^2*r^2*log(c + d*x)^2)/(5*b*d^5) - (2*(b*c - a*d)^4*q*r*(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(5*b*d^4) + ((b*c - a*d)^3*q*r*(a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(5*b*d^3) - (2*(b*c - a*d)^2*q*r*(a + b*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(15*b*d^2) + ((b*c - a*d)*q*r*(a + b*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(10*b*d) - (2*p*r*(a + b*x)^5*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(25*b) - (2*q*r*(a + b*x)^5*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(25*b) + (2*(b*c - a*d)^5*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(5*b*d^5) + ((a + b*x)^5*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(5*b) - (2*(b*c - a*d)^5*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(5*b*d^5)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(a + b*x)^3, x, 28, (a*(b*c - a*d)^2*p*q*r^2*x)/(4*d^2) - ((b*c - a*d)^3*p*q*r^2*x)/(8*d^3) - (13*(b*c - a*d)^3*q^2*r^2*x)/(24*d^3) - ((b*c - a*d)^3*q*(p + q)*r^2*x)/(2*d^3) + (b*(b*c - a*d)^2*p*q*r^2*x^2)/(8*d^2) + ((b*c - a*d)^2*p*q*r^2*(a + b*x)^2)/(16*b*d^2) + (13*(b*c - a*d)^2*q^2*r^2*(a + b*x)^2)/(48*b*d^2) - (7*(b*c - a*d)*p*q*r^2*(a + b*x)^3)/(72*b*d) - (7*(b*c - a*d)*q^2*r^2*(a + b*x)^3)/(72*b*d) + (p^2*r^2*(a + b*x)^4)/(32*b) + (p*q*r^2*(a + b*x)^4)/(16*b) + (q^2*r^2*(a + b*x)^4)/(32*b) + ((b*c - a*d)^4*p*q*r^2*log(c + d*x))/(8*b*d^4) + (25*(b*c - a*d)^4*q^2*r^2*log(c + d*x))/(24*b*d^4) + ((b*c - a*d)^4*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(2*b*d^4) + ((b*c - a*d)^4*q^2*r^2*log(c + d*x)^2)/(4*b*d^4) + ((b*c - a*d)^3*q*r*(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b*d^3) - ((b*c - a*d)^2*q*r*(a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(4*b*d^2) + ((b*c - a*d)*q*r*(a + b*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(6*b*d) - (p*r*(a + b*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(8*b) - (q*r*(a + b*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(8*b) - ((b*c - a*d)^4*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b*d^4) + ((a + b*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(4*b) + ((b*c - a*d)^4*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(2*b*d^4)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(a + b*x)^2, x, 24, -((a*(b*c - a*d)*p*q*r^2*x)/(3*d)) + (2*(b*c - a*d)^2*p*q*r^2*x)/(9*d^2) + (5*(b*c - a*d)^2*q^2*r^2*x)/(9*d^2) + (2*(b*c - a*d)^2*q*(p + q)*r^2*x)/(3*d^2) - (b*(b*c - a*d)*p*q*r^2*x^2)/(6*d) - ((b*c - a*d)*p*q*r^2*(a + b*x)^2)/(9*b*d) - (5*(b*c - a*d)*q^2*r^2*(a + b*x)^2)/(18*b*d) + (2*p^2*r^2*(a + b*x)^3)/(27*b) + (4*p*q*r^2*(a + b*x)^3)/(27*b) + (2*q^2*r^2*(a + b*x)^3)/(27*b) - (2*(b*c - a*d)^3*p*q*r^2*log(c + d*x))/(9*b*d^3) - (11*(b*c - a*d)^3*q^2*r^2*log(c + d*x))/(9*b*d^3) - (2*(b*c - a*d)^3*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(3*b*d^3) - ((b*c - a*d)^3*q^2*r^2*log(c + d*x)^2)/(3*b*d^3) - (2*(b*c - a*d)^2*q*r*(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*d^2) + ((b*c - a*d)*q*r*(a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*d) - (2*p*r*(a + b*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(9*b) - (2*q*r*(a + b*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(9*b) + (2*(b*c - a*d)^3*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*d^3) + ((a + b*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(3*b) - (2*(b*c - a*d)^3*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(3*b*d^3)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(a + b*x)^1, x, 20, (1/2)*a*p^2*r^2*x + (1/2)*a*p*q*r^2*x - ((b*c - a*d)*p*q*r^2*x)/(2*d) - ((b*c - a*d)*q^2*r^2*x)/(2*d) - ((b*c - a*d)*q*(p + q)*r^2*x)/d + (1/4)*b*p^2*r^2*x^2 + (1/4)*b*p*q*r^2*x^2 + (p*q*r^2*(a + b*x)^2)/(4*b) + (q^2*r^2*(a + b*x)^2)/(4*b) + ((b*c - a*d)^2*p*q*r^2*log(c + d*x))/(2*b*d^2) + (3*(b*c - a*d)^2*q^2*r^2*log(c + d*x))/(2*b*d^2) + ((b*c - a*d)^2*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(b*d^2) + ((b*c - a*d)^2*q^2*r^2*log(c + d*x)^2)/(2*b*d^2) + ((b*c - a*d)*q*r*(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*d) - (p*r*(a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b) - (q*r*(a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b) - ((b*c - a*d)^2*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*d^2) + ((a + b*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(2*b) + ((b*c - a*d)^2*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(b*d^2)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(a + b*x)^1, x, 19, log((a + b*x)^(p*r))^3/(3*b*p*r) - (q*log((a + b*x)^(p*r))^2*log((b*(c + d*x))/(b*c - a*d)))/(b*p) + (log((a + b*x)^(p*r))^2*log((c + d*x)^(q*r)))/(b*p*r) + (log(-((d*(a + b*x))/(b*c - a*d)))*log((c + d*x)^(q*r))^2)/b - (2*q*r*log((a + b*x)^(p*r))*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/b + (2*q*r*log((c + d*x)^(q*r))*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/b - (1/4)*(log((a + b*x)^(p*r)) + log((c + d*x)^(q*r)) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*((log((a + b*x)^(p*r)) - log((c + d*x)^(q*r)) + log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))^2/(b*p*r) + 8*((log(-((d*(a + b*x))/(b*c - a*d)))*log((c + d*x)^(q*r)))/b + (q*r*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/b)) + (2*p*q*r^2*PolyLog(3, -((d*(a + b*x))/(b*c - a*d))))/b - (2*q^2*r^2*PolyLog(3, (b*(c + d*x))/(b*c - a*d)))/b]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(a + b*x)^2, x, 20, -((2*p^2*r^2)/(b*(a + b*x))) + (2*d*p*q*r^2*log(a + b*x))/(b*(b*c - a*d)) - (d*p*q*r^2*log(a + b*x)^2)/(b*(b*c - a*d)) - (2*d*p*q*r^2*log(c + d*x))/(b*(b*c - a*d)) + (2*d*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(b*(b*c - a*d)) + (d*q^2*r^2*log(c + d*x)^2)/(b*(b*c - a*d)) - (2*d*q^2*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(b*(b*c - a*d)) - (2*p*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*(a + b*x)) + (2*d*q*r*log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*(b*c - a*d)) - (2*d*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*(b*c - a*d)) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(b*(a + b*x)) - (2*d*q^2*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(b*(b*c - a*d)) + (2*d*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(b*(b*c - a*d))]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(a + b*x)^3, x, 24, -((p^2*r^2)/(4*b*(a + b*x)^2)) - (3*d*p*q*r^2)/(2*b*(b*c - a*d)*(a + b*x)) - (d^2*p*q*r^2*log(a + b*x))/(2*b*(b*c - a*d)^2) + (d^2*q^2*r^2*log(a + b*x))/(b*(b*c - a*d)^2) + (d^2*p*q*r^2*log(a + b*x)^2)/(2*b*(b*c - a*d)^2) + (d^2*p*q*r^2*log(c + d*x))/(2*b*(b*c - a*d)^2) - (d^2*q^2*r^2*log(c + d*x))/(b*(b*c - a*d)^2) - (d^2*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(b*(b*c - a*d)^2) - (d^2*q^2*r^2*log(c + d*x)^2)/(2*b*(b*c - a*d)^2) + (d^2*q^2*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(b*(b*c - a*d)^2) - (p*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b*(a + b*x)^2) - (d*q*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*(b*c - a*d)*(a + b*x)) - (d^2*q*r*log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*(b*c - a*d)^2) + (d^2*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*(b*c - a*d)^2) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(2*b*(a + b*x)^2) + (d^2*q^2*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(b*(b*c - a*d)^2) - (d^2*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(b*(b*c - a*d)^2)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(a + b*x)^4, x, 28, -((2*p^2*r^2)/(27*b*(a + b*x)^3)) - (5*d*p*q*r^2)/(18*b*(b*c - a*d)*(a + b*x)^2) + (8*d^2*p*q*r^2)/(9*b*(b*c - a*d)^2*(a + b*x)) - (d^2*q^2*r^2)/(3*b*(b*c - a*d)^2*(a + b*x)) + (2*d^3*p*q*r^2*log(a + b*x))/(9*b*(b*c - a*d)^3) - (d^3*q^2*r^2*log(a + b*x))/(b*(b*c - a*d)^3) - (d^3*p*q*r^2*log(a + b*x)^2)/(3*b*(b*c - a*d)^3) - (2*d^3*p*q*r^2*log(c + d*x))/(9*b*(b*c - a*d)^3) + (d^3*q^2*r^2*log(c + d*x))/(b*(b*c - a*d)^3) + (2*d^3*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(3*b*(b*c - a*d)^3) + (d^3*q^2*r^2*log(c + d*x)^2)/(3*b*(b*c - a*d)^3) - (2*d^3*q^2*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(3*b*(b*c - a*d)^3) - (2*p*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(9*b*(a + b*x)^3) - (d*q*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*(b*c - a*d)*(a + b*x)^2) + (2*d^2*q*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*(b*c - a*d)^2*(a + b*x)) + (2*d^3*q*r*log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*(b*c - a*d)^3) - (2*d^3*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*b*(b*c - a*d)^3) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(3*b*(a + b*x)^3) - (2*d^3*q^2*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(3*b*(b*c - a*d)^3) + (2*d^3*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(3*b*(b*c - a*d)^3)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(a + b*x)^5, x, 32, -((p^2*r^2)/(32*b*(a + b*x)^4)) - (7*d*p*q*r^2)/(72*b*(b*c - a*d)*(a + b*x)^3) + (3*d^2*p*q*r^2)/(16*b*(b*c - a*d)^2*(a + b*x)^2) - (d^2*q^2*r^2)/(12*b*(b*c - a*d)^2*(a + b*x)^2) - (5*d^3*p*q*r^2)/(8*b*(b*c - a*d)^3*(a + b*x)) + (5*d^3*q^2*r^2)/(12*b*(b*c - a*d)^3*(a + b*x)) - (d^4*p*q*r^2*log(a + b*x))/(8*b*(b*c - a*d)^4) + (11*d^4*q^2*r^2*log(a + b*x))/(12*b*(b*c - a*d)^4) + (d^4*p*q*r^2*log(a + b*x)^2)/(4*b*(b*c - a*d)^4) + (d^4*p*q*r^2*log(c + d*x))/(8*b*(b*c - a*d)^4) - (11*d^4*q^2*r^2*log(c + d*x))/(12*b*(b*c - a*d)^4) - (d^4*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(2*b*(b*c - a*d)^4) - (d^4*q^2*r^2*log(c + d*x)^2)/(4*b*(b*c - a*d)^4) + (d^4*q^2*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(2*b*(b*c - a*d)^4) - (p*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(8*b*(a + b*x)^4) - (d*q*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(6*b*(b*c - a*d)*(a + b*x)^3) + (d^2*q*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(4*b*(b*c - a*d)^2*(a + b*x)^2) - (d^3*q*r*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b*(b*c - a*d)^3*(a + b*x)) - (d^4*q*r*log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b*(b*c - a*d)^4) + (d^4*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*b*(b*c - a*d)^4) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(4*b*(a + b*x)^4) + (d^4*q^2*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(2*b*(b*c - a*d)^4) - (d^4*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(2*b*(b*c - a*d)^4)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(g+h*x)^m*(A+B*log(e*(f*(a+b*x)^s*(c+d*x)^t)^n))^p=#

    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(g + h*x)^4, x, 5, -(((b*g - a*h)^4*p*r*x)/(5*b^4)) - ((d*g - c*h)^4*q*r*x)/(5*d^4) - ((b*g - a*h)^3*p*r*(g + h*x)^2)/(10*b^3*h) - ((d*g - c*h)^3*q*r*(g + h*x)^2)/(10*d^3*h) - ((b*g - a*h)^2*p*r*(g + h*x)^3)/(15*b^2*h) - ((d*g - c*h)^2*q*r*(g + h*x)^3)/(15*d^2*h) - ((b*g - a*h)*p*r*(g + h*x)^4)/(20*b*h) - ((d*g - c*h)*q*r*(g + h*x)^4)/(20*d*h) - (p*r*(g + h*x)^5)/(25*h) - (q*r*(g + h*x)^5)/(25*h) - ((b*g - a*h)^5*p*r*log(a + b*x))/(5*b^5*h) - ((d*g - c*h)^5*q*r*log(c + d*x))/(5*d^5*h) + ((g + h*x)^5*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(5*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(g + h*x)^3, x, 5, -(((b*g - a*h)^3*p*r*x)/(4*b^3)) - ((d*g - c*h)^3*q*r*x)/(4*d^3) - ((b*g - a*h)^2*p*r*(g + h*x)^2)/(8*b^2*h) - ((d*g - c*h)^2*q*r*(g + h*x)^2)/(8*d^2*h) - ((b*g - a*h)*p*r*(g + h*x)^3)/(12*b*h) - ((d*g - c*h)*q*r*(g + h*x)^3)/(12*d*h) - (p*r*(g + h*x)^4)/(16*h) - (q*r*(g + h*x)^4)/(16*h) - ((b*g - a*h)^4*p*r*log(a + b*x))/(4*b^4*h) - ((d*g - c*h)^4*q*r*log(c + d*x))/(4*d^4*h) + ((g + h*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(4*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(g + h*x)^2, x, 5, -(((b*g - a*h)^2*p*r*x)/(3*b^2)) - ((d*g - c*h)^2*q*r*x)/(3*d^2) - ((b*g - a*h)*p*r*(g + h*x)^2)/(6*b*h) - ((d*g - c*h)*q*r*(g + h*x)^2)/(6*d*h) - (p*r*(g + h*x)^3)/(9*h) - (q*r*(g + h*x)^3)/(9*h) - ((b*g - a*h)^3*p*r*log(a + b*x))/(3*b^3*h) - ((d*g - c*h)^3*q*r*log(c + d*x))/(3*d^3*h) + ((g + h*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(g + h*x)^1, x, 5, -(((b*g - a*h)*p*r*x)/(2*b)) - ((d*g - c*h)*q*r*x)/(2*d) - (p*r*(g + h*x)^2)/(4*h) - (q*r*(g + h*x)^2)/(4*h) - ((b*g - a*h)^2*p*r*log(a + b*x))/(2*b^2*h) - ((d*g - c*h)^2*q*r*log(c + d*x))/(2*d^2*h) + ((g + h*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(g + h*x)^0, x, 3, -((p + q)*r*x) + ((b*c - a*d)*q*r*log(c + d*x))/(b*d) + ((a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/b]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(g + h*x)^1, x, 7, -((p*r*log(-((h*(a + b*x))/(b*g - a*h)))*log(g + h*x))/h) - (q*r*log(-((h*(c + d*x))/(d*g - c*h)))*log(g + h*x))/h + (log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*log(g + h*x))/h - (p*r*PolyLog(2, (b*(g + h*x))/(b*g - a*h)))/h - (q*r*PolyLog(2, (d*(g + h*x))/(d*g - c*h)))/h]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(g + h*x)^2, x, 7, (b*p*r*log(a + b*x))/(h*(b*g - a*h)) + (d*q*r*log(c + d*x))/(h*(d*g - c*h)) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(h*(g + h*x)) - (b*p*r*log(g + h*x))/(h*(b*g - a*h)) - (d*q*r*log(g + h*x))/(h*(d*g - c*h))]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(g + h*x)^3, x, 5, (b*p*r)/(2*h*(b*g - a*h)*(g + h*x)) + (d*q*r)/(2*h*(d*g - c*h)*(g + h*x)) + (b^2*p*r*log(a + b*x))/(2*h*(b*g - a*h)^2) + (d^2*q*r*log(c + d*x))/(2*h*(d*g - c*h)^2) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(2*h*(g + h*x)^2) - (b^2*p*r*log(g + h*x))/(2*h*(b*g - a*h)^2) - (d^2*q*r*log(g + h*x))/(2*h*(d*g - c*h)^2)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(g + h*x)^4, x, 5, (b*p*r)/(6*h*(b*g - a*h)*(g + h*x)^2) + (d*q*r)/(6*h*(d*g - c*h)*(g + h*x)^2) + (b^2*p*r)/(3*h*(b*g - a*h)^2*(g + h*x)) + (d^2*q*r)/(3*h*(d*g - c*h)^2*(g + h*x)) + (b^3*p*r*log(a + b*x))/(3*h*(b*g - a*h)^3) + (d^3*q*r*log(c + d*x))/(3*h*(d*g - c*h)^3) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(3*h*(g + h*x)^3) - (b^3*p*r*log(g + h*x))/(3*h*(b*g - a*h)^3) - (d^3*q*r*log(g + h*x))/(3*h*(d*g - c*h)^3)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(g + h*x)^5, x, 5, (b*p*r)/(12*h*(b*g - a*h)*(g + h*x)^3) + (d*q*r)/(12*h*(d*g - c*h)*(g + h*x)^3) + (b^2*p*r)/(8*h*(b*g - a*h)^2*(g + h*x)^2) + (d^2*q*r)/(8*h*(d*g - c*h)^2*(g + h*x)^2) + (b^3*p*r)/(4*h*(b*g - a*h)^3*(g + h*x)) + (d^3*q*r)/(4*h*(d*g - c*h)^3*(g + h*x)) + (b^4*p*r*log(a + b*x))/(4*h*(b*g - a*h)^4) + (d^4*q*r*log(c + d*x))/(4*h*(d*g - c*h)^4) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(4*h*(g + h*x)^4) - (b^4*p*r*log(g + h*x))/(4*h*(b*g - a*h)^4) - (d^4*q*r*log(g + h*x))/(4*h*(d*g - c*h)^4)]

    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(g + h*x)^3, x, 53, (2*(b*g - a*h)^3*p^2*r^2*x)/b^3 + (5*(b*g - a*h)^3*p*q*r^2*x)/(8*b^3) + (5*(b*g - a*h)^2*(d*g - c*h)*p*q*r^2*x)/(12*b^2*d) + (5*(b*g - a*h)*(d*g - c*h)^2*p*q*r^2*x)/(12*b*d^2) + (5*(d*g - c*h)^3*p*q*r^2*x)/(8*d^3) + (2*(d*g - c*h)^3*q^2*r^2*x)/d^3 + (3*h*(b*g - a*h)^2*p^2*r^2*(a + b*x)^2)/(4*b^4) + (2*h^2*(b*g - a*h)*p^2*r^2*(a + b*x)^3)/(9*b^4) + (h^3*p^2*r^2*(a + b*x)^4)/(32*b^4) + (3*h*(d*g - c*h)^2*q^2*r^2*(c + d*x)^2)/(4*d^4) + (2*h^2*(d*g - c*h)*q^2*r^2*(c + d*x)^3)/(9*d^4) + (h^3*q^2*r^2*(c + d*x)^4)/(32*d^4) + (3*(b*g - a*h)^2*p*q*r^2*(g + h*x)^2)/(16*b^2*h) + ((b*g - a*h)*(d*g - c*h)*p*q*r^2*(g + h*x)^2)/(6*b*d*h) + (3*(d*g - c*h)^2*p*q*r^2*(g + h*x)^2)/(16*d^2*h) + (7*(b*g - a*h)*p*q*r^2*(g + h*x)^3)/(72*b*h) + (7*(d*g - c*h)*p*q*r^2*(g + h*x)^3)/(72*d*h) + (p*q*r^2*(g + h*x)^4)/(16*h) + ((b*g - a*h)^4*p*q*r^2*log(a + b*x))/(8*b^4*h) + ((b*g - a*h)^3*(d*g - c*h)*p*q*r^2*log(a + b*x))/(6*b^3*d*h) + ((b*g - a*h)^2*(d*g - c*h)^2*p*q*r^2*log(a + b*x))/(4*b^2*d^2*h) - (2*(b*g - a*h)^3*p^2*r^2*(a + b*x)*log(a + b*x))/b^4 - ((d*g - c*h)^3*p*q*r^2*(a + b*x)*log(a + b*x))/(2*b*d^3) - (3*h*(b*g - a*h)^2*p^2*r^2*(a + b*x)^2*log(a + b*x))/(2*b^4) - (2*h^2*(b*g - a*h)*p^2*r^2*(a + b*x)^3*log(a + b*x))/(3*b^4) - (h^3*p^2*r^2*(a + b*x)^4*log(a + b*x))/(8*b^4) - ((d*g - c*h)^2*p*q*r^2*(g + h*x)^2*log(a + b*x))/(4*d^2*h) - ((d*g - c*h)*p*q*r^2*(g + h*x)^3*log(a + b*x))/(6*d*h) - (p*q*r^2*(g + h*x)^4*log(a + b*x))/(8*h) - ((b*g - a*h)^4*p^2*r^2*log(a + b*x)^2)/(4*b^4*h) + ((b*g - a*h)^2*(d*g - c*h)^2*p*q*r^2*log(c + d*x))/(4*b^2*d^2*h) + ((b*g - a*h)*(d*g - c*h)^3*p*q*r^2*log(c + d*x))/(6*b*d^3*h) + ((d*g - c*h)^4*p*q*r^2*log(c + d*x))/(8*d^4*h) - ((b*g - a*h)^3*p*q*r^2*(c + d*x)*log(c + d*x))/(2*b^3*d) - (2*(d*g - c*h)^3*q^2*r^2*(c + d*x)*log(c + d*x))/d^4 - (3*h*(d*g - c*h)^2*q^2*r^2*(c + d*x)^2*log(c + d*x))/(2*d^4) - (2*h^2*(d*g - c*h)*q^2*r^2*(c + d*x)^3*log(c + d*x))/(3*d^4) - (h^3*q^2*r^2*(c + d*x)^4*log(c + d*x))/(8*d^4) - ((b*g - a*h)^2*p*q*r^2*(g + h*x)^2*log(c + d*x))/(4*b^2*h) - ((b*g - a*h)*p*q*r^2*(g + h*x)^3*log(c + d*x))/(6*b*h) - (p*q*r^2*(g + h*x)^4*log(c + d*x))/(8*h) - ((b*g - a*h)^4*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(2*b^4*h) - ((d*g - c*h)^4*q^2*r^2*log(c + d*x)^2)/(4*d^4*h) - ((d*g - c*h)^4*p*q*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(2*d^4*h) + ((b*g - a*h)^3*p*r*x*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(2*b^3) + ((d*g - c*h)^3*q*r*x*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(2*d^3) + ((b*g - a*h)^2*p*r*(g + h*x)^2*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(4*b^2*h) + ((d*g - c*h)^2*q*r*(g + h*x)^2*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(4*d^2*h) + ((b*g - a*h)*p*r*(g + h*x)^3*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(6*b*h) + ((d*g - c*h)*q*r*(g + h*x)^3*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(6*d*h) + (p*r*(g + h*x)^4*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(8*h) + (q*r*(g + h*x)^4*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(8*h) + ((b*g - a*h)^4*p*r*log(a + b*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(2*b^4*h) + ((d*g - c*h)^4*q*r*log(c + d*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(2*d^4*h) + ((g + h*x)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(4*h) - ((d*g - c*h)^4*p*q*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(2*d^4*h) - ((b*g - a*h)^4*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(2*b^4*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(g + h*x)^2, x, 47, (2*(b*g - a*h)^2*p^2*r^2*x)/b^2 + (8*(b*g - a*h)^2*p*q*r^2*x)/(9*b^2) + (2*(b*g - a*h)*(d*g - c*h)*p*q*r^2*x)/(3*b*d) + (8*(d*g - c*h)^2*p*q*r^2*x)/(9*d^2) + (2*(d*g - c*h)^2*q^2*r^2*x)/d^2 + (h*(b*g - a*h)*p^2*r^2*(a + b*x)^2)/(2*b^3) + (2*h^2*p^2*r^2*(a + b*x)^3)/(27*b^3) + (h*(d*g - c*h)*q^2*r^2*(c + d*x)^2)/(2*d^3) + (2*h^2*q^2*r^2*(c + d*x)^3)/(27*d^3) + (5*(b*g - a*h)*p*q*r^2*(g + h*x)^2)/(18*b*h) + (5*(d*g - c*h)*p*q*r^2*(g + h*x)^2)/(18*d*h) + (4*p*q*r^2*(g + h*x)^3)/(27*h) + (2*(b*g - a*h)^3*p*q*r^2*log(a + b*x))/(9*b^3*h) + ((b*g - a*h)^2*(d*g - c*h)*p*q*r^2*log(a + b*x))/(3*b^2*d*h) - (2*(b*g - a*h)^2*p^2*r^2*(a + b*x)*log(a + b*x))/b^3 - (2*(d*g - c*h)^2*p*q*r^2*(a + b*x)*log(a + b*x))/(3*b*d^2) - (h*(b*g - a*h)*p^2*r^2*(a + b*x)^2*log(a + b*x))/b^3 - (2*h^2*p^2*r^2*(a + b*x)^3*log(a + b*x))/(9*b^3) - ((d*g - c*h)*p*q*r^2*(g + h*x)^2*log(a + b*x))/(3*d*h) - (2*p*q*r^2*(g + h*x)^3*log(a + b*x))/(9*h) - ((b*g - a*h)^3*p^2*r^2*log(a + b*x)^2)/(3*b^3*h) + ((b*g - a*h)*(d*g - c*h)^2*p*q*r^2*log(c + d*x))/(3*b*d^2*h) + (2*(d*g - c*h)^3*p*q*r^2*log(c + d*x))/(9*d^3*h) - (2*(b*g - a*h)^2*p*q*r^2*(c + d*x)*log(c + d*x))/(3*b^2*d) - (2*(d*g - c*h)^2*q^2*r^2*(c + d*x)*log(c + d*x))/d^3 - (h*(d*g - c*h)*q^2*r^2*(c + d*x)^2*log(c + d*x))/d^3 - (2*h^2*q^2*r^2*(c + d*x)^3*log(c + d*x))/(9*d^3) - ((b*g - a*h)*p*q*r^2*(g + h*x)^2*log(c + d*x))/(3*b*h) - (2*p*q*r^2*(g + h*x)^3*log(c + d*x))/(9*h) - (2*(b*g - a*h)^3*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(3*b^3*h) - ((d*g - c*h)^3*q^2*r^2*log(c + d*x)^2)/(3*d^3*h) - (2*(d*g - c*h)^3*p*q*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(3*d^3*h) + (2*(b*g - a*h)^2*p*r*x*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*b^2) + (2*(d*g - c*h)^2*q*r*x*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*d^2) + ((b*g - a*h)*p*r*(g + h*x)^2*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*b*h) + ((d*g - c*h)*q*r*(g + h*x)^2*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*d*h) + (2*p*r*(g + h*x)^3*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(9*h) + (2*q*r*(g + h*x)^3*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(9*h) + (2*(b*g - a*h)^3*p*r*log(a + b*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*b^3*h) + (2*(d*g - c*h)^3*q*r*log(c + d*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*d^3*h) + ((g + h*x)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(3*h) - (2*(d*g - c*h)^3*p*q*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(3*d^3*h) - (2*(b*g - a*h)^3*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(3*b^3*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(g + h*x)^1, x, 39, (3*(b*g - a*h)*p*q*r^2*x)/(2*b) + (3*(d*g - c*h)*p*q*r^2*x)/(2*d) + (p*q*r^2*(g + h*x)^2)/(2*h) + (p^2*r^2*(4*b*g - 3*a*h + b*h*x)^2)/(4*b^2*h) + (q^2*r^2*(4*d*g - 3*c*h + d*h*x)^2)/(4*d^2*h) + ((b*g - a*h)^2*p*q*r^2*log(a + b*x))/(2*b^2*h) - (2*(b*g - a*h)*p^2*r^2*(a + b*x)*log(a + b*x))/b^2 - ((d*g - c*h)*p*q*r^2*(a + b*x)*log(a + b*x))/(b*d) - (h*p^2*r^2*(a + b*x)^2*log(a + b*x))/(2*b^2) - (p*q*r^2*(g + h*x)^2*log(a + b*x))/(2*h) - ((b*g - a*h)^2*p^2*r^2*log(a + b*x)^2)/(2*b^2*h) + ((d*g - c*h)^2*p*q*r^2*log(c + d*x))/(2*d^2*h) - ((b*g - a*h)*p*q*r^2*(c + d*x)*log(c + d*x))/(b*d) - (2*(d*g - c*h)*q^2*r^2*(c + d*x)*log(c + d*x))/d^2 - (h*q^2*r^2*(c + d*x)^2*log(c + d*x))/(2*d^2) - (p*q*r^2*(g + h*x)^2*log(c + d*x))/(2*h) - ((b*g - a*h)^2*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(b^2*h) - ((d*g - c*h)^2*q^2*r^2*log(c + d*x)^2)/(2*d^2*h) - ((d*g - c*h)^2*p*q*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(d^2*h) + ((b*g - a*h)*p*r*x*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/b + ((d*g - c*h)*q*r*x*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/d + (p*r*(g + h*x)^2*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(2*h) + (q*r*(g + h*x)^2*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(2*h) + ((b*g - a*h)^2*p*r*log(a + b*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(b^2*h) + ((d*g - c*h)^2*q*r*log(c + d*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(d^2*h) + ((g + h*x)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/(2*h) - ((d*g - c*h)^2*p*q*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(d^2*h) - ((b*g - a*h)^2*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(b^2*h)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*(g + h*x)^0, x, 10, 2*(p + q)^2*r^2*x - (2*(b*c - a*d)*q*(p + q)*r^2*log(c + d*x))/(b*d) - (2*(b*c - a*d)*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(b*d) - ((b*c - a*d)*q^2*r^2*log(c + d*x)^2)/(b*d) - (2*(p + q)*r*(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/b + (2*(b*c - a*d)*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(b*d) + ((a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2)/b - (2*(b*c - a*d)*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(b*d)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(g + h*x)^1, x, -29, (p*q*r^2*log(-((b*c - a*d)/(d*(a + b*x))))*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))^2)/h + (p^2*r^2*log(a + b*x)^2*log(g + h*x))/h + (2*p*q*r^2*log(a + b*x)*log(c + d*x)*log(g + h*x))/h + (q^2*r^2*log(c + d*x)^2*log(g + h*x))/h - (2*p*r*log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*log(g + h*x))/h - (2*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*log(g + h*x))/h + (log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2*log(g + h*x))/h - (p^2*r^2*log(a + b*x)^2*log((b*(g + h*x))/(b*g - a*h)))/h - (2*p*q*r^2*log(a + b*x)*log(-((h*(c + d*x))/(d*g - c*h)))*log((b*(g + h*x))/(b*g - a*h)))/h + (p*q*r^2*log(-((h*(c + d*x))/(d*g - c*h)))^2*log((b*(g + h*x))/(b*g - a*h)))/h - (2*p*q*r^2*log(-((h*(c + d*x))/(d*g - c*h)))*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))*log((b*(g + h*x))/(b*g - a*h)))/h + (p*q*r^2*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))^2*log((b*(g + h*x))/(b*g - a*h)))/h + (2*p*r*log(a + b*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*log((b*(g + h*x))/(b*g - a*h)))/h - (2*p*q*r^2*log(a + b*x)*log(c + d*x)*log((d*(g + h*x))/(d*g - c*h)))/h - (q^2*r^2*log(c + d*x)^2*log((d*(g + h*x))/(d*g - c*h)))/h + (2*p*q*r^2*log(a + b*x)*log(-((h*(c + d*x))/(d*g - c*h)))*log((d*(g + h*x))/(d*g - c*h)))/h - (p*q*r^2*log(-((h*(c + d*x))/(d*g - c*h)))^2*log((d*(g + h*x))/(d*g - c*h)))/h + (2*p*q*r^2*log(-((h*(c + d*x))/(d*g - c*h)))*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))*log((d*(g + h*x))/(d*g - c*h)))/h + (2*q*r*log(c + d*x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*log((d*(g + h*x))/(d*g - c*h)))/h - (p*q*r^2*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))^2*log(-(((b*c - a*d)*(g + h*x))/((d*g - c*h)*(a + b*x)))))/h - (2*p*r*(q*r*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x))) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*PolyLog(2, -((h*(a + b*x))/(b*g - a*h))))/h + (2*q*r*(p*r*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x))) + log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*PolyLog(2, -((h*(c + d*x))/(d*g - c*h))))/h + (2*p*q*r^2*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))*PolyLog(2, (b*(c + d*x))/(d*(a + b*x))))/h - (2*p*q*r^2*log(((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x)))*PolyLog(2, ((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x))))/h - (2*p^2*r^2*PolyLog(3, -((h*(a + b*x))/(b*g - a*h))))/h - (2*p*q*r^2*PolyLog(3, -((h*(a + b*x))/(b*g - a*h))))/h - (2*p*q*r^2*PolyLog(3, -((h*(c + d*x))/(d*g - c*h))))/h - (2*q^2*r^2*PolyLog(3, -((h*(c + d*x))/(d*g - c*h))))/h - (2*p*q*r^2*PolyLog(3, (b*(c + d*x))/(d*(a + b*x))))/h + (2*p*q*r^2*PolyLog(3, ((b*g - a*h)*(c + d*x))/((d*g - c*h)*(a + b*x))))/h]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(g + h*x)^2, x, 31, (2*b*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(h*(b*g - a*h)) + (2*d*p*q*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(h*(d*g - c*h)) - (2*b*p*r*log(a + b*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(h*(b*g - a*h)) - (2*d*q*r*log(c + d*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(h*(d*g - c*h)) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(h*(g + h*x)) + (2*b*p*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*log(g + h*x))/(h*(b*g - a*h)) + (2*d*q*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*log(g + h*x))/(h*(d*g - c*h)) - (2*d*p*q*r^2*log(a + b*x)*log((b*(g + h*x))/(b*g - a*h)))/(h*(d*g - c*h)) - (2*b*p*q*r^2*log(c + d*x)*log((d*(g + h*x))/(d*g - c*h)))/(h*(b*g - a*h)) - (2*b*p^2*r^2*log(a + b*x)*log(1 + (b*g - a*h)/(h*(a + b*x))))/(h*(b*g - a*h)) - (2*d*q^2*r^2*log(c + d*x)*log(1 + (d*g - c*h)/(h*(c + d*x))))/(h*(d*g - c*h)) + (2*b*p^2*r^2*PolyLog(2, -((b*g - a*h)/(h*(a + b*x)))))/(h*(b*g - a*h)) + (2*d*p*q*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(h*(d*g - c*h)) - (2*d*p*q*r^2*PolyLog(2, -((h*(a + b*x))/(b*g - a*h))))/(h*(d*g - c*h)) + (2*d*q^2*r^2*PolyLog(2, -((d*g - c*h)/(h*(c + d*x)))))/(h*(d*g - c*h)) + (2*b*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(h*(b*g - a*h)) - (2*b*p*q*r^2*PolyLog(2, -((h*(c + d*x))/(d*g - c*h))))/(h*(b*g - a*h))]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(g + h*x)^3, x, 43, -((b*d*p*q*r^2*log(a + b*x))/(h*(b*g - a*h)*(d*g - c*h))) + (d*p*q*r^2*log(a + b*x))/(h*(d*g - c*h)*(g + h*x)) - (b*p^2*r^2*(a + b*x)*log(a + b*x))/((b*g - a*h)^2*(g + h*x)) - (b*d*p*q*r^2*log(c + d*x))/(h*(b*g - a*h)*(d*g - c*h)) + (b*p*q*r^2*log(c + d*x))/(h*(b*g - a*h)*(g + h*x)) - (d*q^2*r^2*(c + d*x)*log(c + d*x))/((d*g - c*h)^2*(g + h*x)) + (b^2*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(h*(b*g - a*h)^2) + (d^2*p*q*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(h*(d*g - c*h)^2) - (b*p*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(h*(b*g - a*h)*(g + h*x)) - (d*q*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(h*(d*g - c*h)*(g + h*x)) - (b^2*p*r*log(a + b*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(h*(b*g - a*h)^2) - (d^2*q*r*log(c + d*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(h*(d*g - c*h)^2) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(2*h*(g + h*x)^2) + (b^2*p^2*r^2*log(g + h*x))/(h*(b*g - a*h)^2) + (2*b*d*p*q*r^2*log(g + h*x))/(h*(b*g - a*h)*(d*g - c*h)) + (d^2*q^2*r^2*log(g + h*x))/(h*(d*g - c*h)^2) + (b^2*p*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*log(g + h*x))/(h*(b*g - a*h)^2) + (d^2*q*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*log(g + h*x))/(h*(d*g - c*h)^2) - (d^2*p*q*r^2*log(a + b*x)*log((b*(g + h*x))/(b*g - a*h)))/(h*(d*g - c*h)^2) - (b^2*p*q*r^2*log(c + d*x)*log((d*(g + h*x))/(d*g - c*h)))/(h*(b*g - a*h)^2) - (b^2*p^2*r^2*log(a + b*x)*log(1 + (b*g - a*h)/(h*(a + b*x))))/(h*(b*g - a*h)^2) - (d^2*q^2*r^2*log(c + d*x)*log(1 + (d*g - c*h)/(h*(c + d*x))))/(h*(d*g - c*h)^2) + (b^2*p^2*r^2*PolyLog(2, -((b*g - a*h)/(h*(a + b*x)))))/(h*(b*g - a*h)^2) + (d^2*p*q*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(h*(d*g - c*h)^2) - (d^2*p*q*r^2*PolyLog(2, -((h*(a + b*x))/(b*g - a*h))))/(h*(d*g - c*h)^2) + (d^2*q^2*r^2*PolyLog(2, -((d*g - c*h)/(h*(c + d*x)))))/(h*(d*g - c*h)^2) + (b^2*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(h*(b*g - a*h)^2) - (b^2*p*q*r^2*PolyLog(2, -((h*(c + d*x))/(d*g - c*h))))/(h*(b*g - a*h)^2)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(g + h*x)^4, x, 57, -((b^2*p^2*r^2)/(3*h*(b*g - a*h)^2*(g + h*x))) - (2*b*d*p*q*r^2)/(3*h*(b*g - a*h)*(d*g - c*h)*(g + h*x)) - (d^2*q^2*r^2)/(3*h*(d*g - c*h)^2*(g + h*x)) - (b^3*p^2*r^2*log(a + b*x))/(3*h*(b*g - a*h)^3) - (2*b*d^2*p*q*r^2*log(a + b*x))/(3*h*(b*g - a*h)*(d*g - c*h)^2) - (b^2*d*p*q*r^2*log(a + b*x))/(3*h*(b*g - a*h)^2*(d*g - c*h)) + (b*p^2*r^2*log(a + b*x))/(3*h*(b*g - a*h)*(g + h*x)^2) + (d*p*q*r^2*log(a + b*x))/(3*h*(d*g - c*h)*(g + h*x)^2) + (2*d^2*p*q*r^2*log(a + b*x))/(3*h*(d*g - c*h)^2*(g + h*x)) - (2*b^2*p^2*r^2*(a + b*x)*log(a + b*x))/(3*(b*g - a*h)^3*(g + h*x)) - (b*d^2*p*q*r^2*log(c + d*x))/(3*h*(b*g - a*h)*(d*g - c*h)^2) - (2*b^2*d*p*q*r^2*log(c + d*x))/(3*h*(b*g - a*h)^2*(d*g - c*h)) - (d^3*q^2*r^2*log(c + d*x))/(3*h*(d*g - c*h)^3) + (b*p*q*r^2*log(c + d*x))/(3*h*(b*g - a*h)*(g + h*x)^2) + (d*q^2*r^2*log(c + d*x))/(3*h*(d*g - c*h)*(g + h*x)^2) + (2*b^2*p*q*r^2*log(c + d*x))/(3*h*(b*g - a*h)^2*(g + h*x)) - (2*d^2*q^2*r^2*(c + d*x)*log(c + d*x))/(3*(d*g - c*h)^3*(g + h*x)) + (2*b^3*p*q*r^2*log(-((d*(a + b*x))/(b*c - a*d)))*log(c + d*x))/(3*h*(b*g - a*h)^3) + (2*d^3*p*q*r^2*log(a + b*x)*log((b*(c + d*x))/(b*c - a*d)))/(3*h*(d*g - c*h)^3) - (b*p*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*h*(b*g - a*h)*(g + h*x)^2) - (d*q*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*h*(d*g - c*h)*(g + h*x)^2) - (2*b^2*p*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*h*(b*g - a*h)^2*(g + h*x)) - (2*d^2*q*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*h*(d*g - c*h)^2*(g + h*x)) - (2*b^3*p*r*log(a + b*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*h*(b*g - a*h)^3) - (2*d^3*q*r*log(c + d*x)*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)))/(3*h*(d*g - c*h)^3) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)^2/(3*h*(g + h*x)^3) + (b^3*p^2*r^2*log(g + h*x))/(h*(b*g - a*h)^3) + (b*d^2*p*q*r^2*log(g + h*x))/(h*(b*g - a*h)*(d*g - c*h)^2) + (b^2*d*p*q*r^2*log(g + h*x))/(h*(b*g - a*h)^2*(d*g - c*h)) + (d^3*q^2*r^2*log(g + h*x))/(h*(d*g - c*h)^3) + (2*b^3*p*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*log(g + h*x))/(3*h*(b*g - a*h)^3) + (2*d^3*q*r*(p*r*log(a + b*x) + q*r*log(c + d*x) - log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))*log(g + h*x))/(3*h*(d*g - c*h)^3) - (2*d^3*p*q*r^2*log(a + b*x)*log((b*(g + h*x))/(b*g - a*h)))/(3*h*(d*g - c*h)^3) - (2*b^3*p*q*r^2*log(c + d*x)*log((d*(g + h*x))/(d*g - c*h)))/(3*h*(b*g - a*h)^3) - (2*b^3*p^2*r^2*log(a + b*x)*log(1 + (b*g - a*h)/(h*(a + b*x))))/(3*h*(b*g - a*h)^3) - (2*d^3*q^2*r^2*log(c + d*x)*log(1 + (d*g - c*h)/(h*(c + d*x))))/(3*h*(d*g - c*h)^3) + (2*b^3*p^2*r^2*PolyLog(2, -((b*g - a*h)/(h*(a + b*x)))))/(3*h*(b*g - a*h)^3) + (2*d^3*p*q*r^2*PolyLog(2, -((d*(a + b*x))/(b*c - a*d))))/(3*h*(d*g - c*h)^3) - (2*d^3*p*q*r^2*PolyLog(2, -((h*(a + b*x))/(b*g - a*h))))/(3*h*(d*g - c*h)^3) + (2*d^3*q^2*r^2*PolyLog(2, -((d*g - c*h)/(h*(c + d*x)))))/(3*h*(d*g - c*h)^3) + (2*b^3*p*q*r^2*PolyLog(2, (b*(c + d*x))/(b*c - a*d)))/(3*h*(b*g - a*h)^3) - (2*b^3*p*q*r^2*PolyLog(2, -((h*(c + d*x))/(d*g - c*h))))/(3*h*(b*g - a*h)^3)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(g+h*x^2)^m*(A+B*log(e*(f*(a+b*x)^s*(c+d*x)^t)^n))^p=#

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

    @test_int [(a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^3/(1 - c^2*x^2), x, 5, -((a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^4/(4*b*c))]
    @test_int [(a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^2/(1 - c^2*x^2), x, 5, -((a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^3/(3*b*c))]
    @test_int [(a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^1/(1 - c^2*x^2), x, 4, -((a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^2/(2*b*c))]
    @test_int [1/((a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^1*(1 - c^2*x^2)), x, 2, -(log(a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))/(b*c))]
    @test_int [1/((a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^2*(1 - c^2*x^2)), x, 2, 1/(b*c*(a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x))))]
    @test_int [1/((a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^3*(1 - c^2*x^2)), x, 2, 1/(2*b*c*(a + b*log(sqrt(1 - c*x)/sqrt(1 + c*x)))^2)]

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

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(s+t*log(i*(g+h*x)^n))^m*log(e*(f*(a+b*x)^p*(c+d*x)^q)^r)/(g+h*x)=#

    @test_int [(s + t*log(i*(g + h*x)^n))^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(k*g + k*h*x), x, 11, -((p*r*log(-((h*(a + b*x))/(b*g - a*h)))*(s + t*log(i*(g + h*x)^n))^3)/(3*h*k*n*t)) - (q*r*log(-((h*(c + d*x))/(d*g - c*h)))*(s + t*log(i*(g + h*x)^n))^3)/(3*h*k*n*t) + (log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(s + t*log(i*(g + h*x)^n))^3)/(3*h*k*n*t) - (p*r*(s + t*log(i*(g + h*x)^n))^2*PolyLog(2, (b*(g + h*x))/(b*g - a*h)))/(h*k) - (q*r*(s + t*log(i*(g + h*x)^n))^2*PolyLog(2, (d*(g + h*x))/(d*g - c*h)))/(h*k) + (2*n*p*r*t*(s + t*log(i*(g + h*x)^n))*PolyLog(3, (b*(g + h*x))/(b*g - a*h)))/(h*k) + (2*n*q*r*t*(s + t*log(i*(g + h*x)^n))*PolyLog(3, (d*(g + h*x))/(d*g - c*h)))/(h*k) - (2*n^2*p*r*t^2*PolyLog(4, (b*(g + h*x))/(b*g - a*h)))/(h*k) - (2*n^2*q*r*t^2*PolyLog(4, (d*(g + h*x))/(d*g - c*h)))/(h*k)]
    @test_int [(s + t*log(i*(g + h*x)^n))^1*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(k*g + k*h*x), x, 9, -((p*r*log(-((h*(a + b*x))/(b*g - a*h)))*(s + t*log(i*(g + h*x)^n))^2)/(2*h*k*n*t)) - (q*r*log(-((h*(c + d*x))/(d*g - c*h)))*(s + t*log(i*(g + h*x)^n))^2)/(2*h*k*n*t) + (log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*(s + t*log(i*(g + h*x)^n))^2)/(2*h*k*n*t) - (p*r*(s + t*log(i*(g + h*x)^n))*PolyLog(2, (b*(g + h*x))/(b*g - a*h)))/(h*k) - (q*r*(s + t*log(i*(g + h*x)^n))*PolyLog(2, (d*(g + h*x))/(d*g - c*h)))/(h*k) + (n*p*r*t*PolyLog(3, (b*(g + h*x))/(b*g - a*h)))/(h*k) + (n*q*r*t*PolyLog(3, (d*(g + h*x))/(d*g - c*h)))/(h*k)]
    @test_int [(s + t*log(i*(g + h*x)^n))^0*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(k*g + k*h*x), x, 7, -((p*r*log(-((h*(a + b*x))/(b*g - a*h)))*log(g*k + h*k*x))/(h*k)) - (q*r*log(-((h*(c + d*x))/(d*g - c*h)))*log(g*k + h*k*x))/(h*k) + (log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)*log(g*k + h*k*x))/(h*k) - (p*r*PolyLog(2, (b*(g + h*x))/(b*g - a*h)))/(h*k) - (q*r*PolyLog(2, (d*(g + h*x))/(d*g - c*h)))/(h*k)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/((k*g + k*h*x)*(s + t*log(i*(g + h*x)^n))^1), x, 0, Unintegrable(log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/((g*k + h*k*x)*(s + t*log(i*(g + h*x)^n))), x)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/((k*g + k*h*x)*(s + t*log(i*(g + h*x)^n))^2), x, 0, Unintegrable(log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/((g*k + h*k*x)*(s + t*log(i*(g + h*x)^n))^2), x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*log(i*(j*(h*x)^t)^u)^m*log(e*(f*(a+b*x)^p*(c+d*x)^q)^r)^s/x=#

    @test_int [log(i*(j*(h*x)^t)^u)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/x, x, 13, -((p*r*log(i*(j*(h*x)^t)^u)^4*log(1 + (b*x)/a))/(4*t*u)) + (log(i*(j*(h*x)^t)^u)^4*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(4*t*u) - (q*r*log(i*(j*(h*x)^t)^u)^4*log(1 + (d*x)/c))/(4*t*u) - p*r*log(i*(j*(h*x)^t)^u)^3*PolyLog(2, -((b*x)/a)) - q*r*log(i*(j*(h*x)^t)^u)^3*PolyLog(2, -((d*x)/c)) + 3*p*r*t*u*log(i*(j*(h*x)^t)^u)^2*PolyLog(3, -((b*x)/a)) + 3*q*r*t*u*log(i*(j*(h*x)^t)^u)^2*PolyLog(3, -((d*x)/c)) - 6*p*r*t^2*u^2*log(i*(j*(h*x)^t)^u)*PolyLog(4, -((b*x)/a)) - 6*q*r*t^2*u^2*log(i*(j*(h*x)^t)^u)*PolyLog(4, -((d*x)/c)) + 6*p*r*t^3*u^3*PolyLog(5, -((b*x)/a)) + 6*q*r*t^3*u^3*PolyLog(5, -((d*x)/c))]
    @test_int [log(i*(j*(h*x)^t)^u)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/x, x, 11, -((p*r*log(i*(j*(h*x)^t)^u)^3*log(1 + (b*x)/a))/(3*t*u)) + (log(i*(j*(h*x)^t)^u)^3*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(3*t*u) - (q*r*log(i*(j*(h*x)^t)^u)^3*log(1 + (d*x)/c))/(3*t*u) - p*r*log(i*(j*(h*x)^t)^u)^2*PolyLog(2, -((b*x)/a)) - q*r*log(i*(j*(h*x)^t)^u)^2*PolyLog(2, -((d*x)/c)) + 2*p*r*t*u*log(i*(j*(h*x)^t)^u)*PolyLog(3, -((b*x)/a)) + 2*q*r*t*u*log(i*(j*(h*x)^t)^u)*PolyLog(3, -((d*x)/c)) - 2*p*r*t^2*u^2*PolyLog(4, -((b*x)/a)) - 2*q*r*t^2*u^2*PolyLog(4, -((d*x)/c))]
    @test_int [log(i*(j*(h*x)^t)^u)^1*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/x, x, 9, -((p*r*log(i*(j*(h*x)^t)^u)^2*log(1 + (b*x)/a))/(2*t*u)) + (log(i*(j*(h*x)^t)^u)^2*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r))/(2*t*u) - (q*r*log(i*(j*(h*x)^t)^u)^2*log(1 + (d*x)/c))/(2*t*u) - p*r*log(i*(j*(h*x)^t)^u)*PolyLog(2, -((b*x)/a)) - q*r*log(i*(j*(h*x)^t)^u)*PolyLog(2, -((d*x)/c)) + p*r*t*u*PolyLog(3, -((b*x)/a)) + q*r*t*u*PolyLog(3, -((d*x)/c))]
    @test_int [log(i*(j*(h*x)^t)^u)^0*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/x, x, 5, (-p)*r*log(x)*log(1 + (b*x)/a) + log(x)*log(e*(f*(a + b*x)^p*(c + d*x)^q)^r) - q*r*log(x)*log(1 + (d*x)/c) - p*r*PolyLog(2, -((b*x)/a)) - q*r*PolyLog(2, -((d*x)/c))]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(x*log(i*(j*(h*x)^t)^u)^1), x, 0, CannotIntegrate(log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(x*log(i*(j*(h*x)^t)^u)), x)]
    @test_int [log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(x*log(i*(j*(h*x)^t)^u)^2), x, 0, CannotIntegrate(log(e*(f*(a + b*x)^p*(c + d*x)^q)^r)/(x*log(i*(j*(h*x)^t)^u)^2), x)]

    #= Simplification*and*normalization*formerly*caused*infinite*recursion. =#
    @test_int [log(x)*log((a + b*x)/((b*c - a*d)*x))^3/x, x, 0, Unintegrable((log(x)*log((a + b*x)/((b*c - a*d)*x))^3)/x, x)]
    @test_int [log(x)*log((a + b*x)/((b*c - a*d)*x))^2/x, x, 0, Unintegrable((log(x)*log((a + b*x)/((b*c - a*d)*x))^2)/x, x)]
    @test_int [log(x)*log((a + b*x)/((b*c - a*d)*x))^1/x, x, 5, (-(1/2))*log(1 + a/(b*x))*log(x)^2 + (1/2)*log(b/(b*c - a*d) + a/((b*c - a*d)*x))*log(x)^2 + log(x)*PolyLog(2, -(a/(b*x))) + PolyLog(3, -(a/(b*x)))]
    @test_int [log(x)/(x*log((a + b*x)/((b*c - a*d)*x))^1), x, 0, Unintegrable(log(x)/(x*log((a + b*x)/((b*c - a*d)*x))), x)]
    @test_int [log(x)/(x*log((a + b*x)/((b*c - a*d)*x))^2), x, 0, Unintegrable(log(x)/(x*log((a + b*x)/((b*c - a*d)*x))^2), x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*log(i*(j*(g+h*x)^t)^u)  log(e*(f*(a+b*x)^p*(c+d*x)^q)^r)^s / ((a+b*x)*(c+d*x))=#

    @test_int [log(h*(f + g*x)^m)/((a + b*x)*(c + d*x))*log(e*((a + b*x)/(c + d*x))^n)^3, x, 14, (m*log(e*((a + b*x)/(c + d*x))^n)^4*log((b*c - a*d)/(b*(c + d*x))))/(4*(b*c - a*d)*n) + (log(e*((a + b*x)/(c + d*x))^n)^4*log(h*(f + g*x)^m))/(4*(b*c - a*d)*n) - (m*log(e*((a + b*x)/(c + d*x))^n)^4*log(1 - ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(4*(b*c - a*d)*n) + (m*log(e*((a + b*x)/(c + d*x))^n)^3*PolyLog(2, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) - (m*log(e*((a + b*x)/(c + d*x))^n)^3*PolyLog(2, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d) - (3*m*n*log(e*((a + b*x)/(c + d*x))^n)^2*PolyLog(3, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) + (3*m*n*log(e*((a + b*x)/(c + d*x))^n)^2*PolyLog(3, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d) + (6*m*n^2*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(4, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) - (6*m*n^2*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(4, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d) - (6*m*n^3*PolyLog(5, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) + (6*m*n^3*PolyLog(5, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d)]
    @test_int [log(h*(f + g*x)^m)/((a + b*x)*(c + d*x))*log(e*((a + b*x)/(c + d*x))^n)^2, x, 12, (m*log(e*((a + b*x)/(c + d*x))^n)^3*log((b*c - a*d)/(b*(c + d*x))))/(3*(b*c - a*d)*n) + (log(e*((a + b*x)/(c + d*x))^n)^3*log(h*(f + g*x)^m))/(3*(b*c - a*d)*n) - (m*log(e*((a + b*x)/(c + d*x))^n)^3*log(1 - ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(3*(b*c - a*d)*n) + (m*log(e*((a + b*x)/(c + d*x))^n)^2*PolyLog(2, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) - (m*log(e*((a + b*x)/(c + d*x))^n)^2*PolyLog(2, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d) - (2*m*n*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(3, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) + (2*m*n*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(3, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d) + (2*m*n^2*PolyLog(4, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) - (2*m*n^2*PolyLog(4, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d)]
    @test_int [log(h*(f + g*x)^m)/((a + b*x)*(c + d*x))*log(e*((a + b*x)/(c + d*x))^n)^1, x, 10, (m*log(e*((a + b*x)/(c + d*x))^n)^2*log((b*c - a*d)/(b*(c + d*x))))/(2*(b*c - a*d)*n) + (log(e*((a + b*x)/(c + d*x))^n)^2*log(h*(f + g*x)^m))/(2*(b*c - a*d)*n) - (m*log(e*((a + b*x)/(c + d*x))^n)^2*log(1 - ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(2*(b*c - a*d)*n) + (m*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(2, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) - (m*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(2, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d) - (m*n*PolyLog(3, (d*(a + b*x))/(b*(c + d*x))))/(b*c - a*d) + (m*n*PolyLog(3, ((d*f - c*g)*(a + b*x))/((b*f - a*g)*(c + d*x))))/(b*c - a*d)]
    @test_int [log(h*(f + g*x)^m)/((a + b*x)*(c + d*x))/log(e*((a + b*x)/(c + d*x))^n)^1, x, 2, (b*Unintegrable(log(h*(f + g*x)^m)/((a + b*x)*log(e*((a + b*x)/(c + d*x))^n)), x))/(b*c - a*d) - (d*Unintegrable(log(h*(f + g*x)^m)/((c + d*x)*log(e*((a + b*x)/(c + d*x))^n)), x))/(b*c - a*d)]
    @test_int [log(h*(f + g*x)^m)/((a + b*x)*(c + d*x))/log(e*((a + b*x)/(c + d*x))^n)^2, x, 1, -(log(h*(f + g*x)^m)/((b*c - a*d)*n*log(e*((a + b*x)/(c + d*x))^n))) + (g*m*Unintegrable(1/((f + g*x)*log(e*((a + b*x)/(c + d*x))^n)), x))/((b*c - a*d)*n)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(f+g*x+h*x^2)^m*log(1-f*(a+b*x)/(c+d*x))*log(e*((a+b*x) / (c+d*x))^n)^p=#

    @test_int [log(1 - (a + b*x)/(c + d*x))/((a + b*x)*(c + d*x)*log((a + b*x)/(c + d*x))^2), x, 2, (b*CannotIntegrate(log(1 - (a + b*x)/(c + d*x))/((a + b*x)*log((a + b*x)/(c + d*x))^2), x))/(b*c - a*d) - (d*CannotIntegrate(log(1 - (a + b*x)/(c + d*x))/((c + d*x)*log((a + b*x)/(c + d*x))^2), x))/(b*c - a*d)]
    @test_int [log(1 - (c + d*x)/(a + b*x))/((a + b*x)*(c + d*x)*log((a + b*x)/(c + d*x))^2), x, 2, (b*CannotIntegrate(log(1 - (c + d*x)/(a + b*x))/((a + b*x)*log((a + b*x)/(c + d*x))^2), x))/(b*c - a*d) - (d*CannotIntegrate(log(1 - (c + d*x)/(a + b*x))/((c + d*x)*log((a + b*x)/(c + d*x))^2), x))/(b*c - a*d)]

    @test_int [log(1 - (a + b*x)/(c + d*x))/((a + b*x)*(c + d*x)*log((a + b*x)/(c + d*x))^2) + 1/((c + d*x)*(-a + c + (-b + d)*x)*log((a + b*x)/(c + d*x))), x, -3, -(log(1 - (a + b*x)/(c + d*x))/((b*c - a*d)*log((a + b*x)/(c + d*x))))]
    @test_int [log(1 - (c + d*x)/(a + b*x))/((a + b*x)*(c + d*x)*log((a + b*x)/(c + d*x))^2) - 1/((a + b*x)*(a - c + (b - d)*x)*log((a + b*x)/(c + d*x))), x, -3, -(log(1 - (c + d*x)/(a + b*x))/((b*c - a*d)*log((a + b*x)/(c + d*x))))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*RFx*log(e*(f*(a+b*x)^p*(c+d*x)^q)^r)^s=#

    @test_int [x^3*log(e*((a + b*x)/(c + d*x))^n)/(f - g*x^2), x, 30, -((a*n*x)/(2*b*g)) + (c*n*x)/(2*d*g) + (a^2*n*log(a + b*x))/(2*b^2*g) - (n*x^2*log(a + b*x))/(2*g) - (c^2*n*log(c + d*x))/(2*d^2*g) + (n*x^2*log(c + d*x))/(2*g) + (x^2*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(2*g) - (f*n*log(a + b*x)*log((b*(sqrt(f) - sqrt(g)*x))/(b*sqrt(f) + a*sqrt(g))))/(2*g^2) + (f*n*log(c + d*x)*log((d*(sqrt(f) - sqrt(g)*x))/(d*sqrt(f) + c*sqrt(g))))/(2*g^2) - (f*n*log(a + b*x)*log((b*(sqrt(f) + sqrt(g)*x))/(b*sqrt(f) - a*sqrt(g))))/(2*g^2) + (f*n*log(c + d*x)*log((d*(sqrt(f) + sqrt(g)*x))/(d*sqrt(f) - c*sqrt(g))))/(2*g^2) + (f*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f - g*x^2))/(2*g^2) - (f*n*PolyLog(2, -((sqrt(g)*(a + b*x))/(b*sqrt(f) - a*sqrt(g)))))/(2*g^2) - (f*n*PolyLog(2, (sqrt(g)*(a + b*x))/(b*sqrt(f) + a*sqrt(g))))/(2*g^2) + (f*n*PolyLog(2, -((sqrt(g)*(c + d*x))/(d*sqrt(f) - c*sqrt(g)))))/(2*g^2) + (f*n*PolyLog(2, (sqrt(g)*(c + d*x))/(d*sqrt(f) + c*sqrt(g))))/(2*g^2)]
    @test_int [x^2*log(e*((a + b*x)/(c + d*x))^n)/(f - g*x^2), x, 27, -((n*(a + b*x)*log(a + b*x))/(b*g)) + (n*(c + d*x)*log(c + d*x))/(d*g) + (x*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/g - (sqrt(f)*atanh((sqrt(g)*x)/sqrt(f))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/g^(3/2) - (sqrt(f)*n*log(a + b*x)*log((b*(sqrt(f) - sqrt(g)*x))/(b*sqrt(f) + a*sqrt(g))))/(2*g^(3/2)) + (sqrt(f)*n*log(c + d*x)*log((d*(sqrt(f) - sqrt(g)*x))/(d*sqrt(f) + c*sqrt(g))))/(2*g^(3/2)) + (sqrt(f)*n*log(a + b*x)*log((b*(sqrt(f) + sqrt(g)*x))/(b*sqrt(f) - a*sqrt(g))))/(2*g^(3/2)) - (sqrt(f)*n*log(c + d*x)*log((d*(sqrt(f) + sqrt(g)*x))/(d*sqrt(f) - c*sqrt(g))))/(2*g^(3/2)) + (sqrt(f)*n*PolyLog(2, -((sqrt(g)*(a + b*x))/(b*sqrt(f) - a*sqrt(g)))))/(2*g^(3/2)) - (sqrt(f)*n*PolyLog(2, (sqrt(g)*(a + b*x))/(b*sqrt(f) + a*sqrt(g))))/(2*g^(3/2)) - (sqrt(f)*n*PolyLog(2, -((sqrt(g)*(c + d*x))/(d*sqrt(f) - c*sqrt(g)))))/(2*g^(3/2)) + (sqrt(f)*n*PolyLog(2, (sqrt(g)*(c + d*x))/(d*sqrt(f) + c*sqrt(g))))/(2*g^(3/2))]
    @test_int [x^1*log(e*((a + b*x)/(c + d*x))^n)/(f - g*x^2), x, 18, -((n*log(a + b*x)*log((b*(sqrt(f) - sqrt(g)*x))/(b*sqrt(f) + a*sqrt(g))))/(2*g)) + (n*log(c + d*x)*log((d*(sqrt(f) - sqrt(g)*x))/(d*sqrt(f) + c*sqrt(g))))/(2*g) - (n*log(a + b*x)*log((b*(sqrt(f) + sqrt(g)*x))/(b*sqrt(f) - a*sqrt(g))))/(2*g) + (n*log(c + d*x)*log((d*(sqrt(f) + sqrt(g)*x))/(d*sqrt(f) - c*sqrt(g))))/(2*g) + ((n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f - g*x^2))/(2*g) - (n*PolyLog(2, -((sqrt(g)*(a + b*x))/(b*sqrt(f) - a*sqrt(g)))))/(2*g) - (n*PolyLog(2, (sqrt(g)*(a + b*x))/(b*sqrt(f) + a*sqrt(g))))/(2*g) + (n*PolyLog(2, -((sqrt(g)*(c + d*x))/(d*sqrt(f) - c*sqrt(g)))))/(2*g) + (n*PolyLog(2, (sqrt(g)*(c + d*x))/(d*sqrt(f) + c*sqrt(g))))/(2*g)]
    @test_int [x^0*log(e*((a + b*x)/(c + d*x))^n)/(f - g*x^2), x, 7, (log(e*((a + b*x)/(c + d*x))^n)*log(1 - ((d*sqrt(f) - c*sqrt(g))*(a + b*x))/((b*sqrt(f) - a*sqrt(g))*(c + d*x))))/(2*sqrt(f)*sqrt(g)) - (log(e*((a + b*x)/(c + d*x))^n)*log(1 - ((d*sqrt(f) + c*sqrt(g))*(a + b*x))/((b*sqrt(f) + a*sqrt(g))*(c + d*x))))/(2*sqrt(f)*sqrt(g)) + (n*PolyLog(2, ((d*sqrt(f) - c*sqrt(g))*(a + b*x))/((b*sqrt(f) - a*sqrt(g))*(c + d*x))))/(2*sqrt(f)*sqrt(g)) - (n*PolyLog(2, ((d*sqrt(f) + c*sqrt(g))*(a + b*x))/((b*sqrt(f) + a*sqrt(g))*(c + d*x))))/(2*sqrt(f)*sqrt(g))]
    @test_int [log(e*((a + b*x)/(c + d*x))^n)/(x^1*(f - g*x^2)), x, 29, (n*log(-((b*x)/a))*log(a + b*x))/f - (n*log(-((d*x)/c))*log(c + d*x))/f - (log(x)*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/f - (n*log(a + b*x)*log((b*(sqrt(f) - sqrt(g)*x))/(b*sqrt(f) + a*sqrt(g))))/(2*f) + (n*log(c + d*x)*log((d*(sqrt(f) - sqrt(g)*x))/(d*sqrt(f) + c*sqrt(g))))/(2*f) - (n*log(a + b*x)*log((b*(sqrt(f) + sqrt(g)*x))/(b*sqrt(f) - a*sqrt(g))))/(2*f) + (n*log(c + d*x)*log((d*(sqrt(f) + sqrt(g)*x))/(d*sqrt(f) - c*sqrt(g))))/(2*f) + ((n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f - g*x^2))/(2*f) - (n*PolyLog(2, -((sqrt(g)*(a + b*x))/(b*sqrt(f) - a*sqrt(g)))))/(2*f) - (n*PolyLog(2, (sqrt(g)*(a + b*x))/(b*sqrt(f) + a*sqrt(g))))/(2*f) + (n*PolyLog(2, 1 + (b*x)/a))/f + (n*PolyLog(2, -((sqrt(g)*(c + d*x))/(d*sqrt(f) - c*sqrt(g)))))/(2*f) + (n*PolyLog(2, (sqrt(g)*(c + d*x))/(d*sqrt(f) + c*sqrt(g))))/(2*f) - (n*PolyLog(2, 1 + (d*x)/c))/f]
    @test_int [log(e*((a + b*x)/(c + d*x))^n)/(x^2*(f - g*x^2)), x, 31, (b*n*log(x))/(a*f) - (d*n*log(x))/(c*f) - (b*n*log(a + b*x))/(a*f) - (n*log(a + b*x))/(f*x) + (d*n*log(c + d*x))/(c*f) + (n*log(c + d*x))/(f*x) + (n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))/(f*x) - (sqrt(g)*atanh((sqrt(g)*x)/sqrt(f))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/f^(3/2) - (sqrt(g)*n*log(a + b*x)*log((b*(sqrt(f) - sqrt(g)*x))/(b*sqrt(f) + a*sqrt(g))))/(2*f^(3/2)) + (sqrt(g)*n*log(c + d*x)*log((d*(sqrt(f) - sqrt(g)*x))/(d*sqrt(f) + c*sqrt(g))))/(2*f^(3/2)) + (sqrt(g)*n*log(a + b*x)*log((b*(sqrt(f) + sqrt(g)*x))/(b*sqrt(f) - a*sqrt(g))))/(2*f^(3/2)) - (sqrt(g)*n*log(c + d*x)*log((d*(sqrt(f) + sqrt(g)*x))/(d*sqrt(f) - c*sqrt(g))))/(2*f^(3/2)) + (sqrt(g)*n*PolyLog(2, -((sqrt(g)*(a + b*x))/(b*sqrt(f) - a*sqrt(g)))))/(2*f^(3/2)) - (sqrt(g)*n*PolyLog(2, (sqrt(g)*(a + b*x))/(b*sqrt(f) + a*sqrt(g))))/(2*f^(3/2)) - (sqrt(g)*n*PolyLog(2, -((sqrt(g)*(c + d*x))/(d*sqrt(f) - c*sqrt(g)))))/(2*f^(3/2)) + (sqrt(g)*n*PolyLog(2, (sqrt(g)*(c + d*x))/(d*sqrt(f) + c*sqrt(g))))/(2*f^(3/2))]

    @test_int [x^3*log(e*((a + b*x)/(c + d*x))^n)/(f + g*x + h*x^2), x, 37, (a*n*x)/(2*b*h) - (c*n*x)/(2*d*h) - (a^2*n*log(a + b*x))/(2*b^2*h) + (n*x^2*log(a + b*x))/(2*h) - (g*n*(a + b*x)*log(a + b*x))/(b*h^2) + (c^2*n*log(c + d*x))/(2*d^2*h) - (n*x^2*log(c + d*x))/(2*h) + (g*n*(c + d*x)*log(c + d*x))/(d*h^2) + (g*x*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/h^2 - (x^2*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(2*h) - (g*(g^2 - 3*f*h)*atanh((g + 2*h*x)/sqrt(g^2 - 4*f*h))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(h^3*sqrt(g^2 - 4*f*h)) + ((g^2 - f*h - (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h))))))/(2*h^3) - ((g^2 - f*h - (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h))))))/(2*h^3) + ((g^2 - f*h + (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h))))))/(2*h^3) - ((g^2 - f*h + (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h))))))/(2*h^3) - ((g^2 - f*h)*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f + g*x + h*x^2))/(2*h^3) + ((g^2 - f*h - (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h)))))/(2*h^3) + ((g^2 - f*h + (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h)))))/(2*h^3) - ((g^2 - f*h - (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h)))))/(2*h^3) - ((g^2 - f*h + (g*(g^2 - 3*f*h))/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h)))))/(2*h^3)]
    @test_int [x^2*log(e*((a + b*x)/(c + d*x))^n)/(f + g*x + h*x^2), x, 30, (n*(a + b*x)*log(a + b*x))/(b*h) - (n*(c + d*x)*log(c + d*x))/(d*h) - (x*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/h + ((g^2 - 2*f*h)*atanh((g + 2*h*x)/sqrt(g^2 - 4*f*h))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(h^2*sqrt(g^2 - 4*f*h)) - ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h))))))/(2*h^2) + ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h))))))/(2*h^2) - ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h))))))/(2*h^2) + ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h))))))/(2*h^2) + (g*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f + g*x + h*x^2))/(2*h^2) - ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h)))))/(2*h^2) - ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h)))))/(2*h^2) + ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h)))))/(2*h^2) + ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h)))))/(2*h^2)]
    @test_int [x^1*log(e*((a + b*x)/(c + d*x))^n)/(f + g*x + h*x^2), x, 21, -((g*atanh((g + 2*h*x)/sqrt(g^2 - 4*f*h))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(h*sqrt(g^2 - 4*f*h))) + ((1 - g/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h))))))/(2*h) - ((1 - g/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h))))))/(2*h) + ((1 + g/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h))))))/(2*h) - ((1 + g/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h))))))/(2*h) - ((n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f + g*x + h*x^2))/(2*h) + ((1 - g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h)))))/(2*h) + ((1 + g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h)))))/(2*h) - ((1 - g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h)))))/(2*h) - ((1 + g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h)))))/(2*h)]
    @test_int [x^0*log(e*((a + b*x)/(c + d*x))^n)/(f + g*x + h*x^2), x, 7, -((log(e*((a + b*x)/(c + d*x))^n)*log(1 - (2*(d^2*f - c*d*g + c^2*h)*(a + b*x))/((2*b*d*f - b*c*g - a*d*g + 2*a*c*h - (b*c - a*d)*sqrt(g^2 - 4*f*h))*(c + d*x))))/sqrt(g^2 - 4*f*h)) + (log(e*((a + b*x)/(c + d*x))^n)*log(1 - (2*(d^2*f - c*d*g + c^2*h)*(a + b*x))/((2*b*d*f - b*c*g - a*d*g + 2*a*c*h + (b*c - a*d)*sqrt(g^2 - 4*f*h))*(c + d*x))))/sqrt(g^2 - 4*f*h) - (n*PolyLog(2, (2*(d^2*f - c*d*g + c^2*h)*(a + b*x))/((2*b*d*f - b*c*g - a*d*g + 2*a*c*h - (b*c - a*d)*sqrt(g^2 - 4*f*h))*(c + d*x))))/sqrt(g^2 - 4*f*h) + (n*PolyLog(2, (2*(d^2*f - c*d*g + c^2*h)*(a + b*x))/((2*b*d*f - b*c*g - a*d*g + 2*a*c*h + (b*c - a*d)*sqrt(g^2 - 4*f*h))*(c + d*x))))/sqrt(g^2 - 4*f*h)]
    @test_int [log(e*((a + b*x)/(c + d*x))^n)/(x^1*(f + g*x + h*x^2)), x, 31, (n*log(-((b*x)/a))*log(a + b*x))/f - (n*log(-((d*x)/c))*log(c + d*x))/f - (g*atanh((g + 2*h*x)/sqrt(g^2 - 4*f*h))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(f*sqrt(g^2 - 4*f*h)) - (log(x)*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/f - ((1 + g/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h))))))/(2*f) + ((1 + g/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h))))))/(2*f) - ((1 - g/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h))))))/(2*f) + ((1 - g/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h))))))/(2*f) + ((n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f + g*x + h*x^2))/(2*f) - ((1 + g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h)))))/(2*f) - ((1 - g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h)))))/(2*f) + (n*PolyLog(2, 1 + (b*x)/a))/f + ((1 + g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h)))))/(2*f) + ((1 - g/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h)))))/(2*f) - (n*PolyLog(2, 1 + (d*x)/c))/f]
    @test_int [log(e*((a + b*x)/(c + d*x))^n)/(x^2*(f + g*x + h*x^2)), x, 40, (b*n*log(x))/(a*f) - (d*n*log(x))/(c*f) - (b*n*log(a + b*x))/(a*f) - (n*log(a + b*x))/(f*x) - (g*n*log(-((b*x)/a))*log(a + b*x))/f^2 + (d*n*log(c + d*x))/(c*f) + (n*log(c + d*x))/(f*x) + (g*n*log(-((d*x)/c))*log(c + d*x))/f^2 + (n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))/(f*x) + ((g^2 - 2*f*h)*atanh((g + 2*h*x)/sqrt(g^2 - 4*f*h))*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/(f^2*sqrt(g^2 - 4*f*h)) + (g*log(x)*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x)))/f^2 + ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h))))))/(2*f^2) - ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g - sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h))))))/(2*f^2) + ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(a + b*x)*log(-((b*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h))))))/(2*f^2) - ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*log(c + d*x)*log(-((d*(g + sqrt(g^2 - 4*f*h) + 2*h*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h))))))/(2*f^2) - (g*(n*log(a + b*x) - log(e*((a + b*x)/(c + d*x))^n) - n*log(c + d*x))*log(f + g*x + h*x^2))/(2*f^2) + ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g - sqrt(g^2 - 4*f*h)))))/(2*f^2) + ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(a + b*x))/(2*a*h - b*(g + sqrt(g^2 - 4*f*h)))))/(2*f^2) - (g*n*PolyLog(2, 1 + (b*x)/a))/f^2 - ((g + (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g - sqrt(g^2 - 4*f*h)))))/(2*f^2) - ((g - (g^2 - 2*f*h)/sqrt(g^2 - 4*f*h))*n*PolyLog(2, (2*h*(c + d*x))/(2*c*h - d*(g + sqrt(g^2 - 4*f*h)))))/(2*f^2) + (g*n*PolyLog(2, 1 + (d*x)/c))/f^2]

    #= ::Section::Closed:: =#
    #=Miscellaneous*integrands*involving*log(e*(f*(a+b*x)^p*(c+d*x)^q)^r)^s=#

    @test_int [log((c*x)/(a + b*x))/(a + b*x), x, 5, -((log(a/(a + b*x))*log((c*x)/(a + b*x)))/b) - PolyLog(2, 1 - a/(a + b*x))/b]
    @test_int [log((c*x)/(a + b*x))^2/(x*(a + b*x)), x, 3, log((c*x)/(a + b*x))^3/(3*a)]

    @test_int [(log(a/(a + b*x))*log((c*x)/(a + b*x))^2)/(x*(a + b*x)), x, 3, -((log((c*x)/(a + b*x))^2*PolyLog(2, 1 - a/(a + b*x)))/a) + (2*log((c*x)/(a + b*x))*PolyLog(3, 1 - a/(a + b*x)))/a - (2*PolyLog(4, 1 - a/(a + b*x)))/a]

    @test_int [log(e*(a + b*x)/(c + d*x))^2*log((b*c - a*d)/(b*(c + d*x)))/((g*a + g*b*x)*(c + d*x)), x, 3, -((log((e*(a + b*x))/(c + d*x))^2*PolyLog(2, 1 - (b*c - a*d)/(b*(c + d*x))))/((b*c - a*d)*g)) + (2*log((e*(a + b*x))/(c + d*x))*PolyLog(3, 1 - (b*c - a*d)/(b*(c + d*x))))/((b*c - a*d)*g) - (2*PolyLog(4, 1 - (b*c - a*d)/(b*(c + d*x))))/((b*c - a*d)*g)]
    @test_int [log(e*((a + b*x)/(c + d*x))^n)^2*log((b*c - a*d)/(b*(c + d*x)))/((g*a + g*b*x)*(c + d*x)), x, 3, -((log(e*((a + b*x)/(c + d*x))^n)^2*PolyLog(2, 1 - (b*c - a*d)/(b*(c + d*x))))/((b*c - a*d)*g)) + (2*n*log(e*((a + b*x)/(c + d*x))^n)*PolyLog(3, 1 - (b*c - a*d)/(b*(c + d*x))))/((b*c - a*d)*g) - (2*n^2*PolyLog(4, 1 - (b*c - a*d)/(b*(c + d*x))))/((b*c - a*d)*g)]

    @test_int [log((c*(b + a*x))/x)^1, x, 4, x*log(a*c + (b*c)/x) + (b*log(b + a*x))/a]
    @test_int [log((c*(b + a*x))/x)^2, x, 5, ((b + a*x)*log(a*c + (b*c)/x)^2)/a - (2*b*log(c*(a + b/x))*log(-(b/(a*x))))/a - (2*b*PolyLog(2, 1 + b/(a*x)))/a]
    @test_int [log((c*(b + a*x))/x)^3, x, 7, ((b + a*x)*log(a*c + (b*c)/x)^3)/a - (3*b*log(c*(a + b/x))^2*log(-(b/(a*x))))/a - (6*b*log(c*(a + b/x))*PolyLog(2, 1 + b/(a*x)))/a + (6*b*PolyLog(3, 1 + b/(a*x)))/a]

    @test_int [log((c*(b + a*x)^2)/x^2), x, 2, (2*b*log(b + a*x))/a + x*log((c*(b + a*x)^2)/x^2)]
    @test_int [log((c*(b + a*x)^2)/x^2)^2, x, 6, -((4*b*log(b/(b + a*x))*log((c*(b + a*x)^2)/x^2))/a) + x*log((c*(b + a*x)^2)/x^2)^2 + (8*b*PolyLog(2, 1 - b/(b + a*x)))/a]
    @test_int [log((c*(b + a*x)^2)/x^2)^3, x, 5, x*log((c*(b + a*x)^2)/x^2)^3 - (6*b*log((c*(b + a*x)^2)/x^2)^2*log(1 - (a*x)/(b + a*x)))/a + (24*b*log((c*(b + a*x)^2)/x^2)*PolyLog(2, (a*x)/(b + a*x)))/a + (48*b*PolyLog(3, (a*x)/(b + a*x)))/a]

    @test_int [log((c*x^2)/(b + a*x)^2)^1, x, 2, x*log((c*x^2)/(b + a*x)^2) - (2*b*log(b + a*x))/a]
    @test_int [log((c*x^2)/(b + a*x)^2)^2, x, 6, x*log((c*x^2)/(b + a*x)^2)^2 + (4*b*log((c*x^2)/(b + a*x)^2)*log(b/(b + a*x)))/a + (8*b*PolyLog(2, 1 - b/(b + a*x)))/a]
    @test_int [log((c*x^2)/(b + a*x)^2)^3, x, 5, x*log((c*x^2)/(b + a*x)^2)^3 + (6*b*log((c*x^2)/(b + a*x)^2)^2*log(b/(b + a*x)))/a + (24*b*log((c*x^2)/(b + a*x)^2)*PolyLog(2, (a*x)/(b + a*x)))/a - (48*b*PolyLog(3, (a*x)/(b + a*x)))/a]

    @test_int [PolyLog(2, 1 + (b*c - a*d)/(d*(a + b*x)))/((a + b*x)*(c + d*x)), x, 1, -(PolyLog(3, 1 + (b*c - a*d)/(d*(a + b*x)))/(b*c - a*d))]

    @test_int [log((e*(c + d*x))/(a + b*x))*log(((-b)*c + a*d)/(d*(a + b*x)))/((a + b*x)*(c + d*x)), x, 2, (log((e*(c + d*x))/(a + b*x))*PolyLog(2, 1 + (b*c - a*d)/(d*(a + b*x))))/(b*c - a*d) - PolyLog(3, 1 + (b*c - a*d)/(d*(a + b*x)))/(b*c - a*d)]

    @test_int [log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2/(a + b*x), x, 4, -((log(((-b)*c + a*d)/(d*(a + b*x)))*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2)/b) - (2*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*PolyLog(2, (b*(c + d*x))/(d*(a + b*x))))/b + (2*PolyLog(3, (b*(c + d*x))/(d*(a + b*x))))/b]

    @test_int [log((e*(c + d*x))/(a + b*x))*log((((-b)*c + a*d)*(e + f*x))/((d*e - c*f)*(a + b*x)))/((a + b*x)*(c + d*x)), x, 2, (log((e*(c + d*x))/(a + b*x))*PolyLog(2, 1 + ((b*c - a*d)*(e + f*x))/((d*e - c*f)*(a + b*x))))/(b*c - a*d) - PolyLog(3, 1 + ((b*c - a*d)*(e + f*x))/((d*e - c*f)*(a + b*x)))/(b*c - a*d)]

    @test_int [log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2/((a + b*x)*(e + f*x)), x, 4, -((log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2*log(1 - ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/(b*e - a*f)) - (2*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*PolyLog(2, ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/(b*e - a*f) + (2*PolyLog(3, ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/(b*e - a*f)]

    @test_int [log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2/(e + f*x), x, 9, -((log(-((b*c - a*d)/(d*(a + b*x))))*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2)/f) + (log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2*log(1 - ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/f - (2*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*PolyLog(2, (b*(c + d*x))/(d*(a + b*x))))/f + (2*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*PolyLog(2, ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/f + (2*PolyLog(3, (b*(c + d*x))/(d*(a + b*x))))/f - (2*PolyLog(3, ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/f]

    @test_int [log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*log((b*(e + f*x))/(b*e - a*f))/((a + b*x)*(c + d*x)), x, 10, -((log(-((b*c - a*d)/(d*(a + b*x))))*log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2)/(2*(b*c - a*d))) - (log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2*log((b*(e + f*x))/(b*e - a*f)))/(2*(b*c - a*d)) + (log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))^2*log(1 - ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/(2*(b*c - a*d)) - (log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*PolyLog(2, (b*(c + d*x))/(d*(a + b*x))))/(b*c - a*d) + (log(((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))*PolyLog(2, ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x))))/(b*c - a*d) + PolyLog(3, (b*(c + d*x))/(d*(a + b*x)))/(b*c - a*d) - PolyLog(3, ((b*e - a*f)*(c + d*x))/((d*e - c*f)*(a + b*x)))/(b*c - a*d)]
    end

max_stars_repo_path: test/3 Logarithms/3.2.3 u log(e (f (a+b x)^p (c+d x)^q)^r)^s.jl


text:
facts("Tensor-CUR") do

context("Small case") do
    T = rand_kruskal3(2, (20, 40, 60), false)
    for i in 1:3
        context("slab axis: $i") do
            @time factors = tensorcur3(T, 3, 15, i)
            @fact sum(factors.Cweight) --> 3
            @fact sum(factors.Rweight) --> 15
            @fact all(factors.error .< 1e-5) --> true
        end
    end
end

context("Large case without reconstruction") do
    T = rand_kruskal3(2, (100, 120, 60), false)
    @time factors = tensorcur3(T, 10, 200, compute_u=false)
    @fact sum(factors.Cweight) --> 10
    @fact sum(factors.Rweight) --> 200
    @fact size(factors.U) --> (0, 0)
    @fact size(factors.error) --> (0,)
end

end

ext: jl


text:
using Documenter, ArnoldiMethod

makedocs(
	modules = [ArnoldiMethod],
	format = :html,
	doctest = false,
	clean = true,
	sitename = "ArnoldiMethod.jl",
	pages = [
		"Home" => "index.md",
		"Theory" => "theory.md",
		"Using ArnoldiMethod.jl" => [
			"Getting started" => "usage/01_getting_started.md",
			"Transformations" => "usage/02_spectral_transformations.md"
		]
	]
)

deploydocs(
	repo = "github.com/JuliaLinearAlgebra/ArnoldiMethod.jl.git",
	target = "build",
	osname = "linux",
	julia  = "0.7",
	deps = nothing,
	make = nothing,
)


text:
export default_if_empty

import Base: show

"""
    default_if_empty(value::T)
    default_if_empty(callback::Function)

Creates a `default_if_empty` operator, which emits a given value if the source Observable completes
without emitting any next value, otherwise mirrors the source Observable. Optionally accepts a zero-argument callback that will be executed to generate default value.
Note: Callback function's output is always `convert`ed to the `eltype` of the original observable.

```jldoctest
using Rocket

source = completed(Int) |> default_if_empty(0)

subscribe!(source, logger())
;

# output
[LogActor] Data: 0
[LogActor] Completed
```

```jldoctest
using Rocket

source = completed(Int) |> default_if_empty(() -> 42)

subscribe!(source, logger())
;

# output
[LogActor] Data: 42
[LogActor] Completed
```

See also: [`AbstractOperator`](@ref), [`InferableOperator`](@ref), [`logger`](@ref), [`map`](@ref)
"""
default_if_empty(value_or_callback::T) where T = DefaultIfEmptyOperator{T}(value_or_callback)

struct DefaultIfEmptyOperator{T} <: InferableOperator
    value_or_callback :: T
end

operator_right(::DefaultIfEmptyOperator{T}, ::Type{L}) where { L, T }             = Union{L, T}
operator_right(::DefaultIfEmptyOperator{T}, ::Type{L}) where { L, T <: Function } = L

function on_call!(::Type{L}, ::Type{Union{L, T}}, operator::DefaultIfEmptyOperator{T}, source) where { L, T }
    return proxy(Union{L, T}, source, DefaultIfEmptyProxy{Union{L, T}, T}(convert(Union{L, T}, operator.value_or_callback)))
end

function on_call!(::Type{L}, ::Type{L}, operator::DefaultIfEmptyOperator{T}, source) where { L, T <: Function }
    return proxy(L, source, DefaultIfEmptyProxy{L, T}(operator.value_or_callback))
end

struct DefaultIfEmptyProxy{L, T} <: ActorProxy
    default_or_callback :: T
end

actor_proxy!(::Type, proxy::DefaultIfEmptyProxy{L, T}, actor::A) where { L, A, T } = DefaultIfEmptyActor{L, A, T}(actor, false, proxy.default_or_callback)

mutable struct DefaultIfEmptyActor{L, A, T} <: Actor{L}
    actor               :: A
    is_emitted          :: Bool
    default_or_callback :: T
end

is_emmited(actor::DefaultIfEmptyActor)   = actor.is_emitted
set_emmited!(actor::DefaultIfEmptyActor) = actor.is_emitted = true

release!(::DefaultIfEmptyActor{L}, callback::Function, actor) where { L } = next!(actor, convert(L, callback()))
release!(::DefaultIfEmptyActor{L}, default::L, actor) where { L }         = next!(actor, default)

function on_next!(actor::DefaultIfEmptyActor{L}, data::L) where L
    set_emmited!(actor)
    next!(actor.actor, data)
end

function on_error!(actor::DefaultIfEmptyActor, err)
    set_emmited!(actor)
    error!(actor.actor, err)
end

function on_complete!(actor::DefaultIfEmptyActor)
    if !is_emmited(actor)
        set_emmited!(actor)
        release!(actor, actor.default_or_callback, actor.actor)
    end
    complete!(actor.actor)
end

Base.show(io::IO, ::DefaultIfEmptyOperator{T}) where T = print(io, "DefaultIfEmptyOperator($T)")
Base.show(io::IO, ::DefaultIfEmptyProxy{L})    where L = print(io, "DefaultIfEmptyProxy($L)")
Base.show(io::IO, ::DefaultIfEmptyActor{L})    where L = print(io, "DefaultIfEmptyActor($L)")


text:
using Distributions

function gendata2(k, n, percentile_cutoff, rho)
    X = rand(1:k, n)
    if rho > 0
        Y = ifelse.(rand(Uniform(0,1),length(X)) .<= rho, X, rand(1:k,length(X)))
    else
        Y = rand(1:k, n)
    end
    A = Matrix(freqtable(X,Y))
    threshold = floor.(Int, percentile(vec(A),percentile_cutoff))
    observed_A = @. ifelse(A > threshold, A, 0)
    independent_A = sum(A,dims = 2) * sum(A,dims = 1) ./ sum(A)
    A = @. ifelse(A==0,1,A)
    (obs=observed_A, gen=A, ind = independent_A, threshold=threshold)
end

function mean_absolute_error(data, prediction)
    sum(abs.(data.gen .- prediction)) / count(ismissing.(data.obs))
end

function complete_trival(a, a_obs, threshold)

    if !all(a .== a_obs)

        a_row_sum = [sum(a[i,:]) for i in 1:size(a)[1]]
        a_col_sum = [sum(a[:,j]) for j in 1:size(a)[2]]

        singleton_row = [size(a)[2] - sum(sign.(a_obs[i,:])) for i in 1:size(a)[1]]
        singleton_col = [size(a)[1] - sum(sign.(a_obs[:,j])) for j in 1:size(a)[2]]

        singleton = any(vcat(singleton_row, singleton_col) .== 1)

        while singleton

        a_row_sum_current = [sum(a_obs[i,:]) for i in 1:size(a)[1]]
        a_col_sum_current = [sum(a_obs[:,j]) for j in 1:size(a)[2]]

            for i in 1:size(a_obs)[1]
                for j in 1:size(a_obs)[2]
                    if singleton_row[i] == 1 && a_obs[i,j] == 0
                        a_obs[i,j] = a_row_sum[i] - a_row_sum_current[i]
                        singleton_row[i] = 0
                        singleton_col[j] -= 1
                        a_row_sum_current = [sum(a_obs[i,:]) for i in 1:size(a)[1]]
                        a_col_sum_current = [sum(a_obs[:,j]) for j in 1:size(a)[2]]
                    end
                    if singleton_col[j] == 1 && a_obs[i,j] == 0
                        a_obs[i,j] = a_col_sum[j] - a_col_sum_current[j]
                        singleton_col[j] = 0
                        singleton_row[i] -= 1
                        a_row_sum_current = [sum(a_obs[i,:]) for i in 1:size(a)[1]]
                        a_col_sum_current = [sum(a_obs[:,j]) for j in 1:size(a)[2]]
                    end
                end
            end

            for i in 1:size(a_obs)[1]
                if (sum(1 .- sign.(a_obs[i,:])) * threshold) == (a_row_sum[i] - a_row_sum_current[i]) && (sum(sign.(a_obs[i,:])) < length(axes(a_obs,2)))
                    for j in 1:size(a_obs)[2]
                        if a_obs[i,j] == 0
                            a_obs[i,j] = threshold
                        end
                    end
                end
            end

            for j in 1:size(a_obs)[2]
                if (sum(1 .- sign.(a_obs[:,j])) * threshold) == (a_col_sum[j] - a_col_sum_current[j]) && (sum(sign.(a_obs[:,j])) < length(axes(a_obs,1)))
                    for i in 1:size(a_obs)[1]
                        if a_obs[i,j] == 0
                            a_obs[i,j] = threshold
                        end
                    end
                end
            end

        singleton_row = [size(a)[2] - sum(sign.(a_obs[i,:])) for i in 1:size(a)[1]]
        singleton_col = [size(a)[1] - sum(sign.(a_obs[:,j])) for j in 1:size(a)[2]]

            singleton = any(vcat(singleton_row, singleton_col) .== 1)

        end
    end

    a_obs

end

function compare_single(N, k, percentile_cutoff, rho = 0, correction = true)
    data_sampled = gendata(rand(2:k),N,percentile_cutoff,rho)
    if !(any(data_sampled.gen .== 0))
        #println((N,k,percentile_cutoff))
        mae_ipf = mean_absolute_error(data_sampled, IFP_with_threshold(data_sampled))
        #println(1)
        mae_mys = mean_absolute_error(data_sampled, mySampling2(data_sampled))
        #println(2)
        mae_knn = mean_absolute_error(data_sampled, knnSampling2(data_sampled))
        #println(3)
        (N, k, percentile_cutoff, mae_ipf, mae_mys, mae_knn, cramer_v(data_sampled.gen), rho)
    end
end

function compare_all(N_range, k_range, percentile_cutoff_range, rho_range, niter, correction)
    results = []
    println(length(N_range) * length(k_range) * length(percentile_cutoff_range) * length(rho_range) * niter)
    for N in N_range
        for k in k_range
            for percentile_cutoff in percentile_cutoff_range
                for rho in rho_range
                    for iter in 1:niter
                        try
                            push!(results, compare_single(N, k, percentile_cutoff, rho, correction))
                        catch e
                        end
                    end
                end
            end
        end
    end
    results
end

function create_correlated(N, k, rho)
    X_k = rand(2:k)
    Y_k = rand(2:k)
    X = rand(1:X_k, N)
    if rho > 0
        Y = generate_correlated(X, rho, Y_k)
    else
        Y = rand(1:Y_k, N)
    end
    A = FreqTables.freqtable(X,Y)
end

function cramer_v(a, corrected = true)
    n = sum(a)
    phi = chi_sq(a) / n
    k = size(a)[2]
    r = size(a)[1]
    if corrected
        phi_hat = max(0, phi - (k-1) * (r-1)/(n-1))
        k_hat = k - (k-1)^2 / (n-1)
        r_hat = r - (r-1)^2 / (n-1)
        sqrt(phi_hat / min(k_hat-1,r_hat-1))
    else
        sqrt(phi / min(k-1,r-1))
    end
end

function chi_sq(a)

    row_sums = [sum(a[i,:]) for i in 1:size(a)[1]]
    col_sums = [sum(a[:,j]) for j in 1:size(a)[2]]

    a_hat = row_sums * transpose(col_sums) ./ sum(a)

    sum((a .- a_hat).^2 ./ a_hat)

end

function tapply(x, index)
    res = Float64[]
    for i in sort(unique(index))
        push!(res, mean(x[(index .== i) .& (.!isnan.(x) )]))
    end
    res
end

function range_tapply(x, index, range)
        res = Float64[]
        ranges = collect(range)
        for r in 1:(length(ranges)-1)
            push!(res,mean(x[(index .>= ranges[r]) .& (index .< ranges[r+1]) .& .!(isnan.(x))]))
        end
        res
end

max_stars_repo_name: Michal-Kot/FillMissingEntries

max_issues_repo_name: Michal-Kot/FillMissingEntries

max_forks_repo_name: Michal-Kot/FillMissingEntries


text:
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder

name = "bliss"
version = v"0.73"

# Collection of sources required to build bliss
sources = [
    "http://www.tcs.hut.fi/Software/bliss/bliss-0.73.zip" =>
    "f57bf32804140cad58b1240b804e0dbd68f7e6bf67eba8e0c0fa3a62fd7f0f84",
]

# Bash recipe for building across all platforms
script = raw"""
cd bliss-0.73
sed -i -e 's/^namespace bliss/#define BLISS_USE_GMP\n\nnamespace bliss/' defs.hh
make -j lib_gmp CFLAGS="-I$prefix/include -O3 -fPIC -I." LDFLAGS="$LDFLAGS -L$prefix/lib" CC="$CXX"
$CXX -shared -o libbliss.$dlext *.og $LDFLAGS -L$prefix/lib -lgmp
mkdir -p $prefix/include/bliss
mkdir -p $prefix/lib
install -p -m 0644 -t $prefix/include/bliss *.hh
install -p libbliss.$dlext $prefix/lib
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
# no sys/times.h on windows
platforms = filter(x->!isa(x,Windows),supported_platforms())

# The products that we will ensure are always built
products(prefix) = [
    LibraryProduct(prefix, "libbliss", :libbliss)
]

# Dependencies that must be installed before this package can be built
dependencies = [
    "https://github.com/JuliaPackaging/Yggdrasil/releases/download/GMP-v6.1.2-1/build_GMP.v6.1.2.jl"
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

max_stars_repo_name: benlorenz/blissBuilder

max_issues_repo_name: benlorenz/blissBuilder

max_forks_repo_name: benlorenz/blissBuilder


text:
#############################################################################
#Copyright (c) 2016 Charles Le Losq
#
#The MIT License (MIT)
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the #Software without restriction, including without limitation the rights to use, copy, #modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, #and to permit persons to whom the Software is furnished to do so, subject to the #following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#############################################################################
function mlregressor(x::Array{Float64},y::Array{Float64},algorithm::AbstractString;X_test::Array{Float64}=[0.0],y_test::Array{Float64}=[0.0],rand_state=42,validation_size = 0.33,param_grid_kr = Dict("alpha"=> [1e1, 1e0, 0.5, 0.1, 5e-2, 1e-2, 5e-3, 1e-3],"gamma"=> logspace(-4, 4, 9)),param_grid_svm=Dict("C"=> [1e0, 2e0, 5e0, 1e1, 5e1, 1e2, 5e2, 1e3, 5e3, 1e4, 5e4, 1e5],"gamma"=> logspace(-4, 4, 9)),user_kernel="rbf")

	if size(X_test,1) == 1
		X_train, X_test, y_train, y_test = cross_validation.train_test_split(x, reshape(y,size(y,1),1), test_size=test_sz, random_state=rand_state)
	elseif size(X_test,2) == size(x,2)
		X_train = x[:,:]
		y_train = y[:,:]
	else
		error("You tried to provide a testing dataset that has a different number of features (in columns) than the training set. Please correct this.")
	end

	# to avoid any problem with SciKit Learn quite annoying demands for the shape of arrays...
	y_train =reshape(y_train,size(y_train,1),1)
	y_test = reshape(y_test,size(y_test,1),1)

	# initialising the preprocessor scaler
	X_scaler = preprocessing[:StandardScaler]()
	Y_scaler = preprocessing[:StandardScaler]()

	X_scaler[:fit](X_train)
	Y_scaler[:fit](y_train)

	#scaling the data
	X_train_sc = X_scaler[:transform](X_train)
	y_train_sc = Y_scaler[:transform](y_train)

	X_test_sc = X_scaler[:transform](X_test)
	y_test_sc = Y_scaler[:transform](y_test)

	if algorithm=="KernelRidge"
		clf_kr = kernel_ridge[:KernelRidge](kernel=user_kernel, gamma=0.1)
		model = grid_search[:GridSearchCV](clf_kr,cv=5,param_grid=param_grid_kr)
	elseif algorithm=="SVM"
		clf_svm = svm[:SVR](kernel=user_kernel, gamma=0.1)
		model = grid_search[:GridSearchCV](clf_svm,cv=5,param_grid=param_grid_svm)
	elseif algorithm=="LinearRegression"
		model = linear_model[:LinearRegression]()
	end

	model[:fit](X_train_sc, squeeze(y_train_sc,2))
	predict_train_sc = model[:predict](X_train_sc)
	prediction_train = Y_scaler[:inverse_transform](predict_train_sc)
	predict_test_sc = model[:predict](X_test_sc)
	prediction_test = Y_scaler[:inverse_transform](predict_test_sc)

	return prediction_train, prediction_test, model, X_scaler, Y_scaler
end


text:
"""
    R = JenksClassification(n,X)

Jenks Natural Breaks Optimzation algorithm. Default parameters

    JenksClassification(n::Int,                             # number of classes
                        X::Array{T,1};                      # data
                        errornorm::Int=1,                   # L1, or L2 errornorm
                        maxiter::Int=200,                   # number of iterations
                        flux::Real=0.1,                     # flux [fraction] of values from one class to another
                        fluxadjust::Real=1.03,              # change in flux depending on previous flux direction
                        fluxadjust_bothways::Bool=true,     # lower flux or also increase flux (=bothways)
                        inimode::String="maxentropy",       # initialisation method
                        feedback::Bool=true                 # feedback on progress and convergence

# Examples

```jldoc
julia> R = JenksClassification(5,rand(10000));
100%: ARE=0.05014468, finished in 0.01s.

julia> R.breaks
6-element Array{Int64,1}:
     1
  1972
  3993
  6041
  8002
 10001
```
"""
function JenksClassification(n::Int,X::Array{T,1};
                            errornorm::Int=1,
                            maxiter::Int=200,
                            flux::Real=0.1,
                            fluxadjust::Real=1.03,
                            fluxadjust_bothways::Bool=true,
                            inimode::String="maxentropy",
                            feedback::Bool=true) where {T<:AbstractFloat}

    sort!(X)
    ndata = length(X)

    # initialise a JenksResult struct
    JR = JenksResult(n,X,errornorm=errornorm,maxiter=maxiter,flux=flux)
    JR.ndata = ndata

    # Initialisation
    breaks = JR.breaks                      # breaks is a view on the data in JR.breaks
    breaks[:] = BreaksInit(n,X,inimode)     # lower bounds of every class as index of X
    SDAM = SqDeviation(X)                   # squared deviation from array mean (this is constant)
    DEVs = Array{Float64,1}(undef,n)        # Deviations from class centre for each class (lin/sq)
    DEVs_pre = Array{Float64,1}(undef,n)    # Deviations from previous iteration

    # Rename deviation function (linear vs squared)
    if errornorm == 1
        Deviation = LinDeviation
    elseif errornorm == 2
        Deviation = SqDeviation
    else
        throw(error("Errornorm '$errornorm' not defined."))
    end

    if errornorm == 1
        JR.AREhistory[1] = ARE(X,breaks)
    else
        JR.GVFhistory[1] = GVF(X,breaks)
    end

    # automatic flux adjustment
    fluxes = JR.fluxes

    t0 = time()
    for iter in 1:maxiter

        DEVs_pre .= DEVs

        # Get the lin/squared deviations for all classes
        for iclass in 1:n
            DEVs[iclass] = Deviation(ClassValues(X,breaks,iclass))
        end

        # shift class bounds
        for iclass in 1:n-1

            a,b,c = breaks[iclass:iclass+2]         # for class sizes

            # compare deviations between two adjacent classes
            if DEVs[iclass] < DEVs[iclass+1]

                # adjust fluxes based on history
                if iter > 1
                    if DEVs_pre[iclass] >= DEVs_pre[iclass+1]    # flux was previously in opposite direction
                        fluxes[iclass] /= fluxadjust             # decrease flux
                    elseif fluxadjust_bothways                          # flux was previously in same direction
                        fluxes[iclass] *= fluxadjust             # increase flux
                    end
                end

                # class size factor: Bigger classes give away more data points
                # shift data points to the class with smaller DEV
                cs_factor = Int(round((b-a)*fluxes[iclass]))
                newbreak = breaks[iclass+1]+cs_factor
                breaks[iclass+1] = min(newbreak,breaks[iclass+2]-2)
            else

                # adjust fluxes based on history
                if iter > 1
                    if DEVs_pre[iclass] <= DEVs_pre[iclass+1]    # flux was previously in opposite direction
                        fluxes[iclass] /= fluxadjust
                    elseif fluxadjust_bothways
                        fluxes[iclass] *= fluxadjust
                    end
                end

                cs_factor = Int(round((c-b)*fluxes[iclass]))
                newbreak = breaks[iclass+1]-cs_factor
                breaks[iclass+1] = max(newbreak,breaks[iclass]+2)
            end
        end

        # calculate global errors and store them
        if errornorm == 1
            AREnow = sum(DEVs)/ndata
            JR.AREhistory[iter+1] = AREnow
        else
            GVFnow = 1-sum(DEVs)/SDAM
            JR.GVFhistory[iter+1] = GVFnow
        end

        # provide average rounding error / goodness of variance feedback
        if feedback
            percent = Int(round(iter/maxiter*100))

            if errornorm == 1
                AREstring = @sprintf "%.8f" AREnow
                print("\r\u1b[K")
                print("$percent%: ARE=$AREstring")
            else
                GVFstring = @sprintf "%.8f" GVFnow
                print("\r\u1b[K")
                print("$percent%: GVF=$GVFstring")
            end
        end
    end
    JR.dt = time() - t0
    feedback ? println(@sprintf ", finished in %.2fs." JR.dt) : nothing

    # Store both errornorms in JR struct
    if errornorm == 1
        JR.ARE = sum(DEVs)/ndata
        JR.GVF = GVF(X,breaks)
    else
        JR.GVF = 1-sum(DEVs)/SDAM
        JR.ARE = ARE(X,breaks)
    end

    # convert breaks to centres and class sizes
    Breaks2Centres!(JR,X)
    Breaks2ClassSize!(JR)
    Breaks2Bounds!(JR,X)

    return JR
end

"""Returns the data point values for a given class i, provided the data X and
the breaks. Assumes the data array X to be sorted."""
function ClassValues(X::Array{T,1},breaks::Array{Int,1},i::Int) where {T<:AbstractFloat}
    return X[breaks[i]:breaks[i+1]-1]
end


text:
# This file holds the definition of the Recruitment type. This type is used to
#   describe a recruitment scheme for a specific part of the organisation and
#   defines which attributes need to be initialised and what the distributions
#   of those attributes are.

export Recruitment
"""
The `Recruitment` type described a recruitment scheme, allowing new personnel members to enter the organisation into a specific nodes.

The type contains the following fields:
* `name::String`: the name of the recruitment scheme.
* `freq::Float64`: the period of the recruitment cycle. Default = 1.0
* `offset::Float64`: the offset of the recruitment cycle w.r.t. the start of the simulation. Default = 0.0
* `targetNode::BaseNode`: the target node of the recruitment scheme.
* `minRecruitment::Int`: the minimum number of personnel members to recruit during a single recruitment step. This is only used for adaptive recruitment schemes. Default = 0
* `maxRecruitment::Int`: the maximum number of personnel members to recruit during a single recruitment step, where -1 stands for no upper limit. This is only used for adaptive recruitment schemes. Default = -1
* `recruitmentDistType::Symbol`: the type of the distribution of the number of people to recruit. Supported types are `:disc` (pointwise), `:pUnif` (piecewise uniform), and `:pLin` (piecewise linear). This is only used for non-adaptive recruitment schemes. Default = `:disc`
* `recruitmentDistNodes::Dict{Int,Float64}`: the nodes of the distribution of the number of people to recruit. These are given as number/weight pairs. Default: Dict( 0 => 1.0 )
* `ageDistType::Symbol`: the type of the distribution of the ages of the recruited people. Supported types are `:disc` (pointwise), `:pUnif` (piecewise uniform), and `:pLin` (piecewise linear). This is only used for non-adaptive recruitment schemes. Default = `:disc`
* `ageDistNodes::Dict{Float64,Float64}`: the nodes of the distribution of the ages of the recruited people. These are given as age/weight pairs. Default: Dict( 0.0 => 1.0 )

Several additional fields are used to speed up computations:
* `isAdaptive::Bool`: a flag indicating whether the recruitment scheme is adaptive or not.
* `recruitmentDist::Function`: the function that draws a sample from the distribution of the number of people to recruit.
* `ageDist::Function`: the function that draws a sample from the distrubiton of the recruitment age.
* `priority::Int`: the priority of the SimJulia process of this recruitment scheme.
* `recRNG::MersenneTwister`: the random stream that generates the number of people to recruit during each recruitment cycle.
* `ageRNG::MersenneTwister`: the random stream that generates the ages of the newly recruited personnel members.

Constructor:
```
Recruitment( name::String )
```
This constructor creates a `Recruitment` object with name `name`, and zero recruitment defined.
"""
mutable struct Recruitment

    name::String
    freq::Float64
    offset::Float64
    targetNode::String
    minRecruitment::Int
    maxRecruitment::Int
    recruitmentDistType::Symbol
    recruitmentDistNodes::Dict{Int,Float64}
    ageDistType::Symbol
    ageDistNodes::Dict{Float64,Float64}

    isAdaptive::Bool
    recruitmentDist::Function
    ageDist::Function
    priority::Int
    recRNG::MersenneTwister
    ageRNG::MersenneTwister

    function Recruitment( name::String )

        newRec = new()
        newRec.name = name
        newRec.freq = 1.0
        newRec.offset = 0.0
        newRec.targetNode = "dummy"
        newRec.minRecruitment = 0
        newRec.maxRecruitment = -1
        newRec.recruitmentDistType = :disc
        newRec.recruitmentDistNodes = Dict( 0 => 1.0 )
        newRec.ageDistType = :disc
        newRec.ageDistNodes = Dict( 0.0 => 1.0 )

        newRec.isAdaptive = false
        newRec.recruitmentDist = function() return 0 end
        newRec.ageDist = function( n::Integer ) return zeros( Float64, n ) end
        newRec.priority = 1
        newRec.recRNG = MersenneTwister()
        newRec.ageRNG = MersenneTwister()
        return newRec

    end  # Recruitment( name )

end  # mutable struct Recruitment