text:
@testset "6.2.1 (c+d x)^m (a+b cosh)^n" begin
    (a, b, c, d, e, f, m, n, x, ) = @variables a b c d e f m n x

    #= ::Package:: =#

    #= ::Title:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+b*cosh(e+f*x))^n=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(b*cosh(e+f*x))^n=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*cosh(e+f*x)^n=#

    #= ::Subsubsection::Closed:: =#
    #=n>0=#

    @test_int [(c + d*x)^4*cosh(a + b*x), x, 5, (-24*d^3*(c + d*x)*cosh(a + b*x))/b^4 - (4*d*(c + d*x)^3*cosh(a + b*x))/b^2 + (24*d^4*sinh(a + b*x))/b^5 + (12*d^2*(c + d*x)^2*sinh(a + b*x))/b^3 + ((c + d*x)^4*sinh(a + b*x))/b]
    @test_int [(c + d*x)^3*cosh(a + b*x), x, 4, (-6*d^3*cosh(a + b*x))/b^4 - (3*d*(c + d*x)^2*cosh(a + b*x))/b^2 + (6*d^2*(c + d*x)*sinh(a + b*x))/b^3 + ((c + d*x)^3*sinh(a + b*x))/b]
    @test_int [(c + d*x)^2*cosh(a + b*x), x, 3, (-2*d*(c + d*x)*cosh(a + b*x))/b^2 + (2*d^2*sinh(a + b*x))/b^3 + ((c + d*x)^2*sinh(a + b*x))/b]
    @test_int [(c + d*x)*cosh(a + b*x), x, 2, -((d*cosh(a + b*x))/b^2) + ((c + d*x)*sinh(a + b*x))/b]
    @test_int [cosh(a + b*x)/(c + d*x), x, 3, (cosh(a - (b*c)/d)*CoshIntegral((b*c)/d + b*x))/d + (sinh(a - (b*c)/d)*SinhIntegral((b*c)/d + b*x))/d]
    @test_int [cosh(a + b*x)/(c + d*x)^2, x, 4, -(cosh(a + b*x)/(d*(c + d*x))) + (b*CoshIntegral((b*c)/d + b*x)*sinh(a - (b*c)/d))/d^2 + (b*cosh(a - (b*c)/d)*SinhIntegral((b*c)/d + b*x))/d^2]
    @test_int [cosh(a + b*x)/(c + d*x)^3, x, 5, -cosh(a + b*x)/(2*d*(c + d*x)^2) + (b^2*cosh(a - (b*c)/d)*CoshIntegral((b*c)/d + b*x))/(2*d^3) - (b*sinh(a + b*x))/(2*d^2*(c + d*x)) + (b^2*sinh(a - (b*c)/d)*SinhIntegral((b*c)/d + b*x))/(2*d^3)]

    @test_int [(c + d*x)^4*cosh(a + b*x)^2, x, 6, (3*d^4*x)/(4*b^4) + (d*(c + d*x)^3)/(2*b^2) + (c + d*x)^5/(10*d) - (3*d^3*(c + d*x)*cosh(a + b*x)^2)/(2*b^4) - (d*(c + d*x)^3*cosh(a + b*x)^2)/b^2 + (3*d^4*cosh(a + b*x)*sinh(a + b*x))/(4*b^5) + (3*d^2*(c + d*x)^2*cosh(a + b*x)*sinh(a + b*x))/(2*b^3) + ((c + d*x)^4*cosh(a + b*x)*sinh(a + b*x))/(2*b)]
    @test_int [(c + d*x)^3*cosh(a + b*x)^2, x, 4, (3*c*d^2*x)/(4*b^2) + (3*d^3*x^2)/(8*b^2) + (c + d*x)^4/(8*d) - (3*d^3*cosh(a + b*x)^2)/(8*b^4) - (3*d*(c + d*x)^2*cosh(a + b*x)^2)/(4*b^2) + (3*d^2*(c + d*x)*cosh(a + b*x)*sinh(a + b*x))/(4*b^3) + ((c + d*x)^3*cosh(a + b*x)*sinh(a + b*x))/(2*b)]
    @test_int [(c + d*x)^2*cosh(a + b*x)^2, x, 4, (d^2*x)/(4*b^2) + (c + d*x)^3/(6*d) - (d*(c + d*x)*cosh(a + b*x)^2)/(2*b^2) + (d^2*cosh(a + b*x)*sinh(a + b*x))/(4*b^3) + ((c + d*x)^2*cosh(a + b*x)*sinh(a + b*x))/(2*b)]
    @test_int [(c + d*x)*cosh(a + b*x)^2, x, 2, (c*x)/2 + (d*x^2)/4 - (d*cosh(a + b*x)^2)/(4*b^2) + ((c + d*x)*cosh(a + b*x)*sinh(a + b*x))/(2*b)]
    @test_int [cosh(a + b*x)^2/(c + d*x), x, 5, (cosh(2*a - (2*b*c)/d)*CoshIntegral((2*b*c)/d + 2*b*x))/(2*d) + log(c + d*x)/(2*d) + (sinh(2*a - (2*b*c)/d)*SinhIntegral((2*b*c)/d + 2*b*x))/(2*d)]
    @test_int [cosh(a + b*x)^2/(c + d*x)^2, x, 5, -(cosh(a + b*x)^2/(d*(c + d*x))) + (b*CoshIntegral((2*b*c)/d + 2*b*x)*sinh(2*a - (2*b*c)/d))/d^2 + (b*cosh(2*a - (2*b*c)/d)*SinhIntegral((2*b*c)/d + 2*b*x))/d^2]
    @test_int [cosh(a + b*x)^2/(c + d*x)^3, x, 7, -cosh(a + b*x)^2/(2*d*(c + d*x)^2) + (b^2*cosh(2*a - (2*b*c)/d)*CoshIntegral((2*b*c)/d + 2*b*x))/d^3 - (b*cosh(a + b*x)*sinh(a + b*x))/(d^2*(c + d*x)) + (b^2*sinh(2*a - (2*b*c)/d)*SinhIntegral((2*b*c)/d + 2*b*x))/d^3]
    @test_int [cosh(a + b*x)^2/(c + d*x)^4, x, 7, b^2/(3*d^3*(c + d*x)) - cosh(a + b*x)^2/(3*d*(c + d*x)^3) - (2*b^2*cosh(a + b*x)^2)/(3*d^3*(c + d*x)) + (2*b^3*CoshIntegral((2*b*c)/d + 2*b*x)*sinh(2*a - (2*b*c)/d))/(3*d^4) - (b*cosh(a + b*x)*sinh(a + b*x))/(3*d^2*(c + d*x)^2) + (2*b^3*cosh(2*a - (2*b*c)/d)*SinhIntegral((2*b*c)/d + 2*b*x))/(3*d^4)]

    @test_int [(c + d*x)^4*cosh(a + b*x)^3, x, 12, (-160*d^3*(c + d*x)*cosh(a + b*x))/(9*b^4) - (8*d*(c + d*x)^3*cosh(a + b*x))/(3*b^2) - (8*d^3*(c + d*x)*cosh(a + b*x)^3)/(27*b^4) - (4*d*(c + d*x)^3*cosh(a + b*x)^3)/(9*b^2) + (488*d^4*sinh(a + b*x))/(27*b^5) + (80*d^2*(c + d*x)^2*sinh(a + b*x))/(9*b^3) + (2*(c + d*x)^4*sinh(a + b*x))/(3*b) + (4*d^2*(c + d*x)^2*cosh(a + b*x)^2*sinh(a + b*x))/(9*b^3) + ((c + d*x)^4*cosh(a + b*x)^2*sinh(a + b*x))/(3*b) + (8*d^4*sinh(a + b*x)^3)/(81*b^5)]
    @test_int [(c + d*x)^3*cosh(a + b*x)^3, x, 8, (-40*d^3*cosh(a + b*x))/(9*b^4) - (2*d*(c + d*x)^2*cosh(a + b*x))/b^2 - (2*d^3*cosh(a + b*x)^3)/(27*b^4) - (d*(c + d*x)^2*cosh(a + b*x)^3)/(3*b^2) + (40*d^2*(c + d*x)*sinh(a + b*x))/(9*b^3) + (2*(c + d*x)^3*sinh(a + b*x))/(3*b) + (2*d^2*(c + d*x)*cosh(a + b*x)^2*sinh(a + b*x))/(9*b^3) + ((c + d*x)^3*cosh(a + b*x)^2*sinh(a + b*x))/(3*b)]
    @test_int [(c + d*x)^2*cosh(a + b*x)^3, x, 6, (-4*d*(c + d*x)*cosh(a + b*x))/(3*b^2) - (2*d*(c + d*x)*cosh(a + b*x)^3)/(9*b^2) + (14*d^2*sinh(a + b*x))/(9*b^3) + (2*(c + d*x)^2*sinh(a + b*x))/(3*b) + ((c + d*x)^2*cosh(a + b*x)^2*sinh(a + b*x))/(3*b) + (2*d^2*sinh(a + b*x)^3)/(27*b^3)]
    @test_int [(c + d*x)*cosh(a + b*x)^3, x, 3, (-2*d*cosh(a + b*x))/(3*b^2) - (d*cosh(a + b*x)^3)/(9*b^2) + (2*(c + d*x)*sinh(a + b*x))/(3*b) + ((c + d*x)*cosh(a + b*x)^2*sinh(a + b*x))/(3*b)]
    @test_int [cosh(a + b*x)^3/(c + d*x), x, 8, (3*cosh(a - (b*c)/d)*CoshIntegral((b*c)/d + b*x))/(4*d) + (cosh(3*a - (3*b*c)/d)*CoshIntegral((3*b*c)/d + 3*b*x))/(4*d) + (3*sinh(a - (b*c)/d)*SinhIntegral((b*c)/d + b*x))/(4*d) + (sinh(3*a - (3*b*c)/d)*SinhIntegral((3*b*c)/d + 3*b*x))/(4*d)]
    @test_int [cosh(a + b*x)^3/(c + d*x)^2, x, 8, -(cosh(a + b*x)^3/(d*(c + d*x))) + (3*b*CoshIntegral((3*b*c)/d + 3*b*x)*sinh(3*a - (3*b*c)/d))/(4*d^2) + (3*b*CoshIntegral((b*c)/d + b*x)*sinh(a - (b*c)/d))/(4*d^2) + (3*b*cosh(a - (b*c)/d)*SinhIntegral((b*c)/d + b*x))/(4*d^2) + (3*b*cosh(3*a - (3*b*c)/d)*SinhIntegral((3*b*c)/d + 3*b*x))/(4*d^2)]
    @test_int [cosh(a + b*x)^3/(c + d*x)^3, x, 12, -cosh(a + b*x)^3/(2*d*(c + d*x)^2) + (3*b^2*cosh(a - (b*c)/d)*CoshIntegral((b*c)/d + b*x))/(8*d^3) + (9*b^2*cosh(3*a - (3*b*c)/d)*CoshIntegral((3*b*c)/d + 3*b*x))/(8*d^3) - (3*b*cosh(a + b*x)^2*sinh(a + b*x))/(2*d^2*(c + d*x)) + (3*b^2*sinh(a - (b*c)/d)*SinhIntegral((b*c)/d + b*x))/(8*d^3) + (9*b^2*sinh(3*a - (3*b*c)/d)*SinhIntegral((3*b*c)/d + 3*b*x))/(8*d^3)]

    @test_int [x^3*cosh(a + b*x)^4, x, 8, (45*x^2)/(128*b^2) + (3*x^4)/32 - (45*cosh(a + b*x)^2)/(128*b^4) - (9*x^2*cosh(a + b*x)^2)/(16*b^2) - (3*cosh(a + b*x)^4)/(128*b^4) - (3*x^2*cosh(a + b*x)^4)/(16*b^2) + (45*x*cosh(a + b*x)*sinh(a + b*x))/(64*b^3) + (3*x^3*cosh(a + b*x)*sinh(a + b*x))/(8*b) + (3*x*cosh(a + b*x)^3*sinh(a + b*x))/(32*b^3) + (x^3*cosh(a + b*x)^3*sinh(a + b*x))/(4*b)]
    @test_int [x^2*cosh(a + b*x)^4, x, 8, (15*x)/(64*b^2) + x^3/8 - (3*x*cosh(a + b*x)^2)/(8*b^2) - (x*cosh(a + b*x)^4)/(8*b^2) + (15*cosh(a + b*x)*sinh(a + b*x))/(64*b^3) + (3*x^2*cosh(a + b*x)*sinh(a + b*x))/(8*b) + (cosh(a + b*x)^3*sinh(a + b*x))/(32*b^3) + (x^2*cosh(a + b*x)^3*sinh(a + b*x))/(4*b)]
    @test_int [x^1*cosh(a + b*x)^4, x, 3, (3*x^2)/16 - (3*cosh(a + b*x)^2)/(16*b^2) - cosh(a + b*x)^4/(16*b^2) + (3*x*cosh(a + b*x)*sinh(a + b*x))/(8*b) + (x*cosh(a + b*x)^3*sinh(a + b*x))/(4*b)]

    #= ::Subsubsection::Closed:: =#
    #=n<0=#

    @test_int [(c + d*x)^3*sech(a + b*x), x, 9, (2*(c + d*x)^3*atan(ℯ^(a + b*x)))/b - ((3*im)*d*(c + d*x)^2*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^2 + ((3*im)*d*(c + d*x)^2*PolyLog(2, im*ℯ^(a + b*x)))/b^2 + ((6*im)*d^2*(c + d*x)*PolyLog(3, (-im)*ℯ^(a + b*x)))/b^3 - ((6*im)*d^2*(c + d*x)*PolyLog(3, im*ℯ^(a + b*x)))/b^3 - ((6*im)*d^3*PolyLog(4, (-im)*ℯ^(a + b*x)))/b^4 + ((6*im)*d^3*PolyLog(4, im*ℯ^(a + b*x)))/b^4]
    @test_int [(c + d*x)^2*sech(a + b*x), x, 7, (2*(c + d*x)^2*atan(ℯ^(a + b*x)))/b - ((2*im)*d*(c + d*x)*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^2 + ((2*im)*d*(c + d*x)*PolyLog(2, im*ℯ^(a + b*x)))/b^2 + ((2*im)*d^2*PolyLog(3, (-im)*ℯ^(a + b*x)))/b^3 - ((2*im)*d^2*PolyLog(3, im*ℯ^(a + b*x)))/b^3]
    @test_int [(c + d*x)*sech(a + b*x), x, 5, (2*(c + d*x)*atan(ℯ^(a + b*x)))/b - (im*d*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^2 + (im*d*PolyLog(2, im*ℯ^(a + b*x)))/b^2]
    @test_int [sech(a + b*x)/(c + d*x), x, 0, Unintegrable(sech(a + b*x)/(c + d*x), x)]
    @test_int [sech(a + b*x)/(c + d*x)^2, x, 0, Unintegrable(sech(a + b*x)/(c + d*x)^2, x)]

    @test_int [(c + d*x)^3*sech(a + b*x)^2, x, 6, (c + d*x)^3/b - (3*d*(c + d*x)^2*log(1 + ℯ^(2*(a + b*x))))/b^2 - (3*d^2*(c + d*x)*PolyLog(2, -ℯ^(2*(a + b*x))))/b^3 + (3*d^3*PolyLog(3, -ℯ^(2*(a + b*x))))/(2*b^4) + ((c + d*x)^3*tanh(a + b*x))/b]
    @test_int [(c + d*x)^2*sech(a + b*x)^2, x, 5, (c + d*x)^2/b - (2*d*(c + d*x)*log(1 + ℯ^(2*(a + b*x))))/b^2 - (d^2*PolyLog(2, -ℯ^(2*(a + b*x))))/b^3 + ((c + d*x)^2*tanh(a + b*x))/b]
    @test_int [(c + d*x)*sech(a + b*x)^2, x, 2, -((d*log(cosh(a + b*x)))/b^2) + ((c + d*x)*tanh(a + b*x))/b]
    @test_int [sech(a + b*x)^2/(c + d*x), x, 0, Unintegrable(sech(a + b*x)^2/(c + d*x), x)]
    @test_int [sech(a + b*x)^2/(c + d*x)^2, x, 0, Unintegrable(sech(a + b*x)^2/(c + d*x)^2, x)]

    @test_int [(c + d*x)^3*sech(a + b*x)^3, x, 15, (-6*d^2*(c + d*x)*atan(ℯ^(a + b*x)))/b^3 + ((c + d*x)^3*atan(ℯ^(a + b*x)))/b + ((3*im)*d^3*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^4 - (((3*im)/2)*d*(c + d*x)^2*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^2 - ((3*im)*d^3*PolyLog(2, im*ℯ^(a + b*x)))/b^4 + (((3*im)/2)*d*(c + d*x)^2*PolyLog(2, im*ℯ^(a + b*x)))/b^2 + ((3*im)*d^2*(c + d*x)*PolyLog(3, (-im)*ℯ^(a + b*x)))/b^3 - ((3*im)*d^2*(c + d*x)*PolyLog(3, im*ℯ^(a + b*x)))/b^3 - ((3*im)*d^3*PolyLog(4, (-im)*ℯ^(a + b*x)))/b^4 + ((3*im)*d^3*PolyLog(4, im*ℯ^(a + b*x)))/b^4 + (3*d*(c + d*x)^2*sech(a + b*x))/(2*b^2) + ((c + d*x)^3*sech(a + b*x)*tanh(a + b*x))/(2*b)]
    @test_int [(c + d*x)^2*sech(a + b*x)^3, x, 9, ((c + d*x)^2*atan(ℯ^(a + b*x)))/b - (d^2*atan(sinh(a + b*x)))/b^3 - (im*d*(c + d*x)*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^2 + (im*d*(c + d*x)*PolyLog(2, im*ℯ^(a + b*x)))/b^2 + (im*d^2*PolyLog(3, (-im)*ℯ^(a + b*x)))/b^3 - (im*d^2*PolyLog(3, im*ℯ^(a + b*x)))/b^3 + (d*(c + d*x)*sech(a + b*x))/b^2 + ((c + d*x)^2*sech(a + b*x)*tanh(a + b*x))/(2*b)]
    @test_int [(c + d*x)*sech(a + b*x)^3, x, 6, ((c + d*x)*atan(ℯ^(a + b*x)))/b - ((im/2)*d*PolyLog(2, (-im)*ℯ^(a + b*x)))/b^2 + ((im/2)*d*PolyLog(2, im*ℯ^(a + b*x)))/b^2 + (d*sech(a + b*x))/(2*b^2) + ((c + d*x)*sech(a + b*x)*tanh(a + b*x))/(2*b)]
    @test_int [sech(a + b*x)^3/(c + d*x), x, 0, Unintegrable(sech(a + b*x)^3/(c + d*x), x)]
    @test_int [sech(a + b*x)^3/(c + d*x)^2, x, 0, Unintegrable(sech(a + b*x)^3/(c + d*x)^2, x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^(m/2)*cosh(e+f*x)^n=#

    #= ::Subsubsection::Closed:: =#
    #=n>0=#

    @test_int [(c + d*x)^(5/2)*cosh(a + b*x), x, 8, (-5*d*(c + d*x)^(3/2)*cosh(a + b*x))/(2*b^2) + (15*d^(5/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(16*b^(7/2)) - (15*d^(5/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(16*b^(7/2)) + (15*d^2*sqrt(c + d*x)*sinh(a + b*x))/(4*b^3) + ((c + d*x)^(5/2)*sinh(a + b*x))/b]
    @test_int [(c + d*x)^(3/2)*cosh(a + b*x), x, 7, (-3*d*sqrt(c + d*x)*cosh(a + b*x))/(2*b^2) + (3*d^(3/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(8*b^(5/2)) + (3*d^(3/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(8*b^(5/2)) + ((c + d*x)^(3/2)*sinh(a + b*x))/b]
    @test_int [sqrt(c + d*x)*cosh(a + b*x), x, 6, (sqrt(d)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*b^(3/2)) - (sqrt(d)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*b^(3/2)) + (sqrt(c + d*x)*sinh(a + b*x))/b]
    @test_int [cosh(a + b*x)/sqrt(c + d*x), x, 5, (ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(2*sqrt(b)*sqrt(d)) + (ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(2*sqrt(b)*sqrt(d))]
    @test_int [cosh(a + b*x)/(c + d*x)^(3/2), x, 6, (-2*cosh(a + b*x))/(d*sqrt(c + d*x)) - (sqrt(b)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/d^(3/2) + (sqrt(b)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/d^(3/2)]
    @test_int [cosh(a + b*x)/(c + d*x)^(5/2), x, 7, (-2*cosh(a + b*x))/(3*d*(c + d*x)^(3/2)) + (2*b^(3/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(3*d^(5/2)) + (2*b^(3/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(3*d^(5/2)) - (4*b*sinh(a + b*x))/(3*d^2*sqrt(c + d*x))]
    @test_int [cosh(a + b*x)/(c + d*x)^(7/2), x, 8, (-2*cosh(a + b*x))/(5*d*(c + d*x)^(5/2)) - (8*b^2*cosh(a + b*x))/(15*d^3*sqrt(c + d*x)) - (4*b^(5/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(15*d^(7/2)) + (4*b^(5/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(15*d^(7/2)) - (4*b*sinh(a + b*x))/(15*d^2*(c + d*x)^(3/2))]

    @test_int [(c + d*x)^(5/2)*cosh(a + b*x)^2, x, 10, (5*d*(c + d*x)^(3/2))/(16*b^2) + (c + d*x)^(7/2)/(7*d) - (5*d*(c + d*x)^(3/2)*cosh(a + b*x)^2)/(8*b^2) + (15*d^(5/2)*ℯ^(-2*a + (2*b*c)/d)*sqrt(pi/2)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(256*b^(7/2)) - (15*d^(5/2)*ℯ^(2*a - (2*b*c)/d)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(256*b^(7/2)) + ((c + d*x)^(5/2)*cosh(a + b*x)*sinh(a + b*x))/(2*b) + (15*d^2*sqrt(c + d*x)*sinh(2*a + 2*b*x))/(64*b^3)]
    @test_int [(c + d*x)^(3/2)*cosh(a + b*x)^2, x, 9, (3*d*sqrt(c + d*x))/(16*b^2) + (c + d*x)^(5/2)/(5*d) - (3*d*sqrt(c + d*x)*cosh(a + b*x)^2)/(8*b^2) + (3*d^(3/2)*ℯ^(-2*a + (2*b*c)/d)*sqrt(pi/2)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(64*b^(5/2)) + (3*d^(3/2)*ℯ^(2*a - (2*b*c)/d)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(64*b^(5/2)) + ((c + d*x)^(3/2)*cosh(a + b*x)*sinh(a + b*x))/(2*b)]
    @test_int [sqrt(c + d*x)*cosh(a + b*x)^2, x, 8, (c + d*x)^(3/2)/(3*d) + (sqrt(d)*ℯ^(-2*a + (2*b*c)/d)*sqrt(pi/2)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(16*b^(3/2)) - (sqrt(d)*ℯ^(2*a - (2*b*c)/d)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(16*b^(3/2)) + (sqrt(c + d*x)*sinh(2*a + 2*b*x))/(4*b)]
    @test_int [cosh(a + b*x)^2/sqrt(c + d*x), x, 7, sqrt(c + d*x)/d + (ℯ^(-2*a + (2*b*c)/d)*sqrt(pi/2)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*sqrt(b)*sqrt(d)) + (ℯ^(2*a - (2*b*c)/d)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*sqrt(b)*sqrt(d))]
    @test_int [cosh(a + b*x)^2/(c + d*x)^(3/2), x, 7, (-2*cosh(a + b*x)^2)/(d*sqrt(c + d*x)) - (sqrt(b)*ℯ^(-2*a + (2*b*c)/d)*sqrt(pi/2)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/d^(3/2) + (sqrt(b)*ℯ^(2*a - (2*b*c)/d)*sqrt(pi/2)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/d^(3/2)]
    @test_int [cosh(a + b*x)^2/(c + d*x)^(5/2), x, 9, (-2*cosh(a + b*x)^2)/(3*d*(c + d*x)^(3/2)) + (2*b^(3/2)*ℯ^(-2*a + (2*b*c)/d)*sqrt(2*pi)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(3*d^(5/2)) + (2*b^(3/2)*ℯ^(2*a - (2*b*c)/d)*sqrt(2*pi)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(3*d^(5/2)) - (8*b*cosh(a + b*x)*sinh(a + b*x))/(3*d^2*sqrt(c + d*x))]
    @test_int [cosh(a + b*x)^2/(c + d*x)^(7/2), x, 9, (16*b^2)/(15*d^3*sqrt(c + d*x)) - (2*cosh(a + b*x)^2)/(5*d*(c + d*x)^(5/2)) - (32*b^2*cosh(a + b*x)^2)/(15*d^3*sqrt(c + d*x)) - (8*b^(5/2)*ℯ^(-2*a + (2*b*c)/d)*sqrt(2*pi)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(15*d^(7/2)) + (8*b^(5/2)*ℯ^(2*a - (2*b*c)/d)*sqrt(2*pi)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(15*d^(7/2)) - (8*b*cosh(a + b*x)*sinh(a + b*x))/(15*d^2*(c + d*x)^(3/2))]
    @test_int [cosh(a + b*x)^2/(c + d*x)^(9/2), x, 11, (16*b^2)/(105*d^3*(c + d*x)^(3/2)) - (2*cosh(a + b*x)^2)/(7*d*(c + d*x)^(7/2)) - (32*b^2*cosh(a + b*x)^2)/(105*d^3*(c + d*x)^(3/2)) + (32*b^(7/2)*ℯ^(-2*a + (2*b*c)/d)*sqrt(2*pi)*erf((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(105*d^(9/2)) + (32*b^(7/2)*ℯ^(2*a - (2*b*c)/d)*sqrt(2*pi)*erfi((sqrt(2)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(105*d^(9/2)) - (8*b*cosh(a + b*x)*sinh(a + b*x))/(35*d^2*(c + d*x)^(5/2)) - (128*b^3*cosh(a + b*x)*sinh(a + b*x))/(105*d^4*sqrt(c + d*x))]

    @test_int [(c + d*x)^(5/2)*cosh(a + b*x)^3, x, 23, (-5*d*(c + d*x)^(3/2)*cosh(a + b*x))/(3*b^2) - (5*d*(c + d*x)^(3/2)*cosh(a + b*x)^3)/(18*b^2) + (45*d^(5/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(64*b^(7/2)) + (5*d^(5/2)*ℯ^(-3*a + (3*b*c)/d)*sqrt(pi/3)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(576*b^(7/2)) - (45*d^(5/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(64*b^(7/2)) - (5*d^(5/2)*ℯ^(3*a - (3*b*c)/d)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(576*b^(7/2)) + (45*d^2*sqrt(c + d*x)*sinh(a + b*x))/(16*b^3) + (2*(c + d*x)^(5/2)*sinh(a + b*x))/(3*b) + ((c + d*x)^(5/2)*cosh(a + b*x)^2*sinh(a + b*x))/(3*b) + (5*d^2*sqrt(c + d*x)*sinh(3*a + 3*b*x))/(144*b^3)]
    @test_int [(c + d*x)^(3/2)*cosh(a + b*x)^3, x, 20, -((d*sqrt(c + d*x)*cosh(a + b*x))/b^2) - (d*sqrt(c + d*x)*cosh(a + b*x)^3)/(6*b^2) + (9*d^(3/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(32*b^(5/2)) + (d^(3/2)*ℯ^(-3*a + (3*b*c)/d)*sqrt(pi/3)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(96*b^(5/2)) + (9*d^(3/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(32*b^(5/2)) + (d^(3/2)*ℯ^(3*a - (3*b*c)/d)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(96*b^(5/2)) + (2*(c + d*x)^(3/2)*sinh(a + b*x))/(3*b) + ((c + d*x)^(3/2)*cosh(a + b*x)^2*sinh(a + b*x))/(3*b)]
    @test_int [sqrt(c + d*x)*cosh(a + b*x)^3, x, 14, (3*sqrt(d)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(16*b^(3/2)) + (sqrt(d)*ℯ^(-3*a + (3*b*c)/d)*sqrt(pi/3)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(48*b^(3/2)) - (3*sqrt(d)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(16*b^(3/2)) - (sqrt(d)*ℯ^(3*a - (3*b*c)/d)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(48*b^(3/2)) + (3*sqrt(c + d*x)*sinh(a + b*x))/(4*b) + (sqrt(c + d*x)*sinh(3*a + 3*b*x))/(12*b)]
    @test_int [cosh(a + b*x)^3/sqrt(c + d*x), x, 12, (3*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(8*sqrt(b)*sqrt(d)) + (ℯ^(-3*a + (3*b*c)/d)*sqrt(pi/3)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(8*sqrt(b)*sqrt(d)) + (3*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(8*sqrt(b)*sqrt(d)) + (ℯ^(3*a - (3*b*c)/d)*sqrt(pi/3)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(8*sqrt(b)*sqrt(d))]
    @test_int [cosh(a + b*x)^3/(c + d*x)^(3/2), x, 12, (-2*cosh(a + b*x)^3)/(d*sqrt(c + d*x)) - (3*sqrt(b)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*d^(3/2)) - (sqrt(b)*ℯ^(-3*a + (3*b*c)/d)*sqrt(3*pi)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*d^(3/2)) + (3*sqrt(b)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*d^(3/2)) + (sqrt(b)*ℯ^(3*a - (3*b*c)/d)*sqrt(3*pi)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(4*d^(3/2))]
    @test_int [cosh(a + b*x)^3/(c + d*x)^(5/2), x, 18, (-2*cosh(a + b*x)^3)/(3*d*(c + d*x)^(3/2)) + (b^(3/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(2*d^(5/2)) + (b^(3/2)*ℯ^(-3*a + (3*b*c)/d)*sqrt(3*pi)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(2*d^(5/2)) + (b^(3/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(2*d^(5/2)) + (b^(3/2)*ℯ^(3*a - (3*b*c)/d)*sqrt(3*pi)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(2*d^(5/2)) - (4*b*cosh(a + b*x)^2*sinh(a + b*x))/(d^2*sqrt(c + d*x))]
    @test_int [cosh(a + b*x)^3/(c + d*x)^(7/2), x, 19, (16*b^2*cosh(a + b*x))/(5*d^3*sqrt(c + d*x)) - (2*cosh(a + b*x)^3)/(5*d*(c + d*x)^(5/2)) - (24*b^2*cosh(a + b*x)^3)/(5*d^3*sqrt(c + d*x)) - (b^(5/2)*ℯ^(-a + (b*c)/d)*sqrt(pi)*erf((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(5*d^(7/2)) - (3*b^(5/2)*ℯ^(-3*a + (3*b*c)/d)*sqrt(3*pi)*erf((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(5*d^(7/2)) + (b^(5/2)*ℯ^(a - (b*c)/d)*sqrt(pi)*erfi((sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(5*d^(7/2)) + (3*b^(5/2)*ℯ^(3*a - (3*b*c)/d)*sqrt(3*pi)*erfi((sqrt(3)*sqrt(b)*sqrt(c + d*x))/sqrt(d)))/(5*d^(7/2)) - (4*b*cosh(a + b*x)^2*sinh(a + b*x))/(5*d^2*(c + d*x)^(3/2))]

    @test_int [(d*x)^(3/2)*cosh(f*x), x, 7, (-3*d*sqrt(d*x)*cosh(f*x))/(2*f^2) + (3*d^(3/2)*sqrt(pi)*erf((sqrt(f)*sqrt(d*x))/sqrt(d)))/(8*f^(5/2)) + (3*d^(3/2)*sqrt(pi)*erfi((sqrt(f)*sqrt(d*x))/sqrt(d)))/(8*f^(5/2)) + ((d*x)^(3/2)*sinh(f*x))/f]
    @test_int [sqrt(d*x)*cosh(f*x), x, 6, (sqrt(d)*sqrt(pi)*erf((sqrt(f)*sqrt(d*x))/sqrt(d)))/(4*f^(3/2)) - (sqrt(d)*sqrt(pi)*erfi((sqrt(f)*sqrt(d*x))/sqrt(d)))/(4*f^(3/2)) + (sqrt(d*x)*sinh(f*x))/f]
    @test_int [cosh(f*x)/sqrt(d*x), x, 5, (sqrt(pi)*erf((sqrt(f)*sqrt(d*x))/sqrt(d)))/(2*sqrt(d)*sqrt(f)) + (sqrt(pi)*erfi((sqrt(f)*sqrt(d*x))/sqrt(d)))/(2*sqrt(d)*sqrt(f))]
    @test_int [cosh(f*x)/(d*x)^(3/2), x, 6, (-2*cosh(f*x))/(d*sqrt(d*x)) - (sqrt(f)*sqrt(pi)*erf((sqrt(f)*sqrt(d*x))/sqrt(d)))/d^(3/2) + (sqrt(f)*sqrt(pi)*erfi((sqrt(f)*sqrt(d*x))/sqrt(d)))/d^(3/2)]
    @test_int [cosh(f*x)/(d*x)^(5/2), x, 7, (-2*cosh(f*x))/(3*d*(d*x)^(3/2)) + (2*f^(3/2)*sqrt(pi)*erf((sqrt(f)*sqrt(d*x))/sqrt(d)))/(3*d^(5/2)) + (2*f^(3/2)*sqrt(pi)*erfi((sqrt(f)*sqrt(d*x))/sqrt(d)))/(3*d^(5/2)) - (4*f*sinh(f*x))/(3*d^2*sqrt(d*x))]

    #= ::Subsubsection::Closed:: =#
    #=n<0=#

    @test_int [sqrt(c + d*x)*sech(a + b*x), x, 0, Unintegrable(sqrt(c + d*x)*sech(a + b*x), x)]
    @test_int [sech(a + b*x)/sqrt(c + d*x), x, 0, Unintegrable(sech(a + b*x)/sqrt(c + d*x), x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(b*cosh(e+f*x))^(n/2)=#

    #= ::Subsubsection::Closed:: =#
    #=n>0=#

    @test_int [cosh(x)^(3/2)/x^3, x, 1, -cosh(x)^(3/2)/(2*x^2) - (3*sqrt(cosh(x))*sinh(x))/(4*x) - (3*Unintegrable(1/(x*sqrt(cosh(x))), x))/8 + (9*Unintegrable(cosh(x)^(3/2)/x, x))/8]

    #= ::Subsubsection::Closed:: =#
    #=n<0=#

    @test_int [x/cosh(x)^(3/2) + x*sqrt(cosh(x)), x, 2, -4*sqrt(cosh(x)) + (2*x*sinh(x))/sqrt(cosh(x))]
    @test_int [x/cosh(x)^(5/2) - x/(3*sqrt(cosh(x))), x, 2, 4/(3*sqrt(cosh(x))) + (2*x*sinh(x))/(3*cosh(x)^(3/2))]
    @test_int [x/cosh(x)^(7/2) + (3*x*sqrt(cosh(x)))/5, x, 3, 4/(15*cosh(x)^(3/2)) - (12*sqrt(cosh(x)))/5 + (2*x*sinh(x))/(5*cosh(x)^(5/2)) + (6*x*sinh(x))/(5*sqrt(cosh(x)))]
    @test_int [x^2/cosh(x)^(3/2) + x^2*sqrt(cosh(x)), x, 3, -8*x*sqrt(cosh(x)) - (16*im)*Elliptic.E((im/2)*x, 2) + (2*x^2*sinh(x))/sqrt(cosh(x))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(b*cosh(e+f*x))^n*with*m*symbolic=#

    @test_int [(c + d*x)^m*(b*cosh(e + f*x))^n, x, 0, Unintegrable((c + d*x)^m*(b*cosh(e + f*x))^n, x)]

    @test_int [(c + d*x)^m*cosh(a + b*x)^3, x, 8, (3^(-1 - m)*ℯ^(3*a - (3*b*c)/d)*(c + d*x)^m*Gamma(1 + m, (-3*b*(c + d*x))/d))/(8*b*(-((b*(c + d*x))/d))^m) + (3*ℯ^(a - (b*c)/d)*(c + d*x)^m*Gamma(1 + m, -((b*(c + d*x))/d)))/(8*b*(-((b*(c + d*x))/d))^m) - (3*ℯ^(-a + (b*c)/d)*(c + d*x)^m*Gamma(1 + m, (b*(c + d*x))/d))/(8*b*((b*(c + d*x))/d)^m) - (3^(-1 - m)*ℯ^(-3*a + (3*b*c)/d)*(c + d*x)^m*Gamma(1 + m, (3*b*(c + d*x))/d))/(8*b*((b*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*cosh(a + b*x)^2, x, 5, (c + d*x)^(1 + m)/(2*d*(1 + m)) + (2^(-3 - m)*ℯ^(2*a - (2*b*c)/d)*(c + d*x)^m*Gamma(1 + m, (-2*b*(c + d*x))/d))/(b*(-((b*(c + d*x))/d))^m) - (2^(-3 - m)*ℯ^(-2*a + (2*b*c)/d)*(c + d*x)^m*Gamma(1 + m, (2*b*(c + d*x))/d))/(b*((b*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*cosh(a + b*x), x, 3, (ℯ^(a - (b*c)/d)*(c + d*x)^m*Gamma(1 + m, -((b*(c + d*x))/d)))/(2*b*(-((b*(c + d*x))/d))^m) - (ℯ^(-a + (b*c)/d)*(c + d*x)^m*Gamma(1 + m, (b*(c + d*x))/d))/(2*b*((b*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*sech(a + b*x), x, 0, Unintegrable((c + d*x)^m*sech(a + b*x), x)]
    @test_int [(c + d*x)^m*sech(a + b*x)^2, x, 0, Unintegrable((c + d*x)^m*sech(a + b*x)^2, x)]

    @test_int [x^(3 + m)*cosh(a + b*x), x, 3, -(ℯ^a*x^m*Gamma(4 + m, -(b*x)))/(2*b^4*(-(b*x))^m) - (x^m*Gamma(4 + m, b*x))/(2*b^4*ℯ^a*(b*x)^m)]
    @test_int [x^(2 + m)*cosh(a + b*x), x, 3, (ℯ^a*x^m*Gamma(3 + m, -(b*x)))/(2*b^3*(-(b*x))^m) - (x^m*Gamma(3 + m, b*x))/(2*b^3*ℯ^a*(b*x)^m)]
    @test_int [x^(1 + m)*cosh(a + b*x), x, 3, -(ℯ^a*x^m*Gamma(2 + m, -(b*x)))/(2*b^2*(-(b*x))^m) - (x^m*Gamma(2 + m, b*x))/(2*b^2*ℯ^a*(b*x)^m)]
    @test_int [x^m*cosh(a + b*x), x, 3, (ℯ^a*x^m*Gamma(1 + m, -(b*x)))/(2*b*(-(b*x))^m) - (x^m*Gamma(1 + m, b*x))/(2*b*ℯ^a*(b*x)^m)]
    @test_int [x^(-1 + m)*cosh(a + b*x), x, 3, -(ℯ^a*x^m*Gamma(m, -(b*x)))/(2*(-(b*x))^m) - (x^m*Gamma(m, b*x))/(2*ℯ^a*(b*x)^m)]
    @test_int [x^(-2 + m)*cosh(a + b*x), x, 3, (b*ℯ^a*x^m*Gamma(-1 + m, -(b*x)))/(2*(-(b*x))^m) - (b*x^m*Gamma(-1 + m, b*x))/(2*ℯ^a*(b*x)^m)]
    @test_int [x^(-3 + m)*cosh(a + b*x), x, 3, -(b^2*ℯ^a*x^m*Gamma(-2 + m, -(b*x)))/(2*(-(b*x))^m) - (b^2*x^m*Gamma(-2 + m, b*x))/(2*ℯ^a*(b*x)^m)]

    @test_int [x^(3 + m)*cosh(a + b*x)^2, x, 5, x^(4 + m)/(2*(4 + m)) - (2^(-6 - m)*ℯ^(2*a)*x^m*Gamma(4 + m, -2*b*x))/(b^4*(-(b*x))^m) - (2^(-6 - m)*x^m*Gamma(4 + m, 2*b*x))/(b^4*ℯ^(2*a)*(b*x)^m)]
    @test_int [x^(2 + m)*cosh(a + b*x)^2, x, 5, x^(3 + m)/(2*(3 + m)) + (2^(-5 - m)*ℯ^(2*a)*x^m*Gamma(3 + m, -2*b*x))/(b^3*(-(b*x))^m) - (2^(-5 - m)*x^m*Gamma(3 + m, 2*b*x))/(b^3*ℯ^(2*a)*(b*x)^m)]
    @test_int [x^(1 + m)*cosh(a + b*x)^2, x, 5, x^(2 + m)/(2*(2 + m)) - (2^(-4 - m)*ℯ^(2*a)*x^m*Gamma(2 + m, -2*b*x))/(b^2*(-(b*x))^m) - (2^(-4 - m)*x^m*Gamma(2 + m, 2*b*x))/(b^2*ℯ^(2*a)*(b*x)^m)]
    @test_int [x^m*cosh(a + b*x)^2, x, 5, x^(1 + m)/(2*(1 + m)) + (2^(-3 - m)*ℯ^(2*a)*x^m*Gamma(1 + m, -2*b*x))/(b*(-(b*x))^m) - (2^(-3 - m)*x^m*Gamma(1 + m, 2*b*x))/(b*ℯ^(2*a)*(b*x)^m)]
    @test_int [x^(-1 + m)*cosh(a + b*x)^2, x, 5, x^m/(2*m) - (2^(-2 - m)*ℯ^(2*a)*x^m*Gamma(m, -2*b*x))/(-(b*x))^m - (2^(-2 - m)*x^m*Gamma(m, 2*b*x))/(ℯ^(2*a)*(b*x)^m)]
    @test_int [x^(-2 + m)*cosh(a + b*x)^2, x, 5, -x^(-1 + m)/(2*(1 - m)) + (2^(-1 - m)*b*ℯ^(2*a)*x^m*Gamma(-1 + m, -2*b*x))/(-(b*x))^m - (2^(-1 - m)*b*x^m*Gamma(-1 + m, 2*b*x))/(ℯ^(2*a)*(b*x)^m)]
    @test_int [x^(-3 + m)*cosh(a + b*x)^2, x, 5, -x^(-2 + m)/(2*(2 - m)) - (b^2*ℯ^(2*a)*x^m*Gamma(-2 + m, -2*b*x))/(2^m*(-(b*x))^m) - (b^2*x^m*Gamma(-2 + m, 2*b*x))/(2^m*ℯ^(2*a)*(b*x)^m)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(b*sech(e+f*x))^n=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(b*sech(e+f*x))^(n/2)=#

    @test_int [x/sech(x)^(3/2) - (x*sqrt(sech(x)))/3, x, 4, -4/(9*sech(x)^(3/2)) + (2*x*sinh(x))/(3*sqrt(sech(x)))]
    @test_int [x/sech(x)^(5/2) - (3*x)/(5*sqrt(sech(x))), x, 4, -4/(25*sech(x)^(5/2)) + (2*x*sinh(x))/(5*sech(x)^(3/2))]
    @test_int [x/sech(x)^(7/2) - (5*x*sqrt(sech(x)))/21, x, 5, -4/(49*sech(x)^(7/2)) - 20/(63*sech(x)^(3/2)) + (2*x*sinh(x))/(7*sech(x)^(5/2)) + (10*x*sinh(x))/(21*sqrt(sech(x)))]
    @test_int [x^2/sech(x)^(3/2) - (x^2*sqrt(sech(x)))/3, x, 7, (-8*x)/(9*sech(x)^(3/2)) - ((16*im)/27)*sqrt(cosh(x))*Elliptic.F((im/2)*x, 2)*sqrt(sech(x)) + (16*sinh(x))/(27*sqrt(sech(x))) + (2*x^2*sinh(x))/(3*sqrt(sech(x)))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+b*cosh(e+f*x))^n*with*a^2-b^2=0=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+a*cosh(e+f*x))^n=#

    #= ::Subsubsection::Closed:: =#
    #=n>0=#

    @test_int [(c + d*x)^3*(a + a*cosh(e + f*x)), x, 6, (a*(c + d*x)^4)/(4*d) - (6*a*d^3*cosh(e + f*x))/f^4 - (3*a*d*(c + d*x)^2*cosh(e + f*x))/f^2 + (6*a*d^2*(c + d*x)*sinh(e + f*x))/f^3 + (a*(c + d*x)^3*sinh(e + f*x))/f]
    @test_int [(c + d*x)^2*(a + a*cosh(e + f*x)), x, 5, (a*(c + d*x)^3)/(3*d) - (2*a*d*(c + d*x)*cosh(e + f*x))/f^2 + (2*a*d^2*sinh(e + f*x))/f^3 + (a*(c + d*x)^2*sinh(e + f*x))/f]
    @test_int [(c + d*x)*(a + a*cosh(e + f*x)), x, 4, (a*(c + d*x)^2)/(2*d) - (a*d*cosh(e + f*x))/f^2 + (a*(c + d*x)*sinh(e + f*x))/f]
    @test_int [(a + a*cosh(e + f*x))/(c + d*x), x, 5, (a*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/d + (a*log(c + d*x))/d + (a*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d]
    @test_int [(a + a*cosh(e + f*x))/(c + d*x)^2, x, 6, -(a/(d*(c + d*x))) - (a*cosh(e + f*x))/(d*(c + d*x)) + (a*f*CoshIntegral((c*f)/d + f*x)*sinh(e - (c*f)/d))/d^2 + (a*f*cosh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d^2]
    @test_int [(a + a*cosh(e + f*x))/(c + d*x)^3, x, 7, -(a/(2*d*(c + d*x)^2)) - (a*cosh(e + f*x))/(2*d*(c + d*x)^2) + (a*f^2*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/(2*d^3) - (a*f*sinh(e + f*x))/(2*d^2*(c + d*x)) + (a*f^2*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/(2*d^3)]

    @test_int [(c + d*x)^3*(a + a*cosh(e + f*x))^2, x, 10, (3*a^2*c*d^2*x)/(4*f^2) + (3*a^2*d^3*x^2)/(8*f^2) + (3*a^2*(c + d*x)^4)/(8*d) - (12*a^2*d^3*cosh(e + f*x))/f^4 - (6*a^2*d*(c + d*x)^2*cosh(e + f*x))/f^2 - (3*a^2*d^3*cosh(e + f*x)^2)/(8*f^4) - (3*a^2*d*(c + d*x)^2*cosh(e + f*x)^2)/(4*f^2) + (12*a^2*d^2*(c + d*x)*sinh(e + f*x))/f^3 + (2*a^2*(c + d*x)^3*sinh(e + f*x))/f + (3*a^2*d^2*(c + d*x)*cosh(e + f*x)*sinh(e + f*x))/(4*f^3) + (a^2*(c + d*x)^3*cosh(e + f*x)*sinh(e + f*x))/(2*f)]
    @test_int [(c + d*x)^2*(a + a*cosh(e + f*x))^2, x, 9, (a^2*d^2*x)/(4*f^2) + (a^2*(c + d*x)^3)/(2*d) - (4*a^2*d*(c + d*x)*cosh(e + f*x))/f^2 - (a^2*d*(c + d*x)*cosh(e + f*x)^2)/(2*f^2) + (4*a^2*d^2*sinh(e + f*x))/f^3 + (2*a^2*(c + d*x)^2*sinh(e + f*x))/f + (a^2*d^2*cosh(e + f*x)*sinh(e + f*x))/(4*f^3) + (a^2*(c + d*x)^2*cosh(e + f*x)*sinh(e + f*x))/(2*f)]
    @test_int [(c + d*x)*(a + a*cosh(e + f*x))^2, x, 6, (1/2)*a^2*c*x + (1/4)*a^2*d*x^2 + (a^2*(c + d*x)^2)/(2*d) - (2*a^2*d*cosh(e + f*x))/f^2 - (a^2*d*cosh(e + f*x)^2)/(4*f^2) + (2*a^2*(c + d*x)*sinh(e + f*x))/f + (a^2*(c + d*x)*cosh(e + f*x)*sinh(e + f*x))/(2*f)]
    @test_int [(a + a*cosh(e + f*x))^2/(c + d*x), x, 9, (2*a^2*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/d + (a^2*cosh(2*e - (2*c*f)/d)*CoshIntegral((2*c*f)/d + 2*f*x))/(2*d) + (3*a^2*log(c + d*x))/(2*d) + (2*a^2*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d + (a^2*sinh(2*e - (2*c*f)/d)*SinhIntegral((2*c*f)/d + 2*f*x))/(2*d)]
    @test_int [(a + a*cosh(e + f*x))^2/(c + d*x)^2, x, 9, (-4*a^2*cosh(e/2 + (f*x)/2)^4)/(d*(c + d*x)) + (a^2*f*CoshIntegral((2*c*f)/d + 2*f*x)*sinh(2*e - (2*c*f)/d))/d^2 + (2*a^2*f*CoshIntegral((c*f)/d + f*x)*sinh(e - (c*f)/d))/d^2 + (2*a^2*f*cosh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d^2 + (a^2*f*cosh(2*e - (2*c*f)/d)*SinhIntegral((2*c*f)/d + 2*f*x))/d^2]
    @test_int [(a + a*cosh(e + f*x))^2/(c + d*x)^3, x, 15, (-2*a^2*cosh(e/2 + (f*x)/2)^4)/(d*(c + d*x)^2) + (a^2*f^2*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/d^3 + (a^2*f^2*cosh(2*e - (2*c*f)/d)*CoshIntegral((2*c*f)/d + 2*f*x))/d^3 - (4*a^2*f*cosh(e/2 + (f*x)/2)^3*sinh(e/2 + (f*x)/2))/(d^2*(c + d*x)) + (a^2*f^2*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d^3 + (a^2*f^2*sinh(2*e - (2*c*f)/d)*SinhIntegral((2*c*f)/d + 2*f*x))/d^3]

    #= ::Subsubsection::Closed:: =#
    #=n<0=#

    @test_int [(c + d*x)^3/(a + a*cosh(e + f*x)), x, 7, (c + d*x)^3/(a*f) - (6*d*(c + d*x)^2*log(1 + ℯ^(e + f*x)))/(a*f^2) - (12*d^2*(c + d*x)*PolyLog(2, -ℯ^(e + f*x)))/(a*f^3) + (12*d^3*PolyLog(3, -ℯ^(e + f*x)))/(a*f^4) + ((c + d*x)^3*tanh(e/2 + (f*x)/2))/(a*f)]
    @test_int [(c + d*x)^2/(a + a*cosh(e + f*x)), x, 6, (c + d*x)^2/(a*f) - (4*d*(c + d*x)*log(1 + ℯ^(e + f*x)))/(a*f^2) - (4*d^2*PolyLog(2, -ℯ^(e + f*x)))/(a*f^3) + ((c + d*x)^2*tanh(e/2 + (f*x)/2))/(a*f)]
    @test_int [(c + d*x)/(a + a*cosh(e + f*x)), x, 3, (-2*d*log(cosh(e/2 + (f*x)/2)))/(a*f^2) + ((c + d*x)*tanh(e/2 + (f*x)/2))/(a*f)]
    @test_int [1/((c + d*x)*(a + a*cosh(e + f*x))), x, 0, Unintegrable(1/((c + d*x)*(a + a*cosh(e + f*x))), x)]
    @test_int [1/((c + d*x)^2*(a + a*cosh(e + f*x))), x, 0, Unintegrable(1/((c + d*x)^2*(a + a*cosh(e + f*x))), x)]

    @test_int [(c + d*x)^3/(a + a*cosh(e + f*x))^2, x, 10, (c + d*x)^3/(3*a^2*f) - (2*d*(c + d*x)^2*log(1 + ℯ^(e + f*x)))/(a^2*f^2) + (4*d^3*log(cosh(e/2 + (f*x)/2)))/(a^2*f^4) - (4*d^2*(c + d*x)*PolyLog(2, -ℯ^(e + f*x)))/(a^2*f^3) + (4*d^3*PolyLog(3, -ℯ^(e + f*x)))/(a^2*f^4) + (d*(c + d*x)^2*sech(e/2 + (f*x)/2)^2)/(2*a^2*f^2) - (2*d^2*(c + d*x)*tanh(e/2 + (f*x)/2))/(a^2*f^3) + ((c + d*x)^3*tanh(e/2 + (f*x)/2))/(3*a^2*f) + ((c + d*x)^3*sech(e/2 + (f*x)/2)^2*tanh(e/2 + (f*x)/2))/(6*a^2*f)]
    @test_int [(c + d*x)^2/(a + a*cosh(e + f*x))^2, x, 9, (c + d*x)^2/(3*a^2*f) - (4*d*(c + d*x)*log(1 + ℯ^(e + f*x)))/(3*a^2*f^2) - (4*d^2*PolyLog(2, -ℯ^(e + f*x)))/(3*a^2*f^3) + (d*(c + d*x)*sech(e/2 + (f*x)/2)^2)/(3*a^2*f^2) - (2*d^2*tanh(e/2 + (f*x)/2))/(3*a^2*f^3) + ((c + d*x)^2*tanh(e/2 + (f*x)/2))/(3*a^2*f) + ((c + d*x)^2*sech(e/2 + (f*x)/2)^2*tanh(e/2 + (f*x)/2))/(6*a^2*f)]
    @test_int [(c + d*x)/(a + a*cosh(e + f*x))^2, x, 4, (-2*d*log(cosh(e/2 + (f*x)/2)))/(3*a^2*f^2) + (d*sech(e/2 + (f*x)/2)^2)/(6*a^2*f^2) + ((c + d*x)*tanh(e/2 + (f*x)/2))/(3*a^2*f) + ((c + d*x)*sech(e/2 + (f*x)/2)^2*tanh(e/2 + (f*x)/2))/(6*a^2*f)]
    @test_int [1/((c + d*x)*(a + a*cosh(e + f*x))^2), x, 0, Unintegrable(1/((c + d*x)*(a + a*cosh(e + f*x))^2), x)]
    @test_int [1/((c + d*x)^2*(a + a*cosh(e + f*x))^2), x, 0, Unintegrable(1/((c + d*x)^2*(a + a*cosh(e + f*x))^2), x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+a*cosh(e+f*x))^(n/2)=#

    #= ::Subsubsection::Closed:: =#
    #=n>0=#

    @test_int [x^3*sqrt(a + a*cosh(c + d*x)), x, 5, (-96*sqrt(a + a*cosh(c + d*x)))/d^4 - (12*x^2*sqrt(a + a*cosh(c + d*x)))/d^2 + (48*x*sqrt(a + a*cosh(c + d*x))*tanh(c/2 + (d*x)/2))/d^3 + (2*x^3*sqrt(a + a*cosh(c + d*x))*tanh(c/2 + (d*x)/2))/d]
    @test_int [x^2*sqrt(a + a*cosh(c + d*x)), x, 4, (-8*x*sqrt(a + a*cosh(c + d*x)))/d^2 + (16*sqrt(a + a*cosh(c + d*x))*tanh(c/2 + (d*x)/2))/d^3 + (2*x^2*sqrt(a + a*cosh(c + d*x))*tanh(c/2 + (d*x)/2))/d]
    @test_int [x^1*sqrt(a + a*cosh(c + d*x)), x, 3, (-4*sqrt(a + a*cosh(c + d*x)))/d^2 + (2*x*sqrt(a + a*cosh(c + d*x))*tanh(c/2 + (d*x)/2))/d]
    @test_int [sqrt(a + a*cosh(c + d*x))/x^1, x, 4, cosh(c/2)*sqrt(a + a*cosh(c + d*x))*CoshIntegral((d*x)/2)*sech(c/2 + (d*x)/2) + sqrt(a + a*cosh(c + d*x))*sech(c/2 + (d*x)/2)*sinh(c/2)*SinhIntegral((d*x)/2)]
    @test_int [sqrt(a + a*cosh(c + d*x))/x^2, x, 5, -(sqrt(a + a*cosh(c + d*x))/x) + (d*sqrt(a + a*cosh(c + d*x))*CoshIntegral((d*x)/2)*sech(c/2 + (d*x)/2)*sinh(c/2))/2 + (d*cosh(c/2)*sqrt(a + a*cosh(c + d*x))*sech(c/2 + (d*x)/2)*SinhIntegral((d*x)/2))/2]
    @test_int [sqrt(a + a*cosh(c + d*x))/x^3, x, 6, -sqrt(a + a*cosh(c + d*x))/(2*x^2) + (d^2*cosh(c/2)*sqrt(a + a*cosh(c + d*x))*CoshIntegral((d*x)/2)*sech(c/2 + (d*x)/2))/8 + (d^2*sqrt(a + a*cosh(c + d*x))*sech(c/2 + (d*x)/2)*sinh(c/2)*SinhIntegral((d*x)/2))/8 - (d*sqrt(a + a*cosh(c + d*x))*tanh(c/2 + (d*x)/2))/(4*x)]

    @test_int [x^3*sqrt(a + a*cosh(x)), x, 5, -96*sqrt(a + a*cosh(x)) - 12*x^2*sqrt(a + a*cosh(x)) + 48*x*sqrt(a + a*cosh(x))*tanh(x/2) + 2*x^3*sqrt(a + a*cosh(x))*tanh(x/2)]
    @test_int [x^2*sqrt(a + a*cosh(x)), x, 4, -8*x*sqrt(a + a*cosh(x)) + 16*sqrt(a + a*cosh(x))*tanh(x/2) + 2*x^2*sqrt(a + a*cosh(x))*tanh(x/2)]
    @test_int [x^1*sqrt(a + a*cosh(x)), x, 3, -4*sqrt(a + a*cosh(x)) + 2*x*sqrt(a + a*cosh(x))*tanh(x/2)]
    @test_int [sqrt(a + a*cosh(x))/x^1, x, 2, sqrt(a + a*cosh(x))*CoshIntegral(x/2)*sech(x/2)]
    @test_int [sqrt(a + a*cosh(x))/x^2, x, 3, -(sqrt(a + a*cosh(x))/x) + (1/2)*sqrt(a + a*cosh(x))*sech(x/2)*SinhIntegral(x/2)]
    @test_int [sqrt(a + a*cosh(x))/x^3, x, 4, -(sqrt(a + a*cosh(x))/(2*x^2)) + (1/8)*sqrt(a + a*cosh(x))*CoshIntegral(x/2)*sech(x/2) - (sqrt(a + a*cosh(x))*tanh(x/2))/(4*x)]

    @test_int [x^3*(a + a*cosh(x))^(3/2), x, 9, (-1280*a*sqrt(a + a*cosh(x)))/9 - 16*a*x^2*sqrt(a + a*cosh(x)) - (64*a*cosh(x/2)^2*sqrt(a + a*cosh(x)))/27 - (8*a*x^2*cosh(x/2)^2*sqrt(a + a*cosh(x)))/3 + (32*a*x*cosh(x/2)*sqrt(a + a*cosh(x))*sinh(x/2))/9 + (4*a*x^3*cosh(x/2)*sqrt(a + a*cosh(x))*sinh(x/2))/3 + (640*a*x*sqrt(a + a*cosh(x))*tanh(x/2))/9 + (8*a*x^3*sqrt(a + a*cosh(x))*tanh(x/2))/3]
    @test_int [x^2*(a + a*cosh(x))^(3/2), x, 7, (-32*a*x*sqrt(a + a*cosh(x)))/3 - (16*a*x*cosh(x/2)^2*sqrt(a + a*cosh(x)))/9 + (4*a*x^2*cosh(x/2)*sqrt(a + a*cosh(x))*sinh(x/2))/3 + (224*a*sqrt(a + a*cosh(x))*tanh(x/2))/9 + (8*a*x^2*sqrt(a + a*cosh(x))*tanh(x/2))/3 + (32*a*sqrt(a + a*cosh(x))*sinh(x/2)^2*tanh(x/2))/27]
    @test_int [x^1*(a + a*cosh(x))^(3/2), x, 4, (-16*a*sqrt(a + a*cosh(x)))/3 - (8*a*cosh(x/2)^2*sqrt(a + a*cosh(x)))/9 + (4*a*x*cosh(x/2)*sqrt(a + a*cosh(x))*sinh(x/2))/3 + (8*a*x*sqrt(a + a*cosh(x))*tanh(x/2))/3]
    @test_int [(a + a*cosh(x))^(3/2)/x^1, x, 5, (3*a*sqrt(a + a*cosh(x))*CoshIntegral(x/2)*sech(x/2))/2 + (a*sqrt(a + a*cosh(x))*CoshIntegral((3*x)/2)*sech(x/2))/2]
    @test_int [(a + a*cosh(x))^(3/2)/x^2, x, 5, (-2*a*cosh(x/2)^2*sqrt(a + a*cosh(x)))/x + (3*a*sqrt(a + a*cosh(x))*sech(x/2)*SinhIntegral(x/2))/4 + (3*a*sqrt(a + a*cosh(x))*sech(x/2)*SinhIntegral((3*x)/2))/4]
    @test_int [(a + a*cosh(x))^(3/2)/x^3, x, 7, -((a*cosh(x/2)^2*sqrt(a + a*cosh(x)))/x^2) + (3*a*sqrt(a + a*cosh(x))*CoshIntegral(x/2)*sech(x/2))/16 + (9*a*sqrt(a + a*cosh(x))*CoshIntegral((3*x)/2)*sech(x/2))/16 - (3*a*cosh(x/2)*sqrt(a + a*cosh(x))*sinh(x/2))/(2*x)]

    #= ::Subsubsection::Closed:: =#
    #=n<0=#

    @test_int [x^3/sqrt(a + a*cosh(c + d*x)), x, 10, (4*x^3*atan(ℯ^(c/2 + (d*x)/2))*cosh(c/2 + (d*x)/2))/(d*sqrt(a + a*cosh(c + d*x))) - ((12*im)*x^2*cosh(c/2 + (d*x)/2)*PolyLog(2, (-im)*ℯ^(c/2 + (d*x)/2)))/(d^2*sqrt(a + a*cosh(c + d*x))) + ((12*im)*x^2*cosh(c/2 + (d*x)/2)*PolyLog(2, im*ℯ^(c/2 + (d*x)/2)))/(d^2*sqrt(a + a*cosh(c + d*x))) + ((48*im)*x*cosh(c/2 + (d*x)/2)*PolyLog(3, (-im)*ℯ^(c/2 + (d*x)/2)))/(d^3*sqrt(a + a*cosh(c + d*x))) - ((48*im)*x*cosh(c/2 + (d*x)/2)*PolyLog(3, im*ℯ^(c/2 + (d*x)/2)))/(d^3*sqrt(a + a*cosh(c + d*x))) - ((96*im)*cosh(c/2 + (d*x)/2)*PolyLog(4, (-im)*ℯ^(c/2 + (d*x)/2)))/(d^4*sqrt(a + a*cosh(c + d*x))) + ((96*im)*cosh(c/2 + (d*x)/2)*PolyLog(4, im*ℯ^(c/2 + (d*x)/2)))/(d^4*sqrt(a + a*cosh(c + d*x)))]
    @test_int [x^2/sqrt(a + a*cosh(c + d*x)), x, 8, (4*x^2*atan(ℯ^(c/2 + (d*x)/2))*cosh(c/2 + (d*x)/2))/(d*sqrt(a + a*cosh(c + d*x))) - ((8*im)*x*cosh(c/2 + (d*x)/2)*PolyLog(2, (-im)*ℯ^(c/2 + (d*x)/2)))/(d^2*sqrt(a + a*cosh(c + d*x))) + ((8*im)*x*cosh(c/2 + (d*x)/2)*PolyLog(2, im*ℯ^(c/2 + (d*x)/2)))/(d^2*sqrt(a + a*cosh(c + d*x))) + ((16*im)*cosh(c/2 + (d*x)/2)*PolyLog(3, (-im)*ℯ^(c/2 + (d*x)/2)))/(d^3*sqrt(a + a*cosh(c + d*x))) - ((16*im)*cosh(c/2 + (d*x)/2)*PolyLog(3, im*ℯ^(c/2 + (d*x)/2)))/(d^3*sqrt(a + a*cosh(c + d*x)))]
    @test_int [x/sqrt(a + a*cosh(c + d*x)), x, 6, (4*x*atan(ℯ^(c/2 + (d*x)/2))*cosh(c/2 + (d*x)/2))/(d*sqrt(a + a*cosh(c + d*x))) - ((4*im)*cosh(c/2 + (d*x)/2)*PolyLog(2, (-im)*ℯ^(c/2 + (d*x)/2)))/(d^2*sqrt(a + a*cosh(c + d*x))) + ((4*im)*cosh(c/2 + (d*x)/2)*PolyLog(2, im*ℯ^(c/2 + (d*x)/2)))/(d^2*sqrt(a + a*cosh(c + d*x)))]
    @test_int [1/(x*sqrt(a + a*cosh(c + d*x))), x, 0, Unintegrable(1/(x*sqrt(a + a*cosh(c + d*x))), x)]
    @test_int [1/(x^2*sqrt(a + a*cosh(c + d*x))), x, 0, Unintegrable(1/(x^2*sqrt(a + a*cosh(c + d*x))), x)]

    @test_int [x^3/(a + a*cosh(x))^(3/2), x, 16, (3*x^2)/(a*sqrt(a + a*cosh(x))) - (24*x*atan(ℯ^(x/2))*cosh(x/2))/(a*sqrt(a + a*cosh(x))) + (x^3*atan(ℯ^(x/2))*cosh(x/2))/(a*sqrt(a + a*cosh(x))) + ((24*im)*cosh(x/2)*PolyLog(2, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) - ((3*im)*x^2*cosh(x/2)*PolyLog(2, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) - ((24*im)*cosh(x/2)*PolyLog(2, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + ((3*im)*x^2*cosh(x/2)*PolyLog(2, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + ((12*im)*x*cosh(x/2)*PolyLog(3, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) - ((12*im)*x*cosh(x/2)*PolyLog(3, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) - ((24*im)*cosh(x/2)*PolyLog(4, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + ((24*im)*cosh(x/2)*PolyLog(4, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + (x^3*tanh(x/2))/(2*a*sqrt(a + a*cosh(x)))]
    @test_int [x^2/(a + a*cosh(x))^(3/2), x, 10, (2*x)/(a*sqrt(a + a*cosh(x))) + (x^2*atan(ℯ^(x/2))*cosh(x/2))/(a*sqrt(a + a*cosh(x))) - (4*atan(sinh(x/2))*cosh(x/2))/(a*sqrt(a + a*cosh(x))) - ((2*im)*x*cosh(x/2)*PolyLog(2, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + ((2*im)*x*cosh(x/2)*PolyLog(2, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + ((4*im)*cosh(x/2)*PolyLog(3, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) - ((4*im)*cosh(x/2)*PolyLog(3, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + (x^2*tanh(x/2))/(2*a*sqrt(a + a*cosh(x)))]
    @test_int [x/(a + a*cosh(x))^(3/2), x, 7, 1/(a*sqrt(a + a*cosh(x))) + (x*atan(ℯ^(x/2))*cosh(x/2))/(a*sqrt(a + a*cosh(x))) - (im*cosh(x/2)*PolyLog(2, (-im)*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + (im*cosh(x/2)*PolyLog(2, im*ℯ^(x/2)))/(a*sqrt(a + a*cosh(x))) + (x*tanh(x/2))/(2*a*sqrt(a + a*cosh(x)))]
    @test_int [1/(x*(a + a*cosh(x))^(3/2)), x, 0, Unintegrable(1/(x*(a + a*cosh(x))^(3/2)), x)]
    @test_int [1/(x^2*(a + a*cosh(x))^(3/2)), x, 0, Unintegrable(1/(x^2*(a + a*cosh(x))^(3/2)), x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+a*cosh(e+f*x))^(n/3)=#

    #= Used*to*hang*Rubi =#
    @test_int [(a + a*cosh(c + d*x))^(1/3)/x, x, 0, Unintegrable((a + a*cosh(c + d*x))^(1/3)/x, x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+a*cosh(e+f*x))^n*with*m*symbolic=#

    @test_int [(c + d*x)^m*(a + a*cosh(e + f*x))^n, x, 0, Unintegrable((c + d*x)^m*(a + a*cosh(e + f*x))^n, x)]

    @test_int [(c + d*x)^m*(a + a*cosh(e + f*x))^3, x, 12, (5*a^3*(c + d*x)^(1 + m))/(2*d*(1 + m)) + (3^(-1 - m)*a^3*ℯ^(3*e - (3*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (-3*f*(c + d*x))/d))/(8*f*(-((f*(c + d*x))/d))^m) + (3*2^(-3 - m)*a^3*ℯ^(2*e - (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (-2*f*(c + d*x))/d))/(f*(-((f*(c + d*x))/d))^m) + (15*a^3*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(8*f*(-((f*(c + d*x))/d))^m) - (15*a^3*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(8*f*((f*(c + d*x))/d)^m) - (3*2^(-3 - m)*a^3*ℯ^(-2*e + (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (2*f*(c + d*x))/d))/(f*((f*(c + d*x))/d)^m) - (3^(-1 - m)*a^3*ℯ^(-3*e + (3*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (3*f*(c + d*x))/d))/(8*f*((f*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*(a + a*cosh(e + f*x))^2, x, 9, (3*a^2*(c + d*x)^(1 + m))/(2*d*(1 + m)) + (2^(-3 - m)*a^2*ℯ^(2*e - (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (-2*f*(c + d*x))/d))/(f*(-((f*(c + d*x))/d))^m) + (a^2*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(f*(-((f*(c + d*x))/d))^m) - (a^2*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(f*((f*(c + d*x))/d)^m) - (2^(-3 - m)*a^2*ℯ^(-2*e + (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (2*f*(c + d*x))/d))/(f*((f*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*(a + a*cosh(e + f*x)), x, 5, (a*(c + d*x)^(1 + m))/(d*(1 + m)) + (a*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(2*f*(-((f*(c + d*x))/d))^m) - (a*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(2*f*((f*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m/(a + a*cosh(e + f*x)), x, 0, Unintegrable((c + d*x)^m/(a + a*cosh(e + f*x)), x)]
    @test_int [(c + d*x)^m/(a + a*cosh(e + f*x))^2, x, 0, Unintegrable((c + d*x)^m/(a + a*cosh(e + f*x))^2, x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+b*cosh(e+f*x))^n=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+b*cosh(e+f*x))^n=#

    #= ::Subsubsection::Closed:: =#
    #=n>0=#

    @test_int [(c + d*x)^3*(a + b*cosh(e + f*x)), x, 6, (a*(c + d*x)^4)/(4*d) - (6*b*d^3*cosh(e + f*x))/f^4 - (3*b*d*(c + d*x)^2*cosh(e + f*x))/f^2 + (6*b*d^2*(c + d*x)*sinh(e + f*x))/f^3 + (b*(c + d*x)^3*sinh(e + f*x))/f]
    @test_int [(c + d*x)^2*(a + b*cosh(e + f*x)), x, 5, (a*(c + d*x)^3)/(3*d) - (2*b*d*(c + d*x)*cosh(e + f*x))/f^2 + (2*b*d^2*sinh(e + f*x))/f^3 + (b*(c + d*x)^2*sinh(e + f*x))/f]
    @test_int [(c + d*x)*(a + b*cosh(e + f*x)), x, 4, (a*(c + d*x)^2)/(2*d) - (b*d*cosh(e + f*x))/f^2 + (b*(c + d*x)*sinh(e + f*x))/f]
    @test_int [(a + b*cosh(e + f*x))/(c + d*x), x, 5, (b*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/d + (a*log(c + d*x))/d + (b*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d]
    @test_int [(a + b*cosh(e + f*x))/(c + d*x)^2, x, 6, -(a/(d*(c + d*x))) - (b*cosh(e + f*x))/(d*(c + d*x)) + (b*f*CoshIntegral((c*f)/d + f*x)*sinh(e - (c*f)/d))/d^2 + (b*f*cosh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d^2]
    @test_int [(a + b*cosh(e + f*x))/(c + d*x)^3, x, 7, -a/(2*d*(c + d*x)^2) - (b*cosh(e + f*x))/(2*d*(c + d*x)^2) + (b*f^2*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/(2*d^3) - (b*f*sinh(e + f*x))/(2*d^2*(c + d*x)) + (b*f^2*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/(2*d^3)]

    @test_int [(c + d*x)^3*(a + b*cosh(e + f*x))^2, x, 10, (3*b^2*c*d^2*x)/(4*f^2) + (3*b^2*d^3*x^2)/(8*f^2) + (a^2*(c + d*x)^4)/(4*d) + (b^2*(c + d*x)^4)/(8*d) - (12*a*b*d^3*cosh(e + f*x))/f^4 - (6*a*b*d*(c + d*x)^2*cosh(e + f*x))/f^2 - (3*b^2*d^3*cosh(e + f*x)^2)/(8*f^4) - (3*b^2*d*(c + d*x)^2*cosh(e + f*x)^2)/(4*f^2) + (12*a*b*d^2*(c + d*x)*sinh(e + f*x))/f^3 + (2*a*b*(c + d*x)^3*sinh(e + f*x))/f + (3*b^2*d^2*(c + d*x)*cosh(e + f*x)*sinh(e + f*x))/(4*f^3) + (b^2*(c + d*x)^3*cosh(e + f*x)*sinh(e + f*x))/(2*f)]
    @test_int [(c + d*x)^2*(a + b*cosh(e + f*x))^2, x, 9, (b^2*d^2*x)/(4*f^2) + (a^2*(c + d*x)^3)/(3*d) + (b^2*(c + d*x)^3)/(6*d) - (4*a*b*d*(c + d*x)*cosh(e + f*x))/f^2 - (b^2*d*(c + d*x)*cosh(e + f*x)^2)/(2*f^2) + (4*a*b*d^2*sinh(e + f*x))/f^3 + (2*a*b*(c + d*x)^2*sinh(e + f*x))/f + (b^2*d^2*cosh(e + f*x)*sinh(e + f*x))/(4*f^3) + (b^2*(c + d*x)^2*cosh(e + f*x)*sinh(e + f*x))/(2*f)]
    @test_int [(c + d*x)*(a + b*cosh(e + f*x))^2, x, 6, (b^2*c*x)/2 + (b^2*d*x^2)/4 + (a^2*(c + d*x)^2)/(2*d) - (2*a*b*d*cosh(e + f*x))/f^2 - (b^2*d*cosh(e + f*x)^2)/(4*f^2) + (2*a*b*(c + d*x)*sinh(e + f*x))/f + (b^2*(c + d*x)*cosh(e + f*x)*sinh(e + f*x))/(2*f)]
    @test_int [(a + b*cosh(e + f*x))^2/(c + d*x), x, 10, (2*a*b*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/d + (b^2*cosh(2*e - (2*c*f)/d)*CoshIntegral((2*c*f)/d + 2*f*x))/(2*d) + (a^2*log(c + d*x))/d + (b^2*log(c + d*x))/(2*d) + (2*a*b*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d + (b^2*sinh(2*e - (2*c*f)/d)*SinhIntegral((2*c*f)/d + 2*f*x))/(2*d)]
    @test_int [(a + b*cosh(e + f*x))^2/(c + d*x)^2, x, 11, -(a^2/(d*(c + d*x))) - (2*a*b*cosh(e + f*x))/(d*(c + d*x)) - (b^2*cosh(e + f*x)^2)/(d*(c + d*x)) + (b^2*f*CoshIntegral((2*c*f)/d + 2*f*x)*sinh(2*e - (2*c*f)/d))/d^2 + (2*a*b*f*CoshIntegral((c*f)/d + f*x)*sinh(e - (c*f)/d))/d^2 + (2*a*b*f*cosh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d^2 + (b^2*f*cosh(2*e - (2*c*f)/d)*SinhIntegral((2*c*f)/d + 2*f*x))/d^2]
    @test_int [(a + b*cosh(e + f*x))^2/(c + d*x)^3, x, 14, -a^2/(2*d*(c + d*x)^2) - (a*b*cosh(e + f*x))/(d*(c + d*x)^2) - (b^2*cosh(e + f*x)^2)/(2*d*(c + d*x)^2) + (a*b*f^2*cosh(e - (c*f)/d)*CoshIntegral((c*f)/d + f*x))/d^3 + (b^2*f^2*cosh(2*e - (2*c*f)/d)*CoshIntegral((2*c*f)/d + 2*f*x))/d^3 - (a*b*f*sinh(e + f*x))/(d^2*(c + d*x)) - (b^2*f*cosh(e + f*x)*sinh(e + f*x))/(d^2*(c + d*x)) + (a*b*f^2*sinh(e - (c*f)/d)*SinhIntegral((c*f)/d + f*x))/d^3 + (b^2*f^2*sinh(2*e - (2*c*f)/d)*SinhIntegral((2*c*f)/d + 2*f*x))/d^3]

    #= ::Subsubsection::Closed:: =#
    #=n<0=#

    @test_int [(c + d*x)^3/(a + b*cosh(e + f*x)), x, 12, ((c + d*x)^3*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/(sqrt(a^2 - b^2)*f) - ((c + d*x)^3*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/(sqrt(a^2 - b^2)*f) + (3*d*(c + d*x)^2*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^2) - (3*d*(c + d*x)^2*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^2) - (6*d^2*(c + d*x)*PolyLog(3, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^3) + (6*d^2*(c + d*x)*PolyLog(3, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^3) + (6*d^3*PolyLog(4, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^4) - (6*d^3*PolyLog(4, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^4)]
    @test_int [(c + d*x)^2/(a + b*cosh(e + f*x)), x, 10, ((c + d*x)^2*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/(sqrt(a^2 - b^2)*f) - ((c + d*x)^2*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/(sqrt(a^2 - b^2)*f) + (2*d*(c + d*x)*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^2) - (2*d*(c + d*x)*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^2) - (2*d^2*PolyLog(3, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^3) + (2*d^2*PolyLog(3, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^3)]
    @test_int [(c + d*x)/(a + b*cosh(e + f*x)), x, 8, ((c + d*x)*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/(sqrt(a^2 - b^2)*f) - ((c + d*x)*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/(sqrt(a^2 - b^2)*f) + (d*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^2) - (d*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/(sqrt(a^2 - b^2)*f^2)]
    @test_int [1/((c + d*x)*(a + b*cosh(e + f*x))), x, 0, Unintegrable(1/((c + d*x)*(a + b*cosh(e + f*x))), x)]
    @test_int [1/((c + d*x)^2*(a + b*cosh(e + f*x))), x, 0, Unintegrable(1/((c + d*x)^2*(a + b*cosh(e + f*x))), x)]

    @test_int [(c + d*x)^3/(a + b*cosh(e + f*x))^2, x, 22, -((c + d*x)^3/((a^2 - b^2)*f)) + (3*d*(c + d*x)^2*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/((a^2 - b^2)*f^2) + (a*(c + d*x)^3*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/((a^2 - b^2)^(3/2)*f) + (3*d*(c + d*x)^2*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/((a^2 - b^2)*f^2) - (a*(c + d*x)^3*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/((a^2 - b^2)^(3/2)*f) + (6*d^2*(c + d*x)*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)*f^3) + (3*a*d*(c + d*x)^2*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^2) + (6*d^2*(c + d*x)*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)*f^3) - (3*a*d*(c + d*x)^2*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^2) - (6*d^3*PolyLog(3, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)*f^4) - (6*a*d^2*(c + d*x)*PolyLog(3, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^3) - (6*d^3*PolyLog(3, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)*f^4) + (6*a*d^2*(c + d*x)*PolyLog(3, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^3) + (6*a*d^3*PolyLog(4, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^4) - (6*a*d^3*PolyLog(4, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^4) - (b*(c + d*x)^3*sinh(e + f*x))/((a^2 - b^2)*f*(a + b*cosh(e + f*x)))]
    @test_int [(c + d*x)^2/(a + b*cosh(e + f*x))^2, x, 18, -((c + d*x)^2/((a^2 - b^2)*f)) + (2*d*(c + d*x)*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/((a^2 - b^2)*f^2) + (a*(c + d*x)^2*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/((a^2 - b^2)^(3/2)*f) + (2*d*(c + d*x)*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/((a^2 - b^2)*f^2) - (a*(c + d*x)^2*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/((a^2 - b^2)^(3/2)*f) + (2*d^2*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)*f^3) + (2*a*d*(c + d*x)*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^2) + (2*d^2*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)*f^3) - (2*a*d*(c + d*x)*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^2) - (2*a*d^2*PolyLog(3, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^3) + (2*a*d^2*PolyLog(3, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^3) - (b*(c + d*x)^2*sinh(e + f*x))/((a^2 - b^2)*f*(a + b*cosh(e + f*x)))]
    @test_int [(c + d*x)/(a + b*cosh(e + f*x))^2, x, 11, (a*(c + d*x)*log(1 + (b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2))))/((a^2 - b^2)^(3/2)*f) - (a*(c + d*x)*log(1 + (b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2))))/((a^2 - b^2)^(3/2)*f) + (d*log(a + b*cosh(e + f*x)))/((a^2 - b^2)*f^2) + (a*d*PolyLog(2, -((b*ℯ^(e + f*x))/(a - sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^2) - (a*d*PolyLog(2, -((b*ℯ^(e + f*x))/(a + sqrt(a^2 - b^2)))))/((a^2 - b^2)^(3/2)*f^2) - (b*(c + d*x)*sinh(e + f*x))/((a^2 - b^2)*f*(a + b*cosh(e + f*x)))]
    @test_int [1/((c + d*x)*(a + b*cosh(e + f*x))^2), x, 0, Unintegrable(1/((c + d*x)*(a + b*cosh(e + f*x))^2), x)]
    @test_int [1/((c + d*x)^2*(a + b*cosh(e + f*x))^2), x, 0, Unintegrable(1/((c + d*x)^2*(a + b*cosh(e + f*x))^2), x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*(a+b*cosh(e+f*x))^n*with*m*symbolic=#

    @test_int [(c + d*x)^m*(a + b*cosh(e + f*x))^n, x, 0, Unintegrable((c + d*x)^m*(a + b*cosh(e + f*x))^n, x)]

    @test_int [(c + d*x)^m*(a + b*cosh(e + f*x))^3, x, 18, (a^3*(c + d*x)^(1 + m))/(d*(1 + m)) + (3*a*b^2*(c + d*x)^(1 + m))/(2*d*(1 + m)) + (3^(-1 - m)*b^3*ℯ^(3*e - (3*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (-3*f*(c + d*x))/d))/(8*f*(-((f*(c + d*x))/d))^m) + (3*2^(-3 - m)*a*b^2*ℯ^(2*e - (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (-2*f*(c + d*x))/d))/(f*(-((f*(c + d*x))/d))^m) + (3*a^2*b*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(2*f*(-((f*(c + d*x))/d))^m) + (3*b^3*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(8*f*(-((f*(c + d*x))/d))^m) - (3*a^2*b*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(2*f*((f*(c + d*x))/d)^m) - (3*b^3*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(8*f*((f*(c + d*x))/d)^m) - (3*2^(-3 - m)*a*b^2*ℯ^(-2*e + (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (2*f*(c + d*x))/d))/(f*((f*(c + d*x))/d)^m) - (3^(-1 - m)*b^3*ℯ^(-3*e + (3*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (3*f*(c + d*x))/d))/(8*f*((f*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*(a + b*cosh(e + f*x))^2, x, 10, (a^2*(c + d*x)^(1 + m))/(d*(1 + m)) + (b^2*(c + d*x)^(1 + m))/(2*d*(1 + m)) + (2^(-3 - m)*b^2*ℯ^(2*e - (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (-2*f*(c + d*x))/d))/(f*(-((f*(c + d*x))/d))^m) + (a*b*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(f*(-((f*(c + d*x))/d))^m) - (a*b*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(f*((f*(c + d*x))/d)^m) - (2^(-3 - m)*b^2*ℯ^(-2*e + (2*c*f)/d)*(c + d*x)^m*Gamma(1 + m, (2*f*(c + d*x))/d))/(f*((f*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m*(a + b*cosh(e + f*x)), x, 5, (a*(c + d*x)^(1 + m))/(d*(1 + m)) + (b*ℯ^(e - (c*f)/d)*(c + d*x)^m*Gamma(1 + m, -((f*(c + d*x))/d)))/(2*f*(-((f*(c + d*x))/d))^m) - (b*ℯ^(-e + (c*f)/d)*(c + d*x)^m*Gamma(1 + m, (f*(c + d*x))/d))/(2*f*((f*(c + d*x))/d)^m)]
    @test_int [(c + d*x)^m/(a + b*cosh(e + f*x)), x, 0, Unintegrable((c + d*x)^m/(a + b*cosh(e + f*x)), x)]
    @test_int [(c + d*x)^m/(a + b*cosh(e + f*x))^2, x, 0, Unintegrable((c + d*x)^m/(a + b*cosh(e + f*x))^2, x)]
    end

max_stars_repo_path: test/6 Hyperbolic functions/6.2 Hyperbolic cosine/6.2.1 (c+d x)^m (a+b cosh)^n.jl


text:
module MathematicalSets

#=========================
Abstract types for sets
==========================#
include("abstract.jl")

#==============================
Topological properties of sets
==============================#
include("topological.jl")

export dimension,
       space_dimension

#==============================
Metric properties of sets
==============================#
include("metric.jl")

export surface_area,
       volume

end # module

ext: jl


text:
#=
   The BUGS Book
   Example 2.6.1 Heart transplant cost-effectiveness: risks assumed known

   Cf ~/jags/bugs_book_2_6_1.R
   """
   model {
      sN ~ dexp(0.5) # life without transplant (mean 2)
      oT ~ dbern(0.8) # survive operation (prob 0.8)
      sP ~ dexp(0.2) # life if survive transplant (mean 5)
      sT <- oT*sP # total life time if choose transplant
      Ic <- 20000 + 3000*sT # total additional cost of transplant
      Is <- sT - sN # total additional survival
      r <- Ic/Is # individual cost per additional year
   }

   Output:
            Mean        SD  Naive SE Time-series SE
   Ic  3.197e+04 1.466e+04 1.639e+01      1.641e+01
   Is  1.991e+00 5.281e+00 5.905e-03      5.913e-03
   oT  8.005e-01 3.996e-01 4.468e-04      4.476e-04
   r  -2.197e+05 1.508e+08 1.686e+05      1.686e+05
   sN  1.999e+00 1.997e+00 2.233e-03      2.233e-03
   sP  4.982e+00 4.983e+00 5.571e-03      5.577e-03
   sT  3.990e+00 4.887e+00 5.464e-03      5.471e-03
   """

   Cf ~/blog/bugs_book_2_6_1.blog
      ~/webppl/bugs_book_2_6_1.wppl

   This model:
Summary Statistics
  parameters      mean       std   naive_se      mcse          ess      rhat
      Symbol   Float64   Float64    Float64   Float64      Float64   Float64

          oT    0.7971    0.4022     0.0020    0.0020   40004.4419    1.0000
          sN    2.0054    1.9993     0.0100    0.0096   40023.2213    1.0000
          sP    4.9685    4.9656     0.0248    0.0262   39325.3438    1.0000

Quantiles
  parameters      2.5%     25.0%     50.0%     75.0%     97.5%
      Symbol   Float64   Float64   Float64   Float64   Float64

          oT    0.0000    1.0000    1.0000    1.0000    1.0000
          sN    0.0493    0.5789    1.3914    2.7897    7.3861
          sP    0.1236    1.4235    3.4610    6.8997   18.2519

=#

using Turing, StatsPlots, DataFrames
include("jl_utils.jl")

@model function bugs_book_2_6_1()

    sN ~ Exponential(1/0.5) # life without transplant (mean 2)
    oT ~ Bernoulli(0.8)     # survive operation (prob 0.8)
    sP ~ Exponential(1/0.2) # life if survive transplant (mean 5)
    sT = oT*sP              # total life time if choose transplant
    Ic = 20000 + 3000*sT    # total additional cost of transplant
    Is = sT - sN            # total additional survival
    r  = Ic/Is              # individual cost per additional year

    # return r

end

model = bugs_book_2_6_1()

num_chains = 4

# chains = sample(model, Prior(), MCMCThreads(), 10_000, num_chains)
chains = sample(model, MH(), MCMCThreads(), 10_000, num_chains)
# chains = sample(model, MH(
#                        # :alpha => Normal(2,sqrt(2)),
#                        # :beta => Normal(2,sqrt(2)),
#                        # :sigma => Gamma(2,2)
#                        ), MCMCThreads(), 40_000, num_chains)

# chains = sample(model, PG(15), MCMCThreads(), 1_000, num_chains)
# chains = sample(model, SMC(10_000), MCMCThreads(), 20_000, num_chains)
# chains = sample(model, IS(), MCMCThreads(), 10_000, num_chains)

# Both HMC and NUTS give the following error:
# ERROR: LoadError: TaskFailedException:
# TypeError: in typeassert, expected Float64, got a value of type ForwardDiff.Dual{Nothing,Float64,3}
# chains = sample(model, HMC(0.1,5), MCMCThreads(), 10_000, num_chains) # Error
# chains = sample(model, NUTS(0.65), MCMCThreads(), 10_000, num_chains) # Error

display(chains)
# display(plot(chains))

# gen = generated_quantities(model, chains)
# show_var_dist_pct(gen, 40)

max_stars_repo_name: Wikunia/hakank

max_issues_repo_name: Wikunia/hakank

max_forks_repo_name: Wikunia/hakank


text:
using SafeTestsets

@safetestset "Visual" begin include("visual_test.jl") end

@safetestset "Visual Location" begin include("visual_location_test.jl") end

@safetestset "Declarative" begin include("declarative_test.jl") end

@safetestset "Imaginal" begin include("imaginal_test.jl") end

@safetestset "Motor" begin include("motor_test.jl") end

@safetestset "Parallel" begin include("parallel_test.jl") end

@safetestset "Two Models" begin include("two_models.jl") end

@safetestset "Utility Noise" begin include("utility_noise.jl") end


text:
# ---
# title: 567. Permutation in String
# id: problem567
# author: zhwang
# date: 2022-02-17
# difficulty: Medium
# categories: Two Pointers, Sliding Window
# link: <https://leetcode.com/problems/permutation-in-string/description/>
# hidden: true
# ---
#
# Given two strings **s1** and **s2** , write a function to return true if
# **s2** contains the permutation of **s1**. In other words, one of the first
# string's permutations is the **substring** of the second string.
#
#
#
# **Example 1:**
#
#
#
#     Input: s1 = "ab" s2 = "eidbaooo"
#     Output: True
#     Explanation: s2 contains one permutation of s1 ("ba").
#
#
# **Example 2:**
#
#
#
#     Input: s1= "ab" s2 = "eidboaoo"
#     Output: False
#
#
#
#
# **Constraints:**
#
#   * The input strings only contain lower case letters.
#   * The length of both given strings is in range [1, 10,000].
#
#
## @lc code=start
using LeetCode
using DataStructures

## Double Pointers
function check_inclusion(s1::String, s2::String)::Bool
    equal2c1(c::Accumulator) = all(c[i] == c1[i] for i in keys(c1))
    c1, n1, n2 = counter(s1), length(s1), length(s2)
    n2 < n1 && return false
    c2 = counter(s2[1:n1])
    equal2c1(c2) && return true
    for (i, j) in zip(1:(n2 - n1), (n1 + 1):n2)
        c2[s2[i]] -= 1
        c2[s2[j]] += 1
        equal2c1(c2) && return true
    end
    return false
end
## @lc code=end


text:
module MatDeforNeohookeanModule

using FinEtools.FTypesModule: FInt, FFlt, FCplxFlt, FFltVec, FIntVec, FFltMat, FIntMat, FMat, FVec, FDataDict
import FinEtoolsDeforLinear.DeforModelRedModule: AbstractDeforModelRed, DeforModelRed3D, DeforModelRed2DStrain, DeforModelRed2DStress, DeforModelRed2DAxisymm, DeforModelRed1D, nstressstrain, nthermstrain
import FinEtoolsDeforLinear.MatDeforModule: AbstractMatDefor, stressvtot!, stressttov!
import ..MatDeforNonlinearModule: AbstractMatDeforNonlinear, estimatesoundspeed
import LinearAlgebra: Transpose, Diagonal
import LinearAlgebra: eigen, eigvals, log, diagm
import FinEtools.MatrixUtilityModule: mulCAB!, mulCAtB!, mulCABt!, detC

"""
	MatDeforNeohookean{MR<:AbstractDeforModelRed, MTAN<:Function, MUPD<:Function} <: AbstractMatDeforNonlinear

Type for triaxial neohookean hyperelastic material.

!!! note
The material object is not thread safe. It holds temporary arrays.
If the object is to be used in a multi-threaded environment, each thread must
have its own private copy.

!!! note
Julia threads do not cooperate with BLAS threads. All the BLAS calls are
eliminated from the implementation of this material in order to obtain good parallel
efficiency.
"""
struct  MatDeforNeohookean{MR<:AbstractDeforModelRed, MTAN<:Function, MUPD<:Function} <: AbstractMatDeforNonlinear
    mr::Type{MR} # model reduction type
    mass_density::FFlt # mass density
    E::FFlt # Young's modulus
    nu::FFlt # Poisson ratio
    _lambda::FFlt
    _mu::FFlt
    tangentmoduli!::MTAN # Function to return the tangent moduli matrix
    update!::MUPD # Function to update the material state
    _mI::FFltMat # Private temporary
    _m1m1::FFltMat # Private temporary
    _I3::FFltMat # Private temporary
    _b::FFltMat # Private temporary
    _sigma::FFltMat # Private temporary
end

# function _threedD(E::FFlt, nu::FFlt)
# 	mI = Matrix(Diagonal([1.0, 1.0, 1.0, 0.5, 0.5, 0.5]))
# 	m1 = [1.0, 1.0, 1.0, 0.0, 0.0, 0.0];
# 	_lambda = E * nu / (1 + nu) / (1 - 2*(nu));
# 	_mu = E / 2. / (1+nu);
# 	D = _lambda * m1 * m1' + 2. * _mu * mI;
# 	return D
# end

################################################################################
# 3-D solid model
################################################################################

"""
    MatDeforNeohookean(mr::Type{DeforModelRed3D}, mass_density::FFlt, E::FFlt, nu::FFlt)

Create triaxial neohookean hyperelastic material.
    """
function MatDeforNeohookean(mr::Type{DeforModelRed3D}, mass_density::FFlt, E::FFlt, nu::FFlt)
    _m1 = vec(FFlt[1 1 1 0 0 0]) ;
    function tangentmoduli3d!(self::MatDeforNeohookean, D::FFltMat, statev::FFltVec, Fn1::FFltMat, Fn::FFltMat, tn::FFlt, dtn::FFlt, loc::FFltMat, label::FInt)
		J = detC(Val(3), Fn1);
		copyto!(D, (self._lambda / J) * self._m1m1 + 2 * (self._mu - self._lambda*log(J))/J * self._mI);
		return D
    end
    function update3d!(self::MatDeforNeohookean, statev::FFltVec, cauchy::FFltVec, output::FFltVec, Fn1::FFltMat, Fn::FFltMat, tn::FFlt, dtn::FFlt, loc::FFltMat=zeros(3,1), label::FInt=0, quantity=:nothing)
		@assert length(cauchy) == nstressstrain(self.mr)
		# Finger deformation tensor
		mulCABt!(self._b, Fn1, Fn1)
		J = detC(Val(3), Fn1); # Jacobian of the deformation gradient
		@. self._sigma = (self._mu/J) * (self._b - self._I3) + (self._lambda *log(J)/J) * self._I3;
		stressttov!(mr, cauchy, self._sigma)
		if quantity == :nothing
		    #Nothing to be copied to the output array
		elseif quantity == :cauchy || quantity == :Cauchy
		    (length(output) >= 6) || (output = zeros(6)) # make sure we can store it
		    copyto!(output, cauchy);
		elseif quantity == :pressure || quantity == :Pressure
		    output[1]  =  -sum(cauchy[1:3])/3.
		elseif quantity == :princCauchy || quantity == :princcauchy
		    ep = eigen(sigma);
		    (length(output) >= 3) || (output = zeros(3)) # make sure we can store it
		    copyto!(output,  sort(ep.values, rev=true));
		elseif quantity==:vonMises || quantity==:vonmises || quantity==:von_mises || quantity==:vm
		    s1=cauchy[1]; s2=cauchy[2]; s3=cauchy[3];
		    s4=cauchy[4]; s5=cauchy[5]; s6=cauchy[6];
		    (length(output) >= 1) || (output = zeros(1)) # make sure we can store it
		    output[1] = sqrt(1.0/2*((s1-s2)^2+(s1-s3)^2+(s2-s3)^2+6*(s4^2+s5^2+s6^2)))
		end
		return output
    end
    lambda = E * nu / (1 + nu) / (1 - 2*(nu));
    mu = E / 2. / (1+nu);
    mI = diagm(0=>[1, 1, 1, 0.5, 0.5, 0.5]);
    m1m1 = _m1*_m1';
    I3 = [1.0 0 0; 0 1.0 0; 0 0 1.0]
    b = [0.0 0 0; 0 0.0 0; 0 0 0.0]
    sigma = [0.0 0 0; 0 0.0 0; 0 0 0.0]
    return MatDeforNeohookean(mr, mass_density, E, nu, lambda, mu,
		              tangentmoduli3d!, update3d!,
		              deepcopy(mI), deepcopy(m1m1), deepcopy(I3), deepcopy(b), deepcopy(sigma))
end

"""
        MatDeforNeohookean(mr::Type{MR}, E::FFlt, nu::FFlt) where {MR}

    Create neohookean isotropic elastic material.

    The mass density is the default value.
"""
function MatDeforNeohookean(mr::Type{MR}, E::FFlt, nu::FFlt) where {MR}
    mass_density = 1.0
    return MatDeforNeohookean(mr, mass_density, E, nu)
end

"""
    estimatesoundspeed(self::M)  where {M<:AbstractMatDeforNonlinear}

Estimate sound speed in the undeformed state.
"""
function estimatesoundspeed(self::M)  where {M<:MatDeforNeohookean}
    return sqrt((self._lambda + 2 * self._mu) / self.mass_density)
end

end


text:
@testset "LPCM (De)serialization API ($file_format)" for file_format in ("lpcm", "lpcm.zst")
    info = SamplesInfo(kind="kind", channels=["a", "b", "c"], sample_unit="unit",
                       sample_resolution_in_unit=0.25, sample_offset_in_unit=-0.5,
                       sample_type=Int16, sample_rate=50.5)
    samples = encode(Samples(rand(MersenneTwister(1), 3, Int(50.5 * 10)), info, false))
    fmt = format(file_format, info)
    @test_throws ArgumentError format(file_format * ".lol", info)

    bytes = serialize_lpcm(fmt, samples.data)
    @test bytes == serialize_lpcm(fmt, view(samples.data, :, :))
    @test deserialize_lpcm(fmt, bytes) == samples.data
    @test deserialize_lpcm(fmt, bytes, 99) == view(samples.data, :, 100:size(samples.data, 2))
    @test deserialize_lpcm(fmt, bytes, 99, 201) == view(samples.data, :, 100:300)

    io = IOBuffer()
    stream = serializing_lpcm_stream(fmt, io)
    serialize_lpcm(stream, samples.data)
    @test finalize_lpcm_stream(stream)
    seekstart(io)
    stream = deserializing_lpcm_stream(fmt, io)
    @test deserialize_lpcm(stream) == samples.data
    finalize_lpcm_stream(stream) && close(io)

    io = IOBuffer()
    for _ in 1:2 # test `io` reuse for serialization
        stream = serializing_lpcm_stream(fmt, io)
        serialize_lpcm(stream, samples.data)
        @test finalize_lpcm_stream(stream)
    end
    seekstart(io)
    stream = deserializing_lpcm_stream(fmt, io)
    @test deserialize_lpcm(stream) == hcat(samples.data, samples.data)
    finalize_lpcm_stream(stream) && close(io)

    io = IOBuffer(bytes)
    stream = deserializing_lpcm_stream(fmt, io)
    @test deserialize_lpcm(stream, 49, 51) == view(samples.data, :, 50:100)
    @test deserialize_lpcm(stream, 49, 51) == view(samples.data, :, 150:200)
    @test deserialize_lpcm(stream, 9) == view(samples.data, :, 210:size(samples.data, 2))
    finalize_lpcm_stream(stream) && close(io)

    callback, byte_offset, byte_count = deserialize_lpcm_callback(fmt, 99, 201)
    if file_format == "lpcm"
        byte_range = (byte_offset + 1):(byte_offset + byte_count)
        @test callback(bytes[byte_range]) == view(samples.data, :, 100:300)
        @test bytes == reinterpret(UInt8, vec(samples.data))
    else
        @test ismissing(byte_offset) && ismissing(byte_count)
        @test callback(bytes) == view(samples.data, :, 100:300)
    end
end


text:
"""
Mean mutual information of column a (Dunn et. al. 2008).
Summation is over j=1 to N, j ≠ a. Total is N-1.
"""
_mean_column(mi::Matrix) = (squeeze(sum(mi, 1),1) .- diag(mi)) ./ (size(mi,1)-1)

"""
Mean mutual information of column a (Dunn et. al. 2008).
Summation is over j=1 to N, j ≠ a. Total is N-1.

Overall mean mutual information (Dunn et. al. 2008).
2/(N*(N-1)) by the sum of MI where the indices run i=1 to N-1, j=i+1 to N (triu).
"""
function _mean_total(mi::Matrix)
  values = matrix2list(mi)
  sum(values) / length(values)
end

"APC (Dunn et. al. 2008)"
function APC!{T}(MI::Matrix{T})
  nrow, ncol = size(MI)
  MI_mean = _mean_total(MI)
#   if MI_mean ==  0.0
#     return(fill!(MI, zero(T)))
#   end
  MI_res_mean = _mean_column(MI)
  @inbounds for j in 1:ncol
    for i in 1:nrow
      if i != j
        MI[i,j] -= ((MI_res_mean[i] * MI_res_mean[j]) /  MI_mean)
      else
        MI[i,j] = NaN
      end
    end
  end
  MI
end

function APC!{T <: AbstractFloat}(MI::PairwiseListMatrix{T, true})
  ncol = MI.nelements
  MI_col_sum = vec(sum_nodiag(MI, 1))
  MI_mean = sum(MI_col_sum) / (length(MI) - ncol)
  MI_col_mean = MI_col_sum ./ (ncol-1)
  k = 0
  list = MI.list
  @inbounds for i in 1:ncol
    for j in i:ncol
      k += 1
      if i != j
        list[k] -= ((MI_col_mean[i] * MI_col_mean[j]) /  MI_mean)
      else
        list[k] = NaN
      end
    end
  end
  MI
end

function APC!{T <: AbstractFloat}(MI::PairwiseListMatrix{T, false})
  ncol = MI.nelements
  MI_col_sum = vec(sum_nodiag(MI, 1))
  MI_mean = sum(MI_col_sum) / (length(MI) - ncol)
  MI_col_mean = MI_col_sum ./ (ncol-1)
  k = 0
  list = MI.list
  @inbounds for i in 1:(ncol-1)
    for j in (i+1):ncol
      k += 1
      list[k] -= ((MI_col_mean[i] * MI_col_mean[j]) /  MI_mean)
    end
  end
  MI.diag[:] = NaN
  MI
end


text:
using Distributions

d = Distributions.GeneralizedInverseGaussian(1,2,1)

# x, pdf
pdfs = [
    0.0000001 0.000000000 -1.000000e7;
    0.5000001 0.118601367 -2.131987;
    1.0000001 0.251079021 -1.381988;
    1.5000001 0.272898789 -1.298654;
    2.0000001 0.251079002 -1.381988;
    2.5000001 0.216105698 -1.531988;
    3.0000001 0.179905964 -1.715321;
    3.5000001 0.146944261 -1.917702;
    4.0000001 0.118601320 -2.131988;
    4.5000001 0.094968513 -2.354210;
    5.0000001 0.075623540 -2.581988;
    5.5000001 0.059976297 -2.813806;
    6.0000001 0.047422697 -3.048654;
    6.5000001 0.037409379 -3.285834;
    7.0000001 0.029456378 -3.524845;
    7.5000001 0.023160177 -3.765321;
    8.0000001 0.018188101 -4.006988;
    8.5000001 0.014269445 -4.249635;
    9.0000001 0.011185927 -4.493099;
    9.5000001 0.008762703 -4.737251
]

@testset "pdf_cdf" begin
    for i in 1:size(pdfs,1)
        @test round(Distributions.pdf(d,pdfs[i,1]),digits=9) ≈ pdfs[i,2]
        @test round(Distributions.logpdf(d,pdfs[i,1]),digits=6) ≈ pdfs[i,3]
    end
    @test_throws MethodError Distributions.cdf(d,1)
end

@testset "statistics" begin
    @test Distributions.mean(d) ≈ 3.076386787
    @test Distributions.mode(d) ≈ sqrt(2)
    @test Distributions.var(d) ≈ 4.841391484
end


text:
using Molly, ParticleAccelerations
using Molly: LennardJones

ParticleAccelerations.number_of_particles(s::Simulation, i) = length(s.coords)
ParticleAccelerations.interactions(s::Simulation) = (values(s.general_inters)..., values(s.specific_inter_lists)...)
ParticleAccelerations.force!(dv, inter, s::Simulation, i, j) = force!(dv, inter, s, i, j)
ParticleAccelerations.particle_mass(s::Simulation, i) = s.atoms[i].mass
ParticleAccelerations.summation_alg(::LennardJones) = PairwiseSymmetric{false}()
ParticleAccelerations.issparse(::LennardJones) = Val(false)
ParticleAccelerations.atype(s::Simulation) = zero(s.coords)

n_atoms = 100
box_size = 2.0 # nm
temperature = 298 # K
mass = 10.0 # Relative atomic mass

atoms = [Atom(mass=mass, σ=0.3, ϵ=0.2) for i in 1:n_atoms]
coords = [box_size .* rand(SVector{3}) for i in 1:n_atoms]
velocities = [velocity(mass, temperature) for i in 1:n_atoms]
general_inters = (LennardJones(),)

s = Simulation(
    simulator=VelocityVerlet(),
    atoms=atoms,
    general_inters=general_inters,
    coords=coords,
    velocities=velocities,
    temperature=temperature,
    box_size=box_size,
    thermostat=AndersenThermostat(1.0),
    loggers=Dict("temp" => TemperatureLogger(100)),
    timestep=0.002, # ps
    n_steps=10_000
)

neigh = find_neighbours(s, nothing, s.neighbour_finder, 0, parallel=false)

a = accelerations(s, neigh)
b = total_acceleration(s)

@test a == b


text:
#!/usr/bin/env julia

using Distributed
using JLD2
using FileIO
using ArgParse
using Distributions
using CumulantsFeatures
using LinearAlgebra
addprocs(6)
@everywhere using CumulantsFeatures
#using StatsBase
using ROCAnalysis
using PyCall
@pyimport matplotlib as mpl
@pyimport matplotlib.colors as mc
mpl.rc("text", usetex=true)
mpl.use("Agg")
using PyPlot

function detection_hosvd(data::Dict, β::Float64, r::Int = 3)
  ret = 0.
  l = length(data["data"])
  de = zeros(l, 2)
  for m=1:l
    println("hosvd detector")
    println(m)
    d = hosvdc4detect(data["data"]["$m"]["x_malf"], β, r)
    aa = data["a"]
    detected = count(findall(d) .<= aa)
    falsep = count(findall(d) .> aa)
    de[m,:] = [detected/aa, falsep/(detected+falsep)]
  end
  de
end

function detection_rx(data::Dict, α::Float64 = 0.99)
  ret = 0.
  l = length(data["data"])
  de = zeros(l, 2)
  for m=1:l
    println(m)
    d = findall(rxdetect(data["data"]["$m"]["x_malf"], α))
    aa = data["a"]
    detected = count(d .<= aa)
    falsep = count(d .> aa)
    de[m,:] = [detected/aa, falsep/(detected+falsep)]
  end
  de
end

function plotdet(r, rx, j::Int = 3, nu::Int = 5)
  mpl.rc("font", family="serif", size = 7)
  fig, ax = subplots(figsize = (2.5, 2.))
  ret = zeros(size(r[1],1))
  retrx = copy(ret)
  a = ["x-", "d-"]
  for i in 1:size(r[1],1)
    x = [k[i,2] for k in r]
    y = [k[i,1] for k in r]
    xr = [k[i,2] for k in rx]
    yr = [k[i,1] for k in rx]
    ret[i] = auc(x,y)
    retrx[i] = auc(xr,yr)
    if i == j
      p = sortperm(x)
      p1 = sortperm(xr)
      x = x[p]
      y = y[p]
      xr = xr[p1]
      yr = yr[p1]
      plt[:semilogx](x, y, "--", label = "Alg. 1", color = "blue")
      plt[:semilogx](xr, yr, "--", label = "RX", color = "red")
      ax[:legend](fontsize = 6., loc = 2, ncol = 2)
      subplots_adjust(left = 0.15, bottom = 0.16)
      show()
      xlabel("false alarm probability", labelpad = -1.0)
      ylabel("detection probability", labelpad = 0.)
      savefig("$(nu)_$(j)detect.pdf")
    end
  end
  ret, retrx
end

function plotauc(h, rx, nu = 10)
  x = collect(1:1:size(h,1))
  mpl.rc("font", family="serif", size = 7)
  fig, ax = subplots(figsize = (2.5, 2.))
  plot(x, h, "--", label = "Alg. 1", color = "blue")
  plot(x, rx, "--", label = "RX", color = "red")
  ax[:legend](fontsize = 6., loc = 2, ncol = 2)
  subplots_adjust(left = 0.15, bottom = 0.16)
  xlabel("no. experiment", labelpad = -1.0)
  ylabel("AUC", labelpad = 0.)
  savefig("$(nu)AUC.pdf")
end

function main(args)
  s = ArgParseSettings("description")
  @add_arg_table s begin
    "file"
    help = "the file name"
    arg_type = String
  end
  parsed_args = parse_args(s)
  str = parsed_args["file"]
  data = load(str)
  ν = data["ν"]

  if !isfile("roc"*str)
    ks = vcat(collect(6.:-0.15:1.2))
    roc = [detection_hosvd(data, k) for k in ks]
    save("roc"*str, "roc", roc, "ks", ks)
  end

  if !isfile("rocrx"*str)
    as = vcat(collect(0.45:0.03:0.99), collect(0.991:0.001:0.999), [0.99925, 0.9995, 0.99975, 0.9999, 0.999925, 0.99995, 0.999975, 0.99999, 0.999999, 0.9999999])
    as = as[end:-1:1]
    rocrx = [detection_rx(data, k) for k in as]
    save("rocrx"*str, "roc", rocrx, "alpha", as)
  end

  r = load("roc"*str)["roc"]
  rr = load("rocrx"*str)["roc"]
  h, rx = plotdet(r, rr, 1, ν)
  plotauc(h, rx, ν)
end

main(ARGS)


text:
"""
    enforce_boundary_conditions(x, xₗ, xᵣ, ::Bounded)

If a particle with position `x` and domain `xₗ < x < xᵣ` goes through the edge of the domain
along a `Bounded` dimension, put them back at the wall.
"""
@inline function enforce_boundary_conditions(::Bounded, x, xₗ, xᵣ, restitution)
    x > xᵣ && return xᵣ - (x - xᵣ) * restitution
    x < xₗ && return xₗ + (xₗ - x) * restitution
    return x
end

"""
    enforce_boundary_conditions(x, xₗ, xᵣ, ::Periodic)

If a particle with position `x` and domain `xₗ < x < xᵣ` goes through the edge of the domain
along a `Periodic` dimension, put them on the other side.
"""
@inline function enforce_boundary_conditions(::Periodic, x, xₗ, xᵣ, restitution)
    x > xᵣ && return xₗ + (x - xᵣ)
    x < xₗ && return xᵣ - (xₗ - x)
    return x
end

@kernel function _advect_particles!(particles, restitution, grid::RectilinearGrid{FT, TX, TY, TZ}, Δt, velocities) where {FT, TX, TY, TZ}
    p = @index(Global)

    # Advect particles using forward Euler.
    @inbounds particles.x[p] += interpolate(velocities.u, Face(), Center(), Center(), grid, particles.x[p], particles.y[p], particles.z[p]) * Δt
    @inbounds particles.y[p] += interpolate(velocities.v, Center(), Face(), Center(), grid, particles.x[p], particles.y[p], particles.z[p]) * Δt
    @inbounds particles.z[p] += interpolate(velocities.w, Center(), Center(), Face(), grid, particles.x[p], particles.y[p], particles.z[p]) * Δt

    # Enforce boundary conditions for particles.
    @inbounds particles.x[p] = enforce_boundary_conditions(TX(), particles.x[p], grid.xᶠᵃᵃ[1], grid.xᶠᵃᵃ[grid.Nx], restitution)
    @inbounds particles.y[p] = enforce_boundary_conditions(TY(), particles.y[p], grid.yᵃᶠᵃ[1], grid.yᵃᶠᵃ[grid.Ny], restitution)
    @inbounds particles.z[p] = enforce_boundary_conditions(TZ(), particles.z[p], grid.zᵃᵃᶠ[1], grid.zᵃᵃᶠ[grid.Nz], restitution)
end

@kernel function update_field_property!(particle_property, particles, grid, field, LX, LY, LZ)
    p = @index(Global)

    @inbounds particle_property[p] = interpolate(field, LX, LY, LZ, grid, particles.x[p], particles.y[p], particles.z[p])
end

function update_particle_properties!(lagrangian_particles, model, Δt)

    # Update tracked field properties.
    workgroup = min(length(lagrangian_particles), 256)
    worksize = length(lagrangian_particles)

    events = []

    for (field_name, tracked_field) in pairs(lagrangian_particles.tracked_fields)
        compute!(tracked_field)
        particle_property = getproperty(lagrangian_particles.properties, field_name)
        LX, LY, LZ = location(tracked_field)

        update_field_property_kernel! = update_field_property!(device(model.architecture), workgroup, worksize)

        update_event = update_field_property_kernel!(particle_property, lagrangian_particles.properties, model.grid,
                                                     datatuple(tracked_field), LX(), LY(), LZ(),
                                                     dependencies=Event(device(model.architecture)))
        push!(events, update_event)
    end

    wait(device(model.architecture), MultiEvent(Tuple(events)))

    # Compute dynamics

    lagrangian_particles.dynamics(lagrangian_particles, model, Δt)

    # Advect particles

    advect_particles_kernel! = _advect_particles!(device(model.architecture), workgroup, worksize)

    advect_particles_event = advect_particles_kernel!(lagrangian_particles.properties, lagrangian_particles.restitution, model.grid, Δt,
                                                      datatuple(model.velocities),
                                                      dependencies=Event(device(model.architecture)))

    wait(device(model.architecture), advect_particles_event)

    return nothing
end

update_particle_properties!(::Nothing, model, Δt) = nothing

update_particle_properties!(model, Δt) = update_particle_properties!(model.particles, model, Δt)


text:
using Distributions, StatsBase
using JLD, PyPlot

function qqplot(z; color="black")
    n = length(z)

    grid = [(1 / (n + 1)):(1 / (n + 1)):(1.0 - (1 / (n + 1)));]

    qz = quantile(z, grid)
    qd = quantile.(Ref(Distributions.Normal()), grid)

    lims = 3.290
    x = range(-lims, stop=lims)

    plot(x, x, color="grey", linestyle=":", linewidth=.25)
    scatter(qz, qd, s=.75, color=color)

    xlim([-lims, lims])
    ylim([-lims, lims])

    nothing
end

for m in [25, 50]
    for graph in ["chain1", "chain2", "tree1", "tree2"]
        file = jldopen("res/res_$(graph)_$(m).jld", "r")
        res = read(file, "res")

        x = range(-3.290, stop=3.290, length=100)
        y = pdf.(Normal(), x)

        fig = figure(figsize=(7.08661, 4.72441), dpi=1000)

        ax = subplot(2, 3, 1)
        qqplot(res[:, 1, 2], color="grey")
        qqplot(res[:, 2, 2])
        title("naive re-fitting", size="small")
        ax[:tick_params]("both", labelsize="xx-small", length=2, pad=2)

        ax = subplot(2, 3, 2)
        qqplot(res[:, 1, 2], color="grey")
        qqplot(res[:, 3, 2])
        title("SparKLIE+1", size="small")
        ax[:tick_params]("both", labelsize="xx-small", length=2, pad=2)

        ax = subplot(2, 3, 3)
        qqplot(res[:, 1, 2], color="grey")
        qqplot(res[:, 4, 2])
        title("SparKLIE+2", size="small")
        ax[:tick_params]("both", labelsize="xx-small", length=2, pad=2)

        ax = subplot(2, 3, 4)
        plt[:hist](res[:, 2, 2], 100, density=true)
        plot(x,y)
        xlim(-3.290,3.290)
        ax[:tick_params]("both", labelsize="xx-small", length=2, pad=2)

        ax = subplot(2, 3, 5)
        plt[:hist](res[:, 3, 2], 100, density=true)
        plot(x,y)
        xlim(-3.290,3.290)
        ax[:tick_params]("both", labelsize="xx-small", length=2, pad=2)

        ax = subplot(2, 3, 6)
        plt[:hist](res[:, 4, 2], 100, density=true)
        plot(x,y)
        xlim(-3.290,3.290)
        ax[:tick_params]("both", labelsize="xx-small", length=2, pad=2)

        tight_layout()

        savefig("res/exper1_$(graph)_$(m).pdf")
        close(fig)
    end
end


text:
abstract type AbstractTarget end

struct Target <: AbstractTarget
  chromiumWebSocket::URIParser.URI    # websocket server for the target
  targetId::String                    # target id in chromium
end

struct Chromium <: AbstractTarget
  chromiumWebSocket::URIParser.URI    # websocket server for the target
  targetId::String                    # target id in chromium
  server::HttpServer.Server  # julia websocket server
  cprocess::Base.Process     # Headless Chromium process
  outchan::Channel{String}   # Channel for outgoing messages
  inchan::Channel            # Channel for received messages
  chromiumport::Int        # Chromium websocket port
  juliaport::Int           # Julia websocket port
  id2callbacks::Dict         # command callbacks (by command id)
  ws2callbacks::Dict         # event callbacks (by ws uri)
end

"""
    `dispatcher()`

Dispatches messages received from Chromium.
"""
function dispatcher()
  for m in chromiumHandle.inchan
    msg = JSON.parse(m)
    DEBUG && info("received $msg")

    # Command result
    if haskey(msg, "id")
      if haskey(chromiumHandle.id2callbacks, msg["id"])
        cb = chromiumHandle.id2callbacks[msg["id"]] # resp callback
        isa(cb, Function) && try Base.invokelatest(cb, msg) end
        delete!(chromiumHandle.id2callbacks, msg["id"])
      else
        warn("undispatchable command result : $msg")
      end

    # Event
    elseif haskey(msg, "method") # likely an event, forward to the event callback
      if ismatch(r"/([^/]*)$", msg["origin"])
        targetId = match(r"/([^/]*)$", msg["origin"]).captures[1]
        if haskey(chromiumHandle.ws2callbacks, targetId)
          ecb = chromiumHandle.ws2callbacks[targetId]
          isa(ecb, Function) && try Base.invokelatest(ecb, msg) end
        else
          warn("undispatchable event : $msg")
        end
      else
        warn("undispatchable event : $msg")
      end

    else
      warn("received msg that is neither a command result nor an event : $msg")
    end
  end
  println("exiting listening loop")
end

"""
    `startChromium(outchan::Channel, inchan::Channel, port::Int)`

Starts the chromium process and connects the websockets.
"""
function startChromium()
  # launch julia websocket server
  jport   = findfreeport()
  inchan  = Channel(100) # Channel for inbound messages
  outchan = Channel{String}(100) # Channel for outbound messages
  server  = launchServer(outchan, inchan, jport) # launch ws server

  # launch chromium
  intpath = createPage(jport)

  chproc = nothing

  global chromiumHandle =
    try
      cport = findfreeport(9225)
      opt1, opt2, opt3 = "--headless", "--disable-gpu", "--remote-debugging-port=$cport"
      chproc = spawn(`$chromium $opt1 $opt2 $opt3 "file://$intpath"`)

      # connect ws proxy page to chrome devtools interface
      resp = retry(HTTP.get, delays=[1,2,5,10])("http://localhost:$cport/json")
      tdemp = JSON.parse(String(resp.body.buffer))
      pdict = findfirst(d -> haskey(d,"type") && d["type"]=="page", tdemp)
      pdict == 0 && error("")
      wsuri = tdemp[pdict]["webSocketDebuggerUrl"]

      put!(outchan, JSON.json(Dict(:command => "connect", :uri => wsuri)))

      Chromium(URIParser.URI(wsuri), tdemp[pdict]["id"],
               server, chproc, outchan, inchan,
               cport, jport,
               Dict(), Dict())

    catch e
      isopen(inchan) && close(inchan)
      isopen(outchan) && close(outchan)
      (chproc!=nothing) && process_running(chproc) && kill(chproc)
      error("could not establish connection to chromium, $e")
    end

  # async loop listening to received messages and dispatching them
  @async dispatcher()

  chromiumHandle
end

"""
    `stopChromium()`

Stops the chromium process & the Julia websocket server, closes the channels.
"""
function stopChromium()
  kill(chromiumHandle.cprocess)
  close(chromiumHandle.outchan)
  close(chromiumHandle.inchan)
  close(chromiumHandle.server)
  global chromiumHandle = nothing
end

"""
    `Target(url::String) -> Target`

Opens a new Chromium 'target', i.e. the page at the given url.
"""
function Target(url::String, eventCallback::Union{Void,Function}=nothing)
  if isa(chromiumHandle, Void)
    startChromium()
    sleep(3) # FIXME : do better than a timed delay
  end

  resp = send(chromiumHandle, "Target.createTarget", url=url)
  targetId = resp["result"]["targetId"]
  targetws = "ws://localhost:$(chromiumHandle.chromiumport)/devtools/page/$targetId"

  put!(chromiumHandle.outchan, JSON.json(Dict(:command => "connect", :uri => targetws)))

  # register callback for events
  chromiumHandle.ws2callbacks[targetId] = eventCallback

  nt = Target(URIParser.URI(targetws), targetId)
  # finalizer(nt, close) # close page, remove event callback # mutable objects only
  nt
end

"""
    `close(tgt::Target)`

Closes the target, and frees up associated ressources.
"""
function close(tgt::Target)
  send(chromiumHandle, "Target.closeTarget", targetId=tgt.targetId)
  delete!(chromiumHandle.ws2callbacks, tgt.chromiumWebSocket)
end


text:
###############################################################################
#
# Update carbon and water fluxes
#
# TODO: work more to make this function more customized
#
###############################################################################
"""
    layer_fluxes!(
                node::SPACMono{FT};
                updating::Bool = false
    ) where {FT<:AbstractFloat}

Run carbon, water, energy, and SIF fluxes for all canopy layers, given
- `node` [`SPACMono`](@ref) type struct
- `updating` If true, update cavitation history
"""
function layer_fluxes!(
            node::SPACMono{FT};
            updating::Bool = false
) where {FT<:AbstractFloat}
    # 0.1 unpack data
    @unpack angles, can_opt, can_rad, canopy_rt, envirs, f_SL, ga, in_rad,
            leaves_rt, n_canopy, photo_set, plant_hs, plant_ps, rt_con, rt_dim,
            soil_opt, stomata_model, wl_set = node;
    @unpack nAzi, nIncl = canopy_rt;
    nSL = nAzi * nIncl;

    canopy_geometry!(canopy_rt, angles, can_opt, rt_con);
    canopy_matrices!(leaves_rt, can_opt);
    short_wave!(canopy_rt, can_opt, can_rad, in_rad, soil_opt, rt_con);
    canopy_fluxes!(canopy_rt, can_opt, can_rad, in_rad, soil_opt, leaves_rt,
                   wl_set, rt_con);

    #
    f_H₂O = 0;
    f_GPP = 0;
    f_NPP = 0;
    for i_can in 1:n_canopy
        iEN = envirs[i_can];
        iHS = plant_hs.leaves[i_can];
        iPS = plant_ps[i_can];
        iRT = n_canopy + 1 - i_can;

        iPS.T = can_rad.T_sun[i_can];
        update_leaf_TP!(photo_set, iPS, iHS, iEN);
        temperature_effects!(iHS, iPS.T);

        # calculate the fraction of sunlit and shaded leaves
        f_view = (can_opt.Ps[iRT] + can_opt.Ps[iRT+1]) / 2;
        for iLF in 1:nSL
            iPS.APAR[iLF] = can_rad.absPAR_sunCab[(iRT-1)*nSL+iLF] * FT(1e6);
            iPS.LAIx[iLF] = f_view * f_SL[iLF];
        end
        iPS.APAR[end] = can_rad.absPAR_shadeCab[iRT] * FT(1e6);
        iPS.LAIx[end] = 1 - f_view;

        # iterate for N times until sum(iPS.Ag) does not change any more
        sum_ag_last = sum(iPS.Ag);
        count       = 0;
        while true
            # calculate the photosynthetic rates
            count += 1;
            gas_exchange!(photo_set, iPS, iEN, GswDrive());
            if typeof(stomata_model) <: EmpiricalStomatalModel
                #
                #
                #
                #
                # also need to determine which β function is used
                #     to tune g1
                #     to tune Vcmax
                #
                #
                #
                #
                prognostic_gsw!(iPS, iEN, stomata_model, FT(1), FT(120));
            else
                prognostic_gsw!(photo_set, iPS, iHS, iEN, stomata_model,
                                FT(120));
            end
            gsw_control!(photo_set, iPS, iEN);
            sum_ag_curr = sum(iPS.Ag);
            if (abs(sum_ag_curr - sum_ag_last) < 0.01) || count > 1000
                break
            else
                sum_ag_last = sum_ag_curr;
            end
        end

        # update the fluorescence quantum yield from leaf level calculation
        can_rad.ϕ_sun[:,:,iRT] .= reshape(view(iPS.ϕs,1:nSL), nIncl, nAzi);
        can_rad.ϕ_shade[iRT] = iPS.ϕs[end];

        # update the flow rates
        for iLF in 1:(nSL+1)
            f_GPP += iPS.Ag[iLF] * iPS.LAIx[iLF] * iPS.LA;
            f_NPP += iPS.An[iLF] * iPS.LAIx[iLF] * iPS.LA;
            f_H₂O += iPS.g_lw[iLF] * (iPS.p_sat - iEN.p_H₂O) / iEN.p_atm *
                     iPS.LAIx[iLF] * iPS.LA;
        end
    end

    # do SIF simulation
    SIF_fluxes!(leaves_rt, can_opt, can_rad, canopy_rt, soil_opt,
                wl_set, rt_con, rt_dim);

    # update flow profile and pressure history along the tree
    if updating
        for i_can in 1:n_canopy
            iEN = envirs[i_can];
            iLF = plant_hs.leaves[i_can];
            iPS = plant_ps[i_can];
            iST = plant_hs.branch[i_can];
            iLF.flow = sum(iPS.g_lw .* iPS.LAIx) *
                       (iPS.p_sat - iEN.p_H₂O) / iEN.p_atm;
            iST.flow = iLF.flow * iPS.LA;
        end
        plant_hs.trunk.flow = sum([iST.flow for iST in plant_hs.branch]);
        for iRT in plant_hs.roots
            iRT.flow = plant_hs.trunk.flow / length(plant_hs.roots);
        end
        pressure_profile!(plant_hs, SteadyStateMode(); update=true);
    end

    # update the flows in SPACMono
    node.f_gpp = f_GPP / ga;
    node.f_npp = f_NPP / ga;
    node.f_H₂O = f_H₂O / ga;

    return nothing
end

max_stars_repo_name: bbuman/Land

max_issues_repo_name: bbuman/Land

max_forks_repo_name: bbuman/Land