text:
@testset "SimulationSpace Free" begin

    @test hasmethod(AgentBasedModels.arguments_!,(AgentBasedModels.Program_,Agent,SimulationFree,String))
    @test hasmethod(AgentBasedModels.loop_,(AgentBasedModels.Program_,Agent,SimulationFree,Expr,String))

    @test AgentBasedModels.arguments_!(AgentBasedModels.Program_(@agent(3),SimulationFree(@agent(3))),@agent(3),SimulationFree(@agent(3)),"gpu") == Nothing

    @test_nowarn begin

        m = @agent(
            0,

            [l1,l2]::Local,
            [i1,i2]::Identity,

            UpdateLocalInteraction = begin
                if sqrt((l1_j-l1_i)^2+(l2_j-l2_i)^2) < 5
                    l1 += 1
                end
            end
        )

        s = SimulationFree(m)

        m = compile(m,s)
    end

    m = @agent(
        0,

        [l1,l2,intLocal,int]::Local,
        [i1,i2]::Identity,

        Equation = begin
            nothing
        end,

        UpdateInteraction = begin
            if sqrt((l1_j-l1_i)^2+(l2_j-l2_i)^2) < 5
                int_i += 1
            end
        end,

        UpdateLocalInteraction = begin
            if sqrt((l1_j-l1_i)^2+(l2_j-l2_i)^2) < 5
                intLocal_i += 1
            end
        end
    )
    s = SimulationFree(m)
    m = compile(m,s,debug=false)

    @test begin
        com = Community(m,N=4)
        com.l1 = [1,1,0,0]
        com.l2 = [0,1,1,0]

        comt = m.evolve(com,dt=0.1,tMax=1)
        comt[1].int == [4,4,4,4]
    end

    @test begin
        com = Community(m,N=4)
        com.l1 = [1,1,0,0]
        com.l2 = [0,1,1,0]

        comt = m.evolve(com,dt=0.1,tMax=1)
        comt[1].intLocal == [4,4,4,4]
    end

    @test begin
        com = Community(m,N=4)
        com.l1 = [7,7,0,0]
        com.l2 = [0,7,7,0]

        comt = m.evolve(com,dt=0.1,tMax=1)
        comt[1].int == [1,1,1,1]
    end

    @test begin
        com = Community(m,N=4)
        com.l1 = [7,7,0,0]
        com.l2 = [0,7,7,0]

        comt = m.evolve(com,dt=0.1,tMax=1)
        comt[1].intLocal == [1,1,1,1]
    end

end

@testset "SimulationSpace Grid" begin

    @test hasmethod(AgentBasedModels.arguments_!,(AgentBasedModels.Program_, Agent, SimulationGrid, String))
    @test hasmethod(AgentBasedModels.loop_,(AgentBasedModels.Program_, Agent, SimulationGrid, Expr, String))

    m = @agent 3 [w]::Local;
    @test_throws ErrorException SimulationGrid(m,[(:x,2.,1.)],1)
    @test_throws ErrorException SimulationGrid(m,[(:g,1.,2.)],1)
    @test_throws ErrorException SimulationGrid(m,[(:x,1.,2.),(:x,1.,2.)],1)
    @test_throws ErrorException SimulationGrid(m,[(:x,1.,2.),(:y,1.,2.),(:z,1.,2.),(:w,1.,2.)],1)
    @test_throws ErrorException SimulationGrid(m,[(:x,1.,2.),(:y,1.,2.),(:z,1.,2.),(:w,1.,2.)],[1,2])

    @test_nowarn SimulationGrid(m,[(:x,0.,1.),(:y,0.,2.),(:z,0.,3.)],1)
    @test_nowarn SimulationGrid(m,[(:x,0.,1.),(:y,0.,2.),(:z,0.,3.)],[1.,2.,3.])
    @test_nowarn SimulationGrid(m,[Bound(:x,0.,1.),Periodic(:y,0.,2.),Bound(:z,0.,3.)],5.)

    nn = SimulationGrid(m,[(:x,0.,1.),(:y,0.,2.),(:z,0.,3.)],1.)
    @test nn.dim == 3
    @test nn.n == 3*4*5
    @test nn.axisSize == [3,4,5]
    @test nn.cumSize == [1,3,12]

    @test begin
        xx = []
        for x in -2.:1.:2.
            push!(xx,AgentBasedModels.position2gridVectorPosition_(x,-1.5,1.,5))
        end
        xx == Array(1:5)
    end

    @test begin
        xx = []
        for y in -3.:1.:3.
            for x in -2.:1.:2.
                push!(xx,AgentBasedModels.position2gridVectorPosition_(x,-1.5,1.,5,y,-2.5,1.,7))
            end
        end
        xx == Array(1:5*7)
    end

    @test begin
        xx = []
        for z in -4.:1.:4.
            for y in -3.:1.:3.
                for x in -2.:1.:2.
                    push!(xx,AgentBasedModels.position2gridVectorPosition_(x,-1.5,1.,5,y,-2.5,1.,7,z,-3.5,1.,9))
                end
            end
        end
        xx == Array(1:5*7*9)
    end

    @test begin
        xx = []
        for x in 1:3
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(1,x,5,false))
        end
        xx == [-1,1,2]
    end

    @test begin
        xx = []
        for x in 1:3
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(2,x,5,false))
        end
        xx == [1,2,3]
    end

    @test begin
        xx = []
        for x in 1:3
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(2,x,5,true))
        end
        xx == [4,2,3]
    end

    @test begin
        xx = []
        for x in 1:3
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(4,x,5,true))
        end
        xx == [3,4,2]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(1,x,5,false,7,false))
        end
        xx == [-1,-1,-1,-1,1,2,-1,6,7]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(7,x,5,false,7,false))
        end
        xx == [1,2,3,6,7,8,11,12,13]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(25,x,5,false,5,false))
        end
        xx == [19,20,-1,24,25,-1,-1,-1,-1]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(2,x,5,true,7,false))
        end
        xx == [-1,-1,-1,4,2,3,9,7,8]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(4,x,5,true,7,false))
        end
        xx == [-1,-1,-1,3,4,2,8,9,7]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(6,x,5,false,7,true))
        end
        xx == [-1,26,27,-1,6,7,-1,11,12]
    end

    @test begin
        xx = []
        for x in 1:9
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(19,x,5,true,5,true))
        end
        xx == [13,14,12,18,19,17,8,9,7]
    end

    @test begin
        xx = []
        for x in 1:27
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(1,x,5,false,5,false,5,false))
        end
        xx == [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,-1,6,7,-1,-1,-1,-1,26,27,-1,31,32]
    end

    @test begin
        xx = []
        for x in 1:27
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(125,x,5,false,5,false,5,false))
        end
        xx == [94,95,-1,99,100,-1,-1,-1,-1,119,120,-1,124,125,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]
    end

    @test begin
        xx = []
        for x in 1:27
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(32,x,5,false,5,false,5,false))
        end
        xx == [1,2,3,6,7,8,11,12,13,26,27,28,31,32,33,36,37,38,51,52,53,56,57,58,61,62,63]
    end

    @test begin
        xx = []
        for x in 1:27
            push!(xx,AgentBasedModels.gridVectorPositionNeighbour_(32,x,5,true,5,true,5,true))
        end
        xx == [94,92,93,84,82,83,89,87,88,44,42,43,34,32,33,39,37,38,69,67,68,59,57,58,64,62,63]
    end

    @test_nowarn AgentBasedModels.arguments_!(AgentBasedModels.Program_(m,nn),m,nn,"cpu")

    for platform in testplatforms

        m = @agent(
            0,

            [l1,l2,l3,intLocal,int]::Local,
            [i1,i2]::Identity,

            Equation = begin
                d_l2 = 0.
            end,

            UpdateInteraction = begin
                if abs(l1_i - l1_j) <= 4.5
                    int += 1
                end
            end,

            UpdateLocalInteraction = begin
                intLocal += 1
            end,
        )

        s = SimulationGrid(m,[(:l1,-10,10)],[5.])
        mo = compile(m,s,platform=platform,debug=false)
        #println(mo.program)
        @test begin
            com = Community(mo,N=12)
            com.l1 .= [-11,-7,-2,2,7,11,-11,-7,-2,2,7,11]
            com.l2 .= 0

            comt = mo.evolve(com,dt=0.1,tMax=1)
            (comt[1].intLocal == [4.,6.,6.,6.,6.,4.,4.,6.,6.,6.,6.,4.]) && (comt[1].int == [4.,4.,4.,4.,4.,4.,4.,4.,4.,4.,4.,4.])
        end

        s = SimulationGrid(m,[Periodic(:l1,-10,10)],[5.])
        mo = compile(m,s,platform=platform)
        #println(mo.program)
        @test begin
            com = Community(mo,N=4)
            com.l1 .= [-7,-2,2,7]
            com.l2 .= 0

            comt = mo.evolve(com,dt=0.1,tMax=1)
            comt[1].intLocal == [3.,3.,3.,3.]
        end

        m = @agent(
            0,

            [l1,l2,l3,intLocal,int]::Local,
            [i1,i2]::Identity,

            Equation = begin
                d_l2 = 0.
            end,

            UpdateInteraction = begin
                if abs(l2_i - l2_j) <= 4.5
                    int += 1
                end
            end,

            UpdateLocalInteraction = begin
                intLocal += 1
            end,
        )

        s = SimulationGrid(m,[(:l1,-20,20),(:l2,-10,10)],[5.,5.])
        mo = compile(m,s,platform=platform)
        #println(mo.program)
        @test begin
            com = Community(mo,N=12)
            com.l2 .= [-11,-7,-2,2,7,11,-11,-7,-2,2,7,11]
            com.l1 .= 0

            comt = mo.evolve(com,dt=0.1,tMax=1)
            (comt[1].intLocal == [4.,6.,6.,6.,6.,4.,4.,6.,6.,6.,6.,4.]) && (comt[1].int == [4.,4.,4.,4.,4.,4.,4.,4.,4.,4.,4.,4.])
        end

        s = SimulationGrid(m,[Bound(:l1,-20,20),Periodic(:l2,-10,10)],[5.,5.])
        mo = compile(m,s,platform=platform)
        #println(mo.program)
        @test begin
            com = Community(mo,N=4)
            com.l2 .= [-7,-2,2,7]
            com.l1 .= 0

            comt = mo.evolve(com,dt=0.1,tMax=1)
            comt[1].intLocal == [3.,3.,3.,3.]
        end

        m = @agent(
            0,

            [l1,l2,l3,intLocal,int]::Local,
            [i1,i2]::Identity,

            Equation = begin
                d_l2 = 0.
            end,

            UpdateInteraction = begin
                if abs(l3_i - l3_j) <= 4.5
                    int += 1
                end
            end,

            UpdateLocalInteraction = begin
                intLocal += 1
            end,
        )

        s = SimulationGrid(m,[(:l1,-20,20),(:l2,-10,10),(:l3,-10,10)],[5.,5.,5.])
        mo = compile(m,s,platform=platform)
        #println(mo.program)
        @test begin
            com = Community(mo,N=12)
            com.l3 .= [-11,-7,-2,2,7,11,-11,-7,-2,2,7,11]

            comt = mo.evolve(com,dt=0.1,tMax=1)
            (comt[1].intLocal == [4.,6.,6.,6.,6.,4.,4.,6.,6.,6.,6.,4.]) && (comt[1].int == [4.,4.,4.,4.,4.,4.,4.,4.,4.,4.,4.,4.])
        end

        s = SimulationGrid(m,[(:l1,-10,10),(:l2,-10,10),Periodic(:l3,-10,10)],[5.,5.,5.])
        mo = compile(m,s,platform=platform)
        #println(mo.program)
        @test begin
            com = Community(mo,N=4)
            com.l3 .= [-7,-2,2,7]

            comt = mo.evolve(com,dt=0.1,tMax=1)
            comt[1].intLocal == [3.,3.,3.,3.]
        end

    end

end

max_stars_repo_name: gatocor/embryogenesisJulia

max_issues_repo_name: gatocor/embryogenesisJulia

max_forks_repo_name: gatocor/embryogenesisJulia


text:
module DependencyParserTest
  include("source.jl")
  include("converting.jl")
  include("benchmark.jl")
  include("dependency_tree.jl")
  include("visualizing.jl")
end

ext: jl


text:
using ProximalOperators
Random.seed!(2)

xsol1 = randn(100)

A = randn(50,100)
b = A*xsol1

S1 = IndAffine(A,b)
S2 = IndBox(0.0, Inf)

problem = Feasibility(S1, S2, 100)

sol, model = FirstOrderSolvers.solve!(problem, DR(eps=1e-8, verbose=0),checki=10)

@test sol.status == :Optimal
@test minimum(sol.x) > -1e-12
@test maximum(abs, A*sol.x - b) < 1e-12

sol, model = FirstOrderSolvers.solve!(problem, AP(eps=1e-8, verbose=0),checki=1)

@test sol.status == :Indeterminate

sol, model = FirstOrderSolvers.solve!(problem, GAP(eps=1e-8, verbose=0))

@test sol.status == :Indeterminate

sol, model = FirstOrderSolvers.solve!(problem, FISTA(eps=1e-8, verbose=1))

@test sol.status == :Indeterminate

@testset "Solver: $(typeof(alg))" for alg in
    [GAPP(eps=1e-8, verbose=0, proji=50),
    GAPA(eps=1e-8, verbose=0),
    LineSearchWrapper(GAP(eps=1e-8, verbose=0))]

    sol, model = FirstOrderSolvers.solve!(problem, alg)

    @test sol.status == :Optimal
    @test minimum(sol.x) > -1e-12
    @test maximum(abs, A*sol.x - b) < 1e-6
end


text: # Not yet


text:
#
# Copyright (c) 2021 Frederic Bruder, Tobias Thummerer, Lars Mikelsons
# Licensed under the MIT license. See LICENSE file in the project root for details.
#

module FMIZoo

using Glob, Requires

dir = @__DIR__
p_model_src = joinpath(dir |> dirname, "models", "src")
p_model_bin = joinpath(dir |> dirname, "models", "bin")
p_mos_scripts = joinpath(dir |> dirname, "mos_scripts")

absModelPaths = glob("*.mo", p_model_src)

modelNames = map(absModelPaths) do x
    return splitpath(x)[end][1:end-3]
end

include(joinpath(@__DIR__, "mosGenerators.jl"))

export list_models, get_model_filename, generate_mos_scripts, collect_fmus
include(joinpath(@__DIR__, "util.jl"))

function __init__()
    @require FMIImport="9fcbc62e-52a0-44e9-a616-1359a0008194" begin
        include(joinpath(@__DIR__, "addon.jl"))

        import .FMIImport
        FMIImport.fmi2Load(name::AbstractString, tool::AbstractString, version::AbstractString; kwargs...) = fmi2Load(name, tool, version; kwargs...)
        FMIImport.fmi3Load(name::AbstractString, tool::AbstractString, version::AbstractString; kwargs...) = fmi3Load(name, tool, version; kwargs...)
    end

    @require FMI="14a09403-18e3-468f-ad8a-74f8dda2d9ac" begin
        include(joinpath(@__DIR__, "addon.jl"))

        import .FMI
        FMI.fmiLoad(name::AbstractString, tool::AbstractString, version::AbstractString, fmiversion::AbstractString="2.0"; kwargs...) = fmiLoad(name, tool, version, fmiversion; kwargs...)
    end
end

end


text:
abstract type FluxLayer end

layertype(l) = NaiveNASlib.shapetrait(l)
layer(l) = l

# Types for layers with parameters (e.g. weights and biases) and with similar handling
# w.r.t what shape of parameters means in terms of number of inputs and number of outputs
abstract type FluxParLayer <: FluxLayer end

abstract type Flux2D <: FluxParLayer end
struct GenericFlux2D <: Flux2D end
struct FluxDense <: Flux2D end
NaiveNASlib.shapetrait(::Dense) = FluxDense()

# Might be a Flux2D, but not exactly the same. Also want to leave the door open to when/if they accept 3D input too
# Type hierarchies are hard :/
abstract type FluxRecurrent <:FluxParLayer end
struct GenericFluxRecurrent <: FluxRecurrent end
struct FluxRnn <: FluxRecurrent end
struct FluxLstm <: FluxRecurrent end
struct FluxGru <: FluxRecurrent end

NaiveNASlib.shapetrait(l::Flux.Recur) = NaiveNASlib.shapetrait(l.cell)
NaiveNASlib.shapetrait(::Flux.RNNCell) = FluxRnn()
NaiveNASlib.shapetrait(::Flux.LSTMCell) = FluxLstm()
NaiveNASlib.shapetrait(::Flux.GRUCell) = FluxGru()

abstract type FluxConvolutional{N} <: FluxParLayer end
struct GenericFluxConvolutional{N} <: FluxConvolutional{N} end
struct FluxConv{N} <: FluxConvolutional{N} end
struct FluxConvTranspose{N}  <: FluxConvolutional{N} end
struct FluxDepthwiseConv{N} <: FluxConvolutional{N}  end
struct FluxCrossCor{N} <: FluxConvolutional{N}  end
NaiveNASlib.shapetrait(::Conv{N}) where N = FluxConv{N}()
NaiveNASlib.shapetrait(::ConvTranspose{N}) where N = FluxConvTranspose{N}()
NaiveNASlib.shapetrait(::DepthwiseConv{N}) where N = FluxDepthwiseConv{N}()
NaiveNASlib.shapetrait(::CrossCor{N}) where N = FluxCrossCor{N}()

abstract type FluxTransparentLayer <: FluxLayer end
# Invariant layers with parameters, i.e nin == nout always and parameter selection must
# be performed
abstract type FluxParInvLayer <: FluxTransparentLayer end
struct FluxDiagonal <: FluxParInvLayer end
struct FluxLayerNorm <: FluxParInvLayer end
abstract type FluxParNorm <: FluxParInvLayer end
struct FluxBatchNorm <: FluxParNorm end
struct FluxInstanceNorm <: FluxParNorm end
struct FluxGroupNorm <: FluxParNorm end

NaiveNASlib.shapetrait(::Flux.Diagonal) = FluxDiagonal()
NaiveNASlib.shapetrait(::LayerNorm) = FluxLayerNorm()
NaiveNASlib.shapetrait(::BatchNorm) = FluxBatchNorm()
NaiveNASlib.shapetrait(::InstanceNorm) = FluxInstanceNorm()
NaiveNASlib.shapetrait(::GroupNorm) = FluxGroupNorm()

# Transparent layers, i.e nin == nout always and there are no parameters
abstract type FluxNoParLayer <: FluxTransparentLayer end
struct FluxPoolLayer <: FluxNoParLayer end
struct FluxDropOut <: FluxNoParLayer end

layertype(l::MaxPool) = FluxPoolLayer()
layertype(l::MeanPool) = FluxPoolLayer()
layertype(l::Dropout) = FluxDropOut()
layertype(l::AlphaDropout) = FluxDropOut()
layertype(l::GlobalMaxPool) = FluxPoolLayer()
layertype(l::GlobalMeanPool) = FluxPoolLayer()

# Compositions? Might not have any common methods...
# MaxOut, Chain?


text:
mutable struct Fusion
    c_ptr::Ptr{Cvoid}
    confidence::Float32
end

function delete!(ef::Fusion)
    ccall((:delete_elastic_fusion, :libefusion), Cvoid, (Ptr{Cvoid},), ef.c_ptr)
end

function Fusion(;
    w::Union{Int64, Int32},
    h::Union{Int64, Int32},
    fx::Union{Float32, Float64},
    fy::Union{Float32, Float64},
    cx::Union{Float32, Float64},
    cy::Union{Float32, Float64},
    timeDelta::Union{Int64, Int32},
    countThresh::Union{Int64, Int32},
    errThresh::Union{Float32, Float64},
    covThresh::Union{Float32, Float64},
    closeLoops::Bool, #// bool
    iclnuim::Bool,  #// bool
    reloc::Bool, #// bool
    photoThresh::Union{Int64, Int32, Float32, Float64},
    confidence::Union{Int64, Int32, Float32, Float64},
    depthCut::Union{Int64, Int32, Float32, Float64},
    icpThresh::Union{Int64, Int32, Float32, Float64},
    fastOdom::Bool,       #// bool
    fernThresh::Union{Int64, Int32, Float32, Float64},
    so3::Bool, #// bool
    frameToFrameRGB::Bool, # // bool
    fileName::String
    )
    ef_ptr = ccall(
        (:create_elastic_fustion, :libefusion),
        Ptr{Cvoid},
        (Cint, Cint, Cfloat, Cfloat, Cfloat, Cfloat, # end cy
         Cint, Cint, Cfloat, Cfloat, Cint, Cint, Cint, # end reloc
         Cfloat, Cfloat, Cfloat, Cfloat, Cint, Cfloat, Cint, Cint,
         Cstring),
         Cint(w),
         Cint(h),
         Cfloat(fx),
         Cfloat(fy),
         Cfloat(cx),
         Cfloat(cy),
         Cint(timeDelta),
         Cint(countThresh),
         Cfloat(errThresh),
         Cfloat(covThresh),
         Cint(closeLoops),
         Cint(iclnuim),
         Cint(reloc),
         Cfloat(photoThresh),
         Cfloat(confidence),
         Cfloat(depthCut),
         Cfloat(icpThresh),
         Cint(fastOdom),
         Cfloat(fernThresh),
         Cint(so3),
         Cint(frameToFrameRGB),
         fileName
    )

    e = Fusion(ef_ptr, Float32(confidence))
    finalizer(delete!, e)
    return e
end

# void render(
#     void* efusion_void_ptr,
#     double* mvp_ptr,
#     float threshold,
#     int drawUnstable,//bool
#     int drawNormals, //bool
#     int drawColors,  //bool
#     int drawPoints,  //bool
#     int drawWindow,  //bool
#     int drawTimes,   //bool
#     int time,
#     int timeDelta)

function process_frame!(
    ef::Fusion,
    image::Matrix{Images.RGB{Images.Normed{UInt8,8}}},
    depth::Matrix{UInt16},
    timestamp::Int64;
    depth_factor::Union{Float32, Float64}=1000.0,
    pose::Matrix{Float32}=Matrix{Float32}(undef, 0, 0),
    weightMultiplier::Union{Float32, Float64}=1.0,
    bootstrap::Bool=false
    )
#     void process_frame(
#                void* efusion_void_ptr,
#                unsigned char * rgb,
#                unsigned short * depth,
#                int64_t timestamp,
#                float* in_pose_col_major,
#                float weightMultiplier,
#                int bootstrap // bool
#                )

    pose_ptr = if length(pose) == 0
        convert(Ptr{Cfloat}, C_NULL)
    else
        Base.unsafe_convert(Ptr{Cfloat}, pose)
    end
    h, w = size(depth)
    depth = permutedims(depth,  [2, 1])

    # image16 = reshape(reinterpret(UInt8, image), 3, h, w)

    # image16_row_major = permutedims(reshape(image16, (3, w, h)), [1, 3, 2])
    image16_row_major = permutedims(image, [2, 1])
    ccall(
        (:process_frame, :libefusion),
        Cvoid,
        (Ptr{Cvoid}, Ptr{Cuchar}, Ptr{Cushort}, Clonglong,
         Cfloat,
         Ptr{Cfloat}, Cfloat, Cint),
        ef.c_ptr,
        Base.unsafe_convert(Ptr{Cuchar}, image16_row_major),
        Base.unsafe_convert(Ptr{Cushort}, depth),
        timestamp,
        Cfloat(depth_factor),
        pose_ptr,
        Cfloat(weightMultiplier),
        Cint(bootstrap)
        )
end

function render(
    ef::Fusion,
    mvp::Matrix{Float64};
    threshold::Union{Int32, Int64, Float64, Float32},
    drawUnstable::Bool,#//bool
    drawNormals::Bool,#, //bool
    drawColors::Bool,#,  //bool
    drawPoints::Bool,#,  //bool
    drawWindow::Bool,#,  //bool
    drawTimes::Bool,#,   //bool
    time::Union{Int64, Int32},
    timeDelta::Union{Int64, Int32}
)
    ccall(
        (:render, :libefusion),
        Cvoid,
        (Ptr{Cvoid}, Ptr{Cdouble}, Cfloat,
         Cint, Cint, Cint, Cint, Cint, Cint, Cint, Cint),
        ef.c_ptr,
        Base.unsafe_convert(Ptr{Cdouble}, mvp),
        Cfloat(threshold),
        Cint(drawUnstable),
        Cint(drawNormals),#, //bool
        Cint(drawColors),#,  //bool
        Cint(drawPoints),#,  //bool
        Cint(drawWindow),#,  //bool
        Cint(drawTimes),#,   //bool
        Cint(time),
        Cint(timeDelta)
    )
end

"""
this one use the default confidence threshold to filter out temp ones
"""
function save_ply(
    ef::Fusion, ply_fpath::String; confidence_threshold::Real=ef.confidence
)

    ccall(
        (:save_ply, :libefusion),
        Cvoid,
        (Ptr{Cvoid}, Cstring, Cfloat),
        ef.c_ptr,
        ply_fpath,
        Cfloat(confidence_threshold)
    )

    # void* save_ply(
    #         void* efusion_void_ptr,
    #         char* ply_fpath){
end


text:
module Friend
    export remove_nb

    function remove_nb(n)
        Σ = (n*(n+1)) ÷ 2
        result = Tuple{Int64,Int64}[]
        for a in 1:n
            b = ((Σ+1)÷(a+1))-1
            if 1 ≤ b ≤ n && Σ-a-b == a*b
                push!( result, (a,b) )
            end
        end
        result
    end

end

max_stars_repo_name: UlrichBerntien/Codewars-Katas

max_issues_repo_name: UlrichBerntien/Codewars-Katas

max_forks_repo_name: UlrichBerntien/Codewars-Katas


text:
module AffineFEOperatorsTests

using Test
using Gridap.Arrays
using Gridap.Algebra
using Gridap.TensorValues
using Gridap.ReferenceFEs
using Gridap.Geometry
using Gridap.Integration
using Gridap.Fields
using Gridap.FESpaces
using LinearAlgebra
using Gridap.CellData

domain =(0,1,0,1,0,1)
partition = (3,3,3)
model = CartesianDiscreteModel(domain,partition)
trian = get_triangulation(model)
degree = 4
quad = CellQuadrature(trian,degree)

order = 2
grid_topology = get_grid_topology(model)
polytopes = get_polytopes(grid_topology)
reffes = [LagrangianRefFE(Float64,p,order) for p in polytopes]

dirichlet_tags = [1,10]
V = GradConformingFESpace(reffes,model,dirichlet_tags)

U = TrialFESpace(V)

f(x) = x[2]

v = get_cell_basis(V)
u = get_cell_basis(U)

cellmat = integrate(∇(v)⊙∇(u),trian,quad)
cellvec = integrate(v*f,trian,quad)
cellids = collect(1:num_cells(trian))

assem = SparseMatrixAssembler(U,V)
matdata = ([cellmat],[cellids],[cellids])
vecdata = ([cellvec],[cellids])
A =  assemble_matrix(assem,matdata)
b =  assemble_vector(assem,vecdata)

op = AffineFEOperator(U,V,A,b)
@test A === get_matrix(op)
@test b === get_vector(op)

x = ones(length(b))
r = A*x - b

test_fe_operator(op,x,r,≈,jac=A)
@test isa(get_algebraic_operator(op), AffineOperator)

#

tol = 1.0e-9

u_sol(x) = x[1]+x[2]
f_fun(x) = 0

dirichlet_tags = "boundary"
V = GradConformingFESpace(reffes,model,dirichlet_tags)
U = TrialFESpace(V,u_sol)

a(v,u) = ∇(v)⊙∇(u)
l(v) = v*f_fun

t_Ω = AffineFETerm(a,l,trian,quad)

assem = SparseMatrixAssembler(V,U)

op = AffineFEOperator(U,V,assem,t_Ω)
uh = solve(op)
e = u_sol - uh
@test sum(integrate(e*e,trian,quad)) < tol

op = AffineFEOperator(U,V,t_Ω)
uh = solve(op)
e = u_sol - uh
@test sum(integrate(e*e,trian,quad)) < tol

end # module


text:
include("prime.jl")

function compute()
N=1999999
a=Int64[]
prime(N,a)
ans=sum(a)

return ans
end

print(compute())


text:
"""
    GarmanKohlhagen()

[Garman–Kohlhagen model](https://en.wikipedia.org/wiki/Foreign_exchange_option#Valuation:_the_Garman%E2%80%93Kohlhagen_model).
"""
struct GarmanKohlhagen <: Model end

"""
    evaluate(O::FXOption, GarmanKohlhagen())

Evaluate FX Option using `GarmanKohlhagen` model.

# Arguments
- `O::FXOption`
"""
function evaluate(O::FXOption, m::GarmanKohlhagen)
    d1 = (log(O.s / O.k) + (O.r_d - O.r_f * O.σ / 2) * O.t) / (O.σ * √O.t)
    d2 = d1 - O.σ * √O.t

    if O.call == -1
        return O.k * exp(-O.r_d * O.t) * cdf(Normal(), -d2) - O.s * exp(-O.r_f * O.t) * cdf(Normal(), -d1)
    elseif O.call == 1
        return O.s * exp(-O.r_f * O.t) * cdf(Normal(), d1) - O.k * exp(-O.r_d * O.t) * cdf(Normal(), d2)
    end
end


text:
using DrWatson

@quickactivate "K-Ratio Project"
using NeXLDatabase
using Gadfly, DataFrames, PlutoUI, CSV
db=openNeXLDatabase(datadir("exp_pro","kratio.db"))

pkeys =  ( 84, 85, 90, 91, 96, 97 )

krs = mapreduce(fs->findall(db, DBKRatio, campaign=fs), append!, pkeys)

Gadfly.plot(krs)


text:
module QuantumSimulation
# Include relevant packages. 'import' doesn't seem to be working well for
# individual function names.
import Base: IndexStyle, size, getindex, setindex!, min, max, adjoint,
       getproperty, getfield, +, -, *;
import LinearAlgebra#: Diagonal, SymTridiagonal, norm;
import Unitful#: Quantity, 𝐓;
using Unitful: ustrip, unit;
import UnitfulAtomicHarmonic;

# Core datatypes and functions.
include("spaces.jl");
include("grids.jl");
include("waveobjects.jl");
include("hamiltonian.jl");
include("energy.jl");
include("ip.jl");
include("simulationtypes.jl");

# Useful potential functions.
include("potentials.jl");

# Basic statistics
include("stats.jl");

# Variations common across simulations.
include("simvariations.jl");

# Simulations
include("lanczos.jl");
include("plot.jl");
include("ss.jl");

end # module


text:
# -*- coding: utf-8 -*-
# ---
# jupyter:
#   jupytext:
#     formats: ipynb,jl:hydrogen
#     text_representation:
#       extension: .jl
#       format_name: hydrogen
#       format_version: '1.3'
#       jupytext_version: 1.11.2
#   kernelspec:
#     display_name: Julia 1.6.2
#     language: julia
#     name: julia-1.6
# ---

# %% [markdown]
# https://discourse.julialang.org/t/julia-implementation-of-seqperiod-from-matlab/66791

# %%
using BenchmarkTools

function testvec(n, per; tol=1e-3)
    X = [float(mod1(k, per)) for k in 1:n]
    @. X + tol * (rand() - 0.5)
end

X = testvec(10^4, 999)
a = zeros(length(X))
a[end] = 2e-3
Y = X + a;

# %%
function seqper(x; tol=0.001)
    ind1 = findall(≤(tol), [abs.(x .- x[1])...])
    period = length(x)
    for i = 2:length(ind1)
        if maximum(abs.(x[ind1[i]:end] .- x[1:end-ind1[i]+1])) ≤ tol
            period = ind1[i] - 1
            break
        end
    end
    return period
end

@show seqper(X)
@btime seqper($X)
@show seqper(Y)
@btime seqper($Y);

# %%
function seqper1(x; tol=1e-3)
    @inbounds for k in 2:length(x)
        if abs(x[k] - x[1]) ≤ tol
            all(j -> abs(x[j] - x[j-k+1]) ≤ tol, k:lastindex(x)) && return k - 1
        end
    end
    return length(x)
end

@show seqper1(X)
@btime seqper1($X)
@show seqper1(Y)
@btime seqper1($Y);

# %%

max_stars_repo_name: genkuroki/public

max_issues_repo_name: genkuroki/public

max_forks_repo_name: genkuroki/public


text:
module StochasticDelayDiffEq
#########################################################
#########################################################
#########################################################
#########################################################
# using DifferentialEquations
using Reexport
@reexport using StochasticDiffEq
# import StochasticDiffEq: calc_J, calc_J!, calc_tderivative!, calc_tderivative
using LinearAlgebra, StaticArrays
using Parameters, DataStructures
using Logging
using RecursiveArrayTools
using DiffEqBase: AbstractSDDEProblem, AbstractSDDEAlgorithm, AbstractRODESolution, AbstractRODEFunction, AbstractSDEIntegrator, AbstractSDDEIntegrator, DEIntegrator, DEAlgorithm, AbstractRODEAlgorithm, AbstractSDEAlgorithm

import DelayDiffEq: constant_extrapolant!, constant_extrapolant, AbstractMethodOfStepsAlgorithm, iscomposite, MethodOfSteps
using DiffEqNoiseProcess

import RandomNumbers: Xorshifts
using Random
import Base: convert

# #########################################################
# #########################################################
# #########################################################
# #########################################################

include("discontinuity_type.jl")
include("integrators/type.jl")
include("integrators/interface.jl")
include("integrators/utils.jl")
include("functionwrapper.jl")
include("history_function.jl")
include("utils.jl")
include("solve.jl")

end # module


text:
lines = map(collect, readlines("data_x99.txt"))
data = permutedims(hcat(lines...))

function countTrees(data)
    trees = 0
    println(typeof(data))

    rows = size(data)[1]
    cols = size(data)[2]
    println("cols=", cols, " rows=", rows)
    col = 1
    for row in 1:rows
        println("row=", row, " col=", col)
        if(data[row,col] == '#')
            println(data[row,col])
            trees += 1
        end
        col += 3
        if(col > cols)
            break
        end
    end
    return trees
end

println("# trees = ", countTrees(data))


text:
using Bridge, Distributions, StaticArrays

PLOT = :winston
include("plot.jl")

tt = range(0, stop=1, length=1000)
G =  GammaProcess(10., 1.)
X = sample(tt, G)
plot(X, "-")
GB =  GammaBridge(1., 1., G)
XB = sample(tt, GB)
oplot(XB, "-")

VG =  VarianceGammaProcess(0., 1., 1.)
X = sample(tt, VG)
plot(X, "-")

#n = 1000
#simulate gamma process:
#tt = cumsum(rand(Gamma(0.01, 1/(0.01n)), n))
#plot(tt)

X = sample(range(0, stop=1, length=500),Bridge.GammaBridge(1,1, GammaProcess(10,10)))
X = sample(range(0, stop=1, length=500), GammaProcess(10,10))


text:
@enum IndexType::UInt8 NotAnIndex=0 LoopIndex=1 ComputedIndex=2 SymbolicIndex=3

Base.:|(u::Unsigned, it::IndexType) = u | UInt8(it)
Base.:(==)(u::Unsigned, it::IndexType) = (u % UInt8) == UInt8(it)

"""
    ArrayRefStruct

A condensed representation of an [`ArrayReference`](@ref).
It supports array-references with up to 8 indexes, where the data for each consecutive index is packed into corresponding 8-bit fields
of `index_types` (storing the enum `IndexType`), `indices` (the `id` for each index symbol), and `offsets` (currently unused).
"""
struct ArrayRefStruct{array,ptr}
    index_types::UInt64
    indices::UInt64
    offsets::UInt64
end
array(ar::ArrayRefStruct{a,p}) where {a,p} = a
ptr(ar::ArrayRefStruct{a,p}) where {a,p}   = p

function findindoradd!(v::Vector{T}, s::T) where {T}
    ind = findfirst(sᵢ -> sᵢ == s, v)
    ind === nothing || return ind
    push!(v, s)
    length(v)
end
function ArrayRefStruct(ls::LoopSet, mref::ArrayReferenceMeta, arraysymbolinds::Vector{Symbol}, ids::Vector{Int})
    index_types = zero(UInt64)
    indices = zero(UInt64)
    offsets = zero(UInt64)
    indv = mref.ref.indices
    offv = mref.ref.offsets
    # we can discard that the array was considered discontiguous, as it should be recovered from type information
    start = 1 + (first(indv) === Symbol("##DISCONTIGUOUSSUBARRAY##"))
    for (n,ind) ∈ enumerate(@view(indv[start:end]))
        index_types <<= 8
        indices <<= 8
        offsets <<= 8
        offsets |= (offv[n] % UInt8)
        if mref.loopedindex[n]
            index_types |= LoopIndex
            indices |= getloopid(ls, ind)
        else
            parent = get(ls.opdict, ind, nothing)
            @assert !isnothing(parent) "Index $ind not found in array."
            # if parent === nothing
            #     index_types |= SymbolicIndex
            #     indices |= findindoradd!(arraysymbolinds, ind)
            # else
            index_types |= ComputedIndex
            indices |= ids[identifier(parent)]
            # end
        end
    end
    ArrayRefStruct{mref.ref.array,mref.ptr}( index_types, indices, offsets )
end

"""
    OperationStruct

A condensed representation of an [`Operation`](@ref).
"""
struct OperationStruct <: AbstractLoopOperation
    # instruction::Instruction
    loopdeps::UInt64
    reduceddeps::UInt64
    childdeps::UInt64
    parents::UInt64
    node_type::OperationType
    array::UInt8
    symid::UInt8
end
optype(os) = os.node_type

function findmatchingarray(ls::LoopSet, mref::ArrayReferenceMeta)
    id = 0x01
    for r ∈ ls.refs_aliasing_syms
        r == mref && return id
        id += 0x01
    end
    0x00
end
# filled_4byte_chunks(u::UInt64) = 16 - (leading_zeros(u) >>> 2)
filled_8byte_chunks(u::UInt64) = 8 - (leading_zeros(u) >>> 3)

# num_loop_deps(os::OperationStruct) = filled_4byte_chunks(os.loopdeps)
# num_reduced_deps(os::OperationStruct) = filled_4byte_chunks(os.reduceddeps)
# num_child_deps(os::OperationStruct) = filled_4byte_chunks(os.childdeps)
# num_parents(os::OperationStruct) = filled_4byte_chunks(os.parents)

function shifted_loopset(ls::LoopSet, loopsyms::Vector{Symbol})
    ld = zero(UInt64) # leading_zeros(ld) >> 2 yields the number of loopdeps
    for d ∈ loopsyms
        ld <<= 4
        ld |= getloopid(ls, d)::Int
    end
    ld
end
loopdeps_uint(ls::LoopSet, op::Operation) = shifted_loopset(ls, loopdependencies(op))
reduceddeps_uint(ls::LoopSet, op::Operation) = shifted_loopset(ls, reduceddependencies(op))
childdeps_uint(ls::LoopSet, op::Operation) = shifted_loopset(ls, reducedchildren(op))
function parents_uint(ls::LoopSet, op::Operation)
    p = zero(UInt64)
    for parent ∈ parents(op)
        p <<= 8
        p |= identifier(parent)
    end
    p
end
function OperationStruct!(varnames::Vector{Symbol}, ids::Vector{Int}, ls::LoopSet, op::Operation)
    instr = instruction(op)
    ld = loopdeps_uint(ls, op)
    rd = reduceddeps_uint(ls, op)
    cd = childdeps_uint(ls, op)
    p = parents_uint(ls, op)
    array = accesses_memory(op) ? findmatchingarray(ls, op.ref) : 0x00
    ids[identifier(op)] = id = findindoradd!(varnames, name(op))
    OperationStruct(
        ld, rd, cd, p, op.node_type, array, id
    )
end
## turn a LoopSet into a type object which can be used to reconstruct the LoopSet.

function loop_boundary(loop::Loop)
    startexact = loop.startexact
    stopexact = loop.stopexact
    if startexact & stopexact
        Expr(:call, Expr(:curly, lv(:StaticUnitRange), loop.starthint, loop.stophint))
    elseif startexact
        Expr(:call, Expr(:curly, lv(:StaticLowerUnitRange), loop.starthint), loop.stopsym)
    elseif stopexact
        Expr(:call, Expr(:curly, lv(:StaticUpperUnitRange), loop.stophint), loop.startsym)
    else
        Expr(:call, :(:), loop.startsym, loop.stopsym)
    end
end

function loop_boundaries(ls::LoopSet)
    lbd = Expr(:tuple)
    foreach(loop -> push!(lbd.args, loop_boundary(loop)), ls.loops)
    lbd
end

function argmeta_and_consts_description(ls::LoopSet, arraysymbolinds)
    Expr(
        :curly, :Tuple,
        length(arraysymbolinds),
        Expr(:curly, :Tuple, ls.outer_reductions...),
        Expr(:curly, :Tuple, first.(ls.preamble_symsym)...),
        Expr(:curly, :Tuple, ls.preamble_symint...),
        Expr(:curly, :Tuple, ls.preamble_symfloat...),
        Expr(:curly, :Tuple, ls.preamble_zeros...),
        Expr(:curly, :Tuple, ls.preamble_funcofeltypes...)
    )
end

function loopset_return_value(ls::LoopSet, ::Val{extract}) where {extract}
    @assert !iszero(length(ls.outer_reductions))
    if isone(length(ls.outer_reductions))
        op = getop(ls, ls.outer_reductions[1])
        if extract
            if (isu₁unrolled(op) | isu₂unrolled(op))
                Expr(:call, :extract_data, Symbol(mangledvar(op), 0))
            else
                Expr(:call, :extract_data, mangledvar(op))
            end
        else
            Symbol(mangledvar(op), 0)
        end
    else#if length(ls.outer_reductions) > 1
        ret = Expr(:tuple)
        ops = operations(ls)
        for or ∈ ls.outer_reductions
            op = ops[or]
            if extract
                push!(ret.args, Expr(:call, :extract_data, Symbol(mangledvar(op), 0)))
            else
                push!(ret.args, Symbol(mangledvar(ops[or]), 0))
            end
        end
        ret
    end
end

function add_reassigned_syms!(q::Expr, ls::LoopSet)
    for op ∈ operations(ls)
        if isconstant(op)
            instr = instruction(op)
            (instr == LOOPCONSTANT || instr.mod === :numericconstant) || push!(q.args, instr.instr)
        end
    end
end
function add_external_functions!(q::Expr, ls::LoopSet)
    for op ∈ operations(ls)
        if iscompute(op)
            instr = instruction(op)
            if instr.mod !== :LoopVectorization
                push!(q.args, instr.instr)
            end
        end
    end
end

function check_if_empty(ls::LoopSet, q::Expr)
    lb = loop_boundaries(ls)
    Expr(:if, Expr(:call, :!, Expr(:call, :any, :isempty, lb)), q)
end

# Try to condense in type stable manner
function generate_call(ls::LoopSet, inline_unroll::NTuple{3,Int8}, debug::Bool = false)
    operation_descriptions = Expr(:curly, :Tuple)
    varnames = Symbol[]; ids = Vector{Int}(undef, length(operations(ls)))
    for op ∈ operations(ls)
        instr = instruction(op)
        push!(operation_descriptions.args, QuoteNode(instr.mod))
        push!(operation_descriptions.args, QuoteNode(instr.instr))
        push!(operation_descriptions.args, OperationStruct!(varnames, ids, ls, op))
    end
    arraysymbolinds = Symbol[]
    arrayref_descriptions = Expr(:curly, :Tuple)
    foreach(ref -> push!(arrayref_descriptions.args, ArrayRefStruct(ls, ref, arraysymbolinds, ids)), ls.refs_aliasing_syms)
    argmeta = argmeta_and_consts_description(ls, arraysymbolinds)
    loop_bounds = loop_boundaries(ls)
    loop_syms = Expr(:curly, :Tuple, map(QuoteNode, ls.loopsymbols)...)
    inline, u₁, u₂ = inline_unroll

    func = debug ? lv(:_avx_loopset_debug) : lv(:_avx_!)
    lbarg = debug ? Expr(:call, :typeof, loop_bounds) : loop_bounds
    q = Expr(
        :call, func, Expr(:call, Expr(:curly, :Val, Expr(:tuple, inline, u₁, u₂, Expr(:call, lv(:unwrap), VECTORWIDTHSYMBOL)))),
        operation_descriptions, arrayref_descriptions, argmeta, loop_syms, lbarg
    )
    debug && deleteat!(q.args, 2)
    foreach(ref -> push!(q.args, vptr(ref)), ls.refs_aliasing_syms)

    foreach(is -> push!(q.args, last(is)), ls.preamble_symsym)
    append!(q.args, arraysymbolinds)
    add_reassigned_syms!(q, ls)
    add_external_functions!(q, ls)
    debug && return q
    vecwidthdefq = Expr(:block)
    define_eltype_vec_width!(vecwidthdefq, ls, nothing)
    Expr(:block, vecwidthdefq, q)
end

"""
    check_args(::Vararg{AbstractArray})

LoopVectorization will optimize an `@avx` loop if `check_args` on each on the indexed abstract arrays returns true.
It returns true for `AbstractArray{T}`s when `check_type(T) == true` and the array or its parent is a `StridedArray` or `AbstractRange`.

To provide support for a custom array type, ensure that `check_args` returns true, either through overloading it or subtyping `DenseArray`.
Additionally, define `pointer` and `stride` methods.
"""
@inline check_args(A::SubArray{T,N,P,I}) where {T,N,P,I<:Tuple{Vararg{Union{Int,Colon,AbstractRange}}}} = check_args(parent(A))
@inline check_args(A::OffsetArray) = check_args(parent(A))
@inline check_args(A::Adjoint) = check_args(parent(A))
@inline check_args(A::Transpose) = check_args(parent(A))
@inline check_args(A::PermutedDimsArray) = check_args(parent(A))
@inline check_args(A::StridedArray) = check_type(eltype(A))
@inline check_args(A::AbstractRange) = check_type(eltype(A))
@inline check_args(A::BitVector) = true
@inline check_args(A::BitMatrix) = true
@inline function check_args(A::AbstractArray)
    M = parentmodule(typeof(A))
    if parent(A) === A # SparseMatrix, StaticArray, etc
        false
    elseif M === Base || M === Core || M ===LinearAlgebra
        # reshapes which aren't StridedArrays, plus UpperTriangular, etc.
        false
    else
        check_args(parent(A)) # PermutedDimsArray, NamedDimsArray
    end
end
@inline check_args(A::VectorizationBase.AbstractStridedPointer{T}) where {T} = check_type(T)
@inline check_args(A, Bs...) = check_args(A) && check_args(Bs...)
"""
    check_type(::Type{T}) where {T}

Returns true if the element type is supported.
"""
check_type(::Type{T}) where {T <: NativeTypes} = true
check_type(::Type{T}) where {T} = false

function check_args_call(ls::LoopSet)
    q = Expr(:call, lv(:check_args))
    append!(q.args, ls.includedactualarrays)
    q
end

make_fast(q) = Expr(:macrocall, Symbol("@fastmath"), LineNumberNode(@__LINE__,Symbol(@__FILE__)), q)
make_crashy(q) = Expr(:macrocall, Symbol("@inbounds"), LineNumberNode(@__LINE__,Symbol(@__FILE__)), q)

function setup_call_inline(ls::LoopSet, inline::Int8 = zero(Int8), U::Int8 = zero(Int8), T::Int8 = zero(Int8))
    call = generate_call(ls, (inline,U,T))
    noouterreductions = iszero(length(ls.outer_reductions))
    if noouterreductions
        q = Expr(:block,gc_preserve(ls, call))
        append!(ls.preamble.args, q.args)
        return ls.preamble
    end
    retv = loopset_return_value(ls, Val(false))
    outer_reducts = Expr(:local)
    q = Expr(:block,gc_preserve(ls, Expr(:(=), retv, call)))
    for or ∈ ls.outer_reductions
        op = ls.operations[or]
        var = name(op)
        # push!(call.args, Symbol("##TYPEOF##", var))
        mvar = mangledvar(op)
        instr = instruction(op)
        out = Symbol(mvar, 0)
        push!(outer_reducts.args, out)
        push!(q.args, Expr(:(=), var, Expr(:call, lv(reduction_scalar_combine(instr)), out, var)))
    end
    pushpreamble!(ls, outer_reducts)
    append!(ls.preamble.args, q.args)
    ls.preamble
end
function setup_call_debug(ls::LoopSet)
    # avx_loopset(instr, ops, arf, AM, LB, vargs)

    pushpreamble!(ls, generate_call(ls, (zero(Int8),zero(Int8),zero(Int8)), true))
    Expr(:block, ls.prepreamble, ls.preamble)
end
function setup_call(ls::LoopSet, q = nothing, inline::Int8 = zero(Int8), check_empty::Bool = false, u₁::Int8 = zero(Int8), u₂::Int8 = zero(Int8))
    # We outline/inline at the macro level by creating/not creating an anonymous function.
    # The old API instead was based on inlining or not inline the generated function, but
    # the generated function must be inlined into the initial loop preamble for performance reasons.
    # Creating an anonymous function and calling it also achieves the outlining, while still
    # inlining the generated function into the loop preamble.
    call = setup_call_inline(ls, inline, u₁, u₂)
    call = check_empty ? check_if_empty(ls, call) : call
    isnothing(q) && return Expr(:block, ls.prepreamble, call)
    Expr(:block, ls.prepreamble, Expr(:if, check_args_call(ls), call, make_crashy(make_fast(q))))
end


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

@test integrate(sinh(c+d*x)^4*(a+b*tanh(c+d*x)^2), x) == :(x*(3//8*a+15//8*b)+-1*b*d^-1*tanh(c+d*x)+-1//8*d^-1*(5a+9b)*cosh(c+d*x)*sinh(c+d*x)+1//4*d^-1*cosh(c+d*x)^3*(a+b)*sinh(c+d*x))
@test integrate(sinh(c+d*x)^3*(a+b*tanh(c+d*x)^2), x) == :(-1*b*d^-1*sech(c+d*x)+-1*d^-1*(a+2b)*cosh(c+d*x)+1//3*d^-1*cosh(c+d*x)^3*(a+b))
@test integrate(sinh(c+d*x)^2*(a+b*tanh(c+d*x)^2), x) == :(x*(-3//2*b+-1//2*a)+b*d^-1*tanh(c+d*x)+(1/2)*d^-1*(a+b)*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)*sinh(c+d*x), x) == :(b*d^-1*sech(c+d*x)+d^-1*(a+b)*cosh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)*csch(c+d*x), x) == :(-1*a*d^-1*arctanh(cosh(c+d*x))+-1*b*d^-1*sech(c+d*x))
@test integrate(csch(c+d*x)^2*(a+b*tanh(c+d*x)^2), x) == :(b*d^-1*tanh(c+d*x)+-1*a*d^-1*coth(c+d*x))
@test integrate(csch(c+d*x)^3*(a+b*tanh(c+d*x)^2), x) == :(b*d^-1*sech(c+d*x)+(1/2)*d^-1*(a+-2b)*arctanh(cosh(c+d*x))+-1//2*a*d^-1*coth(c+d*x)*csch(c+d*x))
@test integrate(csch(c+d*x)^4*(a+b*tanh(c+d*x)^2), x) == :(d^-1*(a+-1b)*coth(c+d*x)+-1*b*d^-1*tanh(c+d*x)+-1//3*a*d^-1*coth(c+d*x)^3)
@test integrate((a+b*tanh(c+d*x)^2)^2*sinh(c+d*x)^4, x) == :(x*(3//8*a^2+35//8*b^2+15//4*a*b)+-1//3*b^2*d^-1*tanh(c+d*x)^3+-1//4*d^-1*(a^2+13*b^2+10*a*b)*tanh(c+d*x)+1//4*d^-1*(a+b)^2*sinh(c+d*x)^4*tanh(c+d*x)+-1//8*d^-1*(a+b)*(a+9b)*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*sinh(c+d*x)^3, x) == :(1//3*b^2*d^-1*sech(c+d*x)^3+1//3*d^-1*(a+b)^2*cosh(c+d*x)^3+-1*b*d^-1*(2a+3b)*sech(c+d*x)+-1*d^-1*(a+b)*(a+3b)*cosh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*sinh(c+d*x)^2, x) == :(x*(a+5b)*(-1//2*a+-1//2*b)+1//3*b^2*d^-1*tanh(c+d*x)^3+(1/2)*d^-1*(a+b)^2*sinh(c+d*x)^2*tanh(c+d*x)+(1/2)*d^-1*(a+b)*(a+5b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*sinh(c+d*x), x) == :(d^-1*(a+b)^2*cosh(c+d*x)+-1//3*b^2*d^-1*sech(c+d*x)^3+2*b*d^-1*(a+b)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*csch(c+d*x), x) == :(-1*a^2*d^-1*arctanh(cosh(c+d*x))+1//3*b^2*d^-1*sech(c+d*x)^3+-1*b*d^-1*(b+2a)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*csch(c+d*x)^2, x) == :(-1*a^2*d^-1*coth(c+d*x)+1//3*b^2*d^-1*tanh(c+d*x)^3+2*a*b*d^-1*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*csch(c+d*x)^3, x) == :(-1//3*b^2*d^-1*sech(c+d*x)^3+(1/2)*a*d^-1*(a+-4b)*arctanh(cosh(c+d*x))+-1//2*a*d^-1*(a+-4b)*sech(c+d*x)+-1//2*a^2*d^-1*csch(c+d*x)^2*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*csch(c+d*x)^4, x) == :(-1//3*a^2*d^-1*coth(c+d*x)^3+-1//3*b^2*d^-1*tanh(c+d*x)^3+a*d^-1*(a+-2b)*coth(c+d*x)+-1*b*d^-1*(-1b+2a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*sinh(c+d*x)^4, x) == :(x*(3//8*a+3//8*b)*(a^2+21*b^2+14*a*b)+-3//40*b^2*d^-1*tanh(c+d*x)^5*(5a+21b)+-1//8*b*d^-1*tanh(c+d*x)^3*(6*a^2+21*b^2+35*a*b)+-1//8*d^-1*(3a+3b)*(a^2+21*b^2+14*a*b)*tanh(c+d*x)+1//4*d^-1*(a+b*tanh(c+d*x)^2)^3*sinh(c+d*x)^3*cosh(c+d*x)+-1//8*d^-1*(a+b*tanh(c+d*x)^2)^2*sinh(c+d*x)^2*(3a+9b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*sinh(c+d*x)^3, x) == :(-1//5*b^3*d^-1*sech(c+d*x)^5+1//3*d^-1*(a+b)^3*cosh(c+d*x)^3+-1*d^-1*(a+b)^2*(a+4b)*cosh(c+d*x)+1//3*b^2*d^-1*sech(c+d*x)^3*(3a+4b)+-3*b*d^-1*(a+b)*(a+2b)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*sinh(c+d*x), x) == :(d^-1*(a+b)^3*cosh(c+d*x)+1//5*b^3*d^-1*sech(c+d*x)^5+-1*b^2*d^-1*sech(c+d*x)^3*(a+b)+3*b*d^-1*(a+b)^2*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*csch(c+d*x), x) == :(-1*a^3*d^-1*arctanh(cosh(c+d*x))+-1//5*b^3*d^-1*sech(c+d*x)^5+-1*b*d^-1*(b^2+3*a^2+3*a*b)*sech(c+d*x)+1//3*b^2*d^-1*sech(c+d*x)^3*(2b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^3*csch(c+d*x)^2, x) == :(-1*a^3*d^-1*coth(c+d*x)+1//5*b^3*d^-1*tanh(c+d*x)^5+a*b^2*d^-1*tanh(c+d*x)^3+3*b*a^2*d^-1*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*csch(c+d*x)^3, x) == :((1/2)*a^2*d^-1*(a+-6b)*arctanh(cosh(c+d*x))+-1//2*d^-1*(a+b+-1*b*sech(c+d*x)^2)^3*coth(c+d*x)*csch(c+d*x)+1//30*b*d^-1*(-4*b^2+81*a^2+-28*a*b)*sech(c+d*x)+7//10*b*d^-1*(a+b+-1*b*sech(c+d*x)^2)^2*sech(c+d*x)+1//30*b*d^-1*(-2b+33a)*(a+b+-1*b*sech(c+d*x)^2)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*csch(c+d*x)^4, x) == :(-1//3*a^3*d^-1*coth(c+d*x)^3+-1//5*b^3*d^-1*tanh(c+d*x)^5+a^2*d^-1*(a+-3b)*coth(c+d*x)+-1//3*b^2*d^-1*tanh(c+d*x)^3*(-1b+3a)+-3*a*b*d^-1*(a+-1b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sinh(c+d*x)^4, x) == :(1//8*x*(a+b)^-3*(-1*b^2+3*a^2+-6*a*b)+d^-1*(4a+4b)^-1*cosh(c+d*x)^3*sinh(c+d*x)+a^3//2*b^(1/2)*d^-1*(a+b)^-3*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+-1//8*d^-1*(a+b)^-2*(b+5a)*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sinh(c+d*x)^3, x) == :(d^-1*(3a+3b)^-1*cosh(c+d*x)^3+-1*a*d^-1*(a+b)^-2*cosh(c+d*x)+a*b^(1/2)*d^-1*(a+b)^-5//2*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sinh(c+d*x)^2, x) == :(-1//2*x*(a+b)^-2*(a+-1b)+d^-1*(2a+2b)^-1*cosh(c+d*x)*sinh(c+d*x)+-1*a^(1/2)*b^(1/2)*d^-1*(a+b)^-2*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sinh(c+d*x), x) == :(d^-1*(a+b)^-1*cosh(c+d*x)+-1*b^(1/2)*d^-1*(a+b)^-3//2*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*csch(c+d*x), x) == :(-1*a^-1*d^-1*arctanh(cosh(c+d*x))+a^-1*b^(1/2)*d^-1*(a+b)^-1//2*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*csch(c+d*x)^2, x) == :(-1*a^-1*d^-1*coth(c+d*x)+-1*a^-3//2*b^(1/2)*d^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*csch(c+d*x)^3, x) == :((1/2)*a^-2*d^-1*(a+2b)*arctanh(cosh(c+d*x))+-1//2*a^-1*d^-1*coth(c+d*x)*csch(c+d*x)+-1*a^-2*b^(1/2)*d^-1*(a+b)^(1/2)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*csch(c+d*x)^4, x) == :(-1//3*a^-1*d^-1*coth(c+d*x)^3+a^-2*d^-1*(a+b)*coth(c+d*x)+a^-5//2*b^(1/2)*d^-1*(a+b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sinh(c+d*x)^4, x) == :(1//8*x*(a+b)^-4*(3*a^2+3*b^2+-18*a*b)+d^-1*(a+b*tanh(c+d*x)^2)^-1*(4a+4b)^-1*cosh(c+d*x)^3*sinh(c+d*x)+-1//8*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(-1b+5a)*cosh(c+d*x)*sinh(c+d*x)+1//8*b*d^-1*(a+b)^-3*(a+b*tanh(c+d*x)^2)^-1*(-3b+9a)*tanh(c+d*x)+3//2*a^(1/2)*b^(1/2)*d^-1*(a+b)^-4*(a+-1b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sinh(c+d*x)^3, x) == :(1//3*d^-1*(a+b)^-2*cosh(c+d*x)^3+-1*d^-1*(a+b)^-3*(a+-1b)*cosh(c+d*x)+(1/2)*b^(1/2)*d^-1*(a+b)^-7//2*(-2b+3a)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x))+(1/2)*a*b*d^-1*(a+b)^-3*(a+b+-1*b*sech(c+d*x)^2)^-1*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sinh(c+d*x)^2, x) == :(-1//2*x*(a+b)^-3*(a+-3b)+d^-1*(a+b*tanh(c+d*x)^2)^-1*(2a+2b)^-1*cosh(c+d*x)*sinh(c+d*x)+-1*b*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)+-1//2*a^-1//2*b^(1/2)*d^-1*(a+b)^-3*(-1b+3a)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sinh(c+d*x), x) == :(3//2*d^-1*(a+b)^-2*cosh(c+d*x)+-1*d^-1*(2a+2b)^-1*(a+b+-1*b*sech(c+d*x)^2)^-1*cosh(c+d*x)+-3//2*b^(1/2)*d^-1*(a+b)^-5//2*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*csch(c+d*x), x) == :(-1*a^-2*d^-1*arctanh(cosh(c+d*x))+(1/2)*b*a^-1*d^-1*(a+b)^-1*(a+b+-1*b*sech(c+d*x)^2)^-1*sech(c+d*x)+(1/2)*a^-2*b^(1/2)*d^-1*(a+b)^-3//2*(2b+3a)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*csch(c+d*x)^2, x) == :(-3//2*a^-2*d^-1*coth(c+d*x)+(1/2)*a^-1*d^-1*(a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)+-3//2*a^-5//2*b^(1/2)*d^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*csch(c+d*x)^3, x) == :((1/2)*a^-3*d^-1*(a+4b)*arctanh(cosh(c+d*x))+-1*b*a^-2*d^-1*(a+b+-1*b*sech(c+d*x)^2)^-1*sech(c+d*x)+-1//2*a^-1*d^-1*(a+b+-1*b*sech(c+d*x)^2)^-1*coth(c+d*x)*csch(c+d*x)+-1//2*a^-3*b^(1/2)*d^-1*(a+b)^-1//2*(3a+4b)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*csch(c+d*x)^4, x) == :(-1//3*a^-2*d^-1*coth(c+d*x)^3+a^-3*d^-1*(a+2b)*coth(c+d*x)+(1/2)*a^-7//2*b^(1/2)*d^-1*(3a+5b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+(1/2)*b*a^-3*d^-1*(a+b*tanh(c+d*x)^2)^-1*(a+b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sinh(c+d*x)^4, x) == :(1//8*x*(a+b)^-5*(3*a^2+15*b^2+-30*a*b)+d^-1*(a+b*tanh(c+d*x)^2)^-2*(4a+4b)^-1*cosh(c+d*x)^3*sinh(c+d*x)+(1/2)*b*d^-1*(a+b)^-4*(a+b*tanh(c+d*x)^2)^-1*(-3b+3a)*tanh(c+d*x)+-1//8*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-2*(-3b+5a)*cosh(c+d*x)*sinh(c+d*x)+1//8*b*d^-1*(a+b)^-3*(a+b*tanh(c+d*x)^2)^-2*(-5b+7a)*tanh(c+d*x)+3//8*a^-1//2*b^(1/2)*d^-1*(a+b)^-5*(b^2+5*a^2+-10*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sinh(c+d*x)^3, x) == :(1//3*d^-1*(a+b)^-3*cosh(c+d*x)^3+-1*d^-1*(a+b)^-4*(a+-2b)*cosh(c+d*x)+1//8*b^(1/2)*d^-1*(a+b)^-9//2*(-20b+15a)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x))+1//4*a*b*d^-1*(a+b)^-3*(a+b+-1*b*sech(c+d*x)^2)^-2*sech(c+d*x)+1//8*b*d^-1*(a+b)^-4*(a+b+-1*b*sech(c+d*x)^2)^-1*(-4b+7a)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sinh(c+d*x)^2, x) == :(-1//2*x*(a+b)^-4*(a+-5b)+d^-1*(a+b*tanh(c+d*x)^2)^-2*(2a+2b)^-1*cosh(c+d*x)*sinh(c+d*x)+-3//4*b*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)+-1//8*a^-3//2*b^(1/2)*d^-1*(a+b)^-4*(-1*b^2+15*a^2+-10*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+-1//8*b*a^-1*d^-1*(a+b)^-3*(a+b*tanh(c+d*x)^2)^-1*(-1b+11a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sinh(c+d*x), x) == :(15//8*d^-1*(a+b)^-3*cosh(c+d*x)+-1*d^-1*(4a+4b)^-1*(a+b+-1*b*sech(c+d*x)^2)^-2*cosh(c+d*x)+-15//8*b^(1/2)*d^-1*(a+b)^-7//2*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x))+-5//8*d^-1*(a+b)^-2*(a+b+-1*b*sech(c+d*x)^2)^-1*cosh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*csch(c+d*x), x) == :(-1*a^-3*d^-1*arctanh(cosh(c+d*x))+1//4*b*a^-1*d^-1*(a+b)^-1*(a+b+-1*b*sech(c+d*x)^2)^-2*sech(c+d*x)+1//8*a^-3*b^(1/2)*d^-1*(a+b)^-5//2*(8*b^2+15*a^2+20*a*b)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x))+1//8*b*a^-2*d^-1*(a+b)^-2*(a+b+-1*b*sech(c+d*x)^2)^-1*(4b+7a)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*csch(c+d*x)^2, x) == :(-15//8*a^-3*d^-1*coth(c+d*x)+-15//8*a^-7//2*b^(1/2)*d^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//4*a^-1*d^-1*(a+b*tanh(c+d*x)^2)^-2*coth(c+d*x)+5//8*a^-2*d^-1*(a+b*tanh(c+d*x)^2)^-1*coth(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*csch(c+d*x)^3, x) == :((1/2)*a^-4*d^-1*(a+6b)*arctanh(cosh(c+d*x))+-3//4*b*a^-2*d^-1*(a+b+-1*b*sech(c+d*x)^2)^-2*sech(c+d*x)+-1//2*a^-1*d^-1*(a+b+-1*b*sech(c+d*x)^2)^-2*coth(c+d*x)*csch(c+d*x)+-1//8*a^-4*b^(1/2)*d^-1*(a+b)^-3//2*(15*a^2+24*b^2+40*a*b)*arctanh(b^(1/2)*(a+b)^-1//2*sech(c+d*x))+-1//8*b*a^-3*d^-1*(a+b)^-1*(a+b+-1*b*sech(c+d*x)^2)^-1*(11a+12b)*sech(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*csch(c+d*x)^4, x) == :(-1//3*a^-3*d^-1*coth(c+d*x)^3+a^-4*d^-1*(a+3b)*coth(c+d*x)+5//8*a^-9//2*b^(1/2)*d^-1*(3a+7b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//4*b*a^-3*d^-1*(a+b*tanh(c+d*x)^2)^-2*(a+b)*tanh(c+d*x)+1//8*b*a^-4*d^-1*(a+b*tanh(c+d*x)^2)^-1*(7a+11b)*tanh(c+d*x))
@test integrate(sinh(c+d*x)^4*(a+b*tanh(c+d*x)^3), x) == :(-3//2*b*d^-1*tanh(c+d*x)^2+-3//8*a*d^-1*tanh(c+d*x)+-1//16*d^-1*(3a+24b)*log(1+-1*tanh(c+d*x))+1//4*d^-1*sinh(c+d*x)^4*(b+a*tanh(c+d*x))+1//16*d^-1*(-24b+3a)*log(1+tanh(c+d*x))+-1//8*d^-1*sinh(c+d*x)^2*(a+8*b*tanh(c+d*x))*tanh(c+d*x))
@test integrate(sinh(c+d*x)^3*(a+b*tanh(c+d*x)^3), x) == :(-1*a*d^-1*cosh(c+d*x)+-5//2*b*d^-1*sinh(c+d*x)+1//3*a*d^-1*cosh(c+d*x)^3+5//2*b*d^-1*arctan(sinh(c+d*x))+5//6*b*d^-1*sinh(c+d*x)^3+-1//2*b*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^2)
@test integrate(sinh(c+d*x)^2*(a+b*tanh(c+d*x)^3), x) == :((1/2)*a*d^-1*tanh(c+d*x)+(1/2)*b*d^-1*tanh(c+d*x)^2+(1/2)*d^-1*sinh(c+d*x)^2*(b+a*tanh(c+d*x))+-1//4*d^-1*(a+-4b)*log(1+tanh(c+d*x))+1//4*d^-1*(a+4b)*log(1+-1*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^3)*sinh(c+d*x), x) == :(a*d^-1*cosh(c+d*x)+-3//2*b*d^-1*arctan(sinh(c+d*x))+3//2*b*d^-1*sinh(c+d*x)+-1//2*b*d^-1*tanh(c+d*x)^2*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)*csch(c+d*x), x) == :((1/2)*b*d^-1*arctan(sinh(c+d*x))+-1*a*d^-1*arctanh(cosh(c+d*x))+-1//2*b*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate(csch(c+d*x)^2*(a+b*tanh(c+d*x)^3), x) == :((1/2)*b*d^-1*tanh(c+d*x)^2+-1*a*d^-1*coth(c+d*x))
@test integrate(csch(c+d*x)^3*(a+b*tanh(c+d*x)^3), x) == :((1/2)*a*d^-1*arctanh(cosh(c+d*x))+(1/2)*b*d^-1*arctan(sinh(c+d*x))+(1/2)*b*d^-1*sech(c+d*x)*tanh(c+d*x)+-1//2*a*d^-1*coth(c+d*x)*csch(c+d*x))
@test integrate(csch(c+d*x)^4*(a+b*tanh(c+d*x)^3), x) == :(a*d^-1*coth(c+d*x)+b*d^-1*log(tanh(c+d*x))+-1//2*b*d^-1*tanh(c+d*x)^2+-1//3*a*d^-1*coth(c+d*x)^3)
@test integrate((a+b*tanh(c+d*x)^3)^2*sinh(c+d*x)^3, x) == :(-1*a^2*d^-1*cosh(c+d*x)+-6*b^2*d^-1*sech(c+d*x)+-4*b^2*d^-1*cosh(c+d*x)+-1//5*b^2*d^-1*sech(c+d*x)^5+1//3*a^2*d^-1*cosh(c+d*x)^3+1//3*b^2*d^-1*cosh(c+d*x)^3+4//3*b^2*d^-1*sech(c+d*x)^3+-5*a*b*d^-1*sinh(c+d*x)+5*a*b*d^-1*arctan(sinh(c+d*x))+5//3*a*b*d^-1*sinh(c+d*x)^3+-1*a*b*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^2)
@test integrate((a+b*tanh(c+d*x)^3)^2*sinh(c+d*x), x) == :(a^2*d^-1*cosh(c+d*x)+b^2*d^-1*cosh(c+d*x)+-1*b^2*d^-1*sech(c+d*x)^3+3*b^2*d^-1*sech(c+d*x)+1//5*b^2*d^-1*sech(c+d*x)^5+-3*a*b*d^-1*arctan(sinh(c+d*x))+3*a*b*d^-1*sinh(c+d*x)+-1*a*b*d^-1*tanh(c+d*x)^2*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)^2*csch(c+d*x), x) == :(-1*a^2*d^-1*arctanh(cosh(c+d*x))+-1*b^2*d^-1*sech(c+d*x)+-1//5*b^2*d^-1*sech(c+d*x)^5+2//3*b^2*d^-1*sech(c+d*x)^3+a*b*d^-1*arctan(sinh(c+d*x))+-1*a*b*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)^2*csch(c+d*x)^2, x) == :(-1*a^2*d^-1*coth(c+d*x)+1//5*b^2*d^-1*tanh(c+d*x)^5+a*b*d^-1*tanh(c+d*x)^2)
@test integrate((a+b*tanh(c+d*x)^3)^2*csch(c+d*x)^3, x) == :((1/2)*a^2*d^-1*arctanh(cosh(c+d*x))+-1//3*b^2*d^-1*sech(c+d*x)^3+1//5*b^2*d^-1*sech(c+d*x)^5+a*b*d^-1*arctan(sinh(c+d*x))+-1//2*a^2*d^-1*coth(c+d*x)*csch(c+d*x)+a*b*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)^2*csch(c+d*x)^4, x) == :(a^2*d^-1*coth(c+d*x)+-1//3*a^2*d^-1*coth(c+d*x)^3+-1//5*b^2*d^-1*tanh(c+d*x)^5+1//3*b^2*d^-1*tanh(c+d*x)^3+-1*a*b*d^-1*tanh(c+d*x)^2+2*a*b*d^-1*log(tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^3)^3*sinh(c+d*x)^3, x) == :(-1*a^3*d^-1*cosh(c+d*x)+-1155//128*b^3*d^-1*sinh(c+d*x)+1//3*a^3*d^-1*cosh(c+d*x)^3+385//128*b^3*d^-1*sinh(c+d*x)^3+1155//128*b^3*d^-1*arctan(sinh(c+d*x))+a*b^2*d^-1*cosh(c+d*x)^3+-18*a*b^2*d^-1*sech(c+d*x)+-12*a*b^2*d^-1*cosh(c+d*x)+4*a*b^2*d^-1*sech(c+d*x)^3+-231//128*b^3*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^2+-33//64*b^3*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^4+-15//2*b*a^2*d^-1*sinh(c+d*x)+-11//48*b^3*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^6+-3//5*a*b^2*d^-1*sech(c+d*x)^5+-1//8*b^3*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^8+5//2*b*a^2*d^-1*sinh(c+d*x)^3+15//2*b*a^2*d^-1*arctan(sinh(c+d*x))+-3//2*b*a^2*d^-1*sinh(c+d*x)^3*tanh(c+d*x)^2)
@test integrate((a+b*tanh(c+d*x)^3)^3*sinh(c+d*x), x) == :(a^3*d^-1*cosh(c+d*x)+-315//128*b^3*d^-1*arctan(sinh(c+d*x))+315//128*b^3*d^-1*sinh(c+d*x)+-3*a*b^2*d^-1*sech(c+d*x)^3+3*a*b^2*d^-1*cosh(c+d*x)+9*a*b^2*d^-1*sech(c+d*x)+-105//128*b^3*d^-1*tanh(c+d*x)^2*sinh(c+d*x)+-21//64*b^3*d^-1*tanh(c+d*x)^4*sinh(c+d*x)+-9//2*b*a^2*d^-1*arctan(sinh(c+d*x))+-3//16*b^3*d^-1*tanh(c+d*x)^6*sinh(c+d*x)+-1//8*b^3*d^-1*tanh(c+d*x)^8*sinh(c+d*x)+3//5*a*b^2*d^-1*sech(c+d*x)^5+9//2*b*a^2*d^-1*sinh(c+d*x)+-3//2*b*a^2*d^-1*tanh(c+d*x)^2*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)^3*csch(c+d*x), x) == :(-1*a^3*d^-1*arctanh(cosh(c+d*x))+35//128*b^3*d^-1*arctan(sinh(c+d*x))+-3*a*b^2*d^-1*sech(c+d*x)+2*a*b^2*d^-1*sech(c+d*x)^3+-35//128*b^3*d^-1*sech(c+d*x)*tanh(c+d*x)+-35//192*b^3*d^-1*tanh(c+d*x)^3*sech(c+d*x)+-7//48*b^3*d^-1*tanh(c+d*x)^5*sech(c+d*x)+-3//5*a*b^2*d^-1*sech(c+d*x)^5+-1//8*b^3*d^-1*tanh(c+d*x)^7*sech(c+d*x)+3//2*b*a^2*d^-1*arctan(sinh(c+d*x))+-3//2*b*a^2*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)^3*csch(c+d*x)^2, x) == :(-1*a^3*d^-1*coth(c+d*x)+1//8*b^3*d^-1*tanh(c+d*x)^8+3//2*b*a^2*d^-1*tanh(c+d*x)^2+3//5*a*b^2*d^-1*tanh(c+d*x)^5)
@test integrate((a+b*tanh(c+d*x)^3)^3*csch(c+d*x)^3, x) == :((1/2)*a^3*d^-1*arctanh(cosh(c+d*x))+5//128*b^3*d^-1*arctan(sinh(c+d*x))+-1*a*b^2*d^-1*sech(c+d*x)^3+-5//48*b^3*d^-1*sech(c+d*x)^3*tanh(c+d*x)^3+-5//64*b^3*d^-1*sech(c+d*x)^3*tanh(c+d*x)+-1//2*a^3*d^-1*coth(c+d*x)*csch(c+d*x)+-1//8*b^3*d^-1*sech(c+d*x)^3*tanh(c+d*x)^5+3//2*b*a^2*d^-1*arctan(sinh(c+d*x))+3//5*a*b^2*d^-1*sech(c+d*x)^5+5//128*b^3*d^-1*sech(c+d*x)*tanh(c+d*x)+3//2*b*a^2*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^3)^3*csch(c+d*x)^4, x) == :(a^3*d^-1*coth(c+d*x)+-1//3*a^3*d^-1*coth(c+d*x)^3+-1//8*b^3*d^-1*tanh(c+d*x)^8+1//6*b^3*d^-1*tanh(c+d*x)^6+a*b^2*d^-1*tanh(c+d*x)^3+3*b*a^2*d^-1*log(tanh(c+d*x))+-3//2*b*a^2*d^-1*tanh(c+d*x)^2+-3//5*a*b^2*d^-1*tanh(c+d*x)^5)
@test integrate((a+b*tanh(c+d*x)^3)^-1*sinh(c+d*x)^4, x) == :(d^-1*(1+-1*tanh(c+d*x))^-2*(16a+16b)^-1+-1*d^-1*(1+tanh(c+d*x))^-2*(-16b+16a)^-1+-1//16*d^-1*(1+-1*tanh(c+d*x))^-1*(a+b)^-2*(-1b+5a)+1//16*d^-1*(1+tanh(c+d*x))^-1*(a+-1b)^-2*(b+5a)+-3//16*a*d^-1*(a+b)^-3*(a+-5b)*log(1+-1*tanh(c+d*x))+3//16*a*d^-1*(a+-1b)^-3*(a+5b)*log(1+tanh(c+d*x))+-1*b*a^2*d^-1*(a^2+-1*b^2)^-3*(a^2+2*b^2)*log(a+b*tanh(c+d*x)^3)+-1//3*a^2//3*b^1//3*d^-1*(a^2+-1*b^2)^-3*(a^4+b^4+7*a^2*b^2+3*a^2//3*b^4//3*(b^2+2*a^2))*log(a^1//3+b^1//3*tanh(c+d*x))+1//6*a^2//3*b^1//3*d^-1*(a^2+-1*b^2)^-3*(a^4+b^4+7*a^2*b^2+3*a^2//3*b^4//3*(b^2+2*a^2))*log(a^2//3+b^2//3*tanh(c+d*x)^2+-1*a^1//3*b^1//3*tanh(c+d*x))+-1//3*3^(1/2)*a^2//3*b^1//3*d^-1*(a^4//3+b^4//3+a^2//3*b^2//3)^-3*(a^2+-1*b^2+3*a^4//3*b^2//3)*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*tanh(c+d*x))))
@test integrate((a+b*tanh(c+d*x)^3)^-1*sinh(c+d*x)^2, x) == :(d^-1*(1+-1*tanh(c+d*x))^-1*(4a+4b)^-1+-1*d^-1*(1+tanh(c+d*x))^-1*(-4b+4a)^-1+-1//4*d^-1*(a+-1b)^-2*(a+2b)*log(1+tanh(c+d*x))+1//4*d^-1*(a+b)^-2*(a+-2b)*log(1+-1*tanh(c+d*x))+1//3*b*d^-1*(a^2+-1*b^2)^-2*(b^2+2*a^2)*log(a+b*tanh(c+d*x)^3)+-1//6*a^2//3*b^1//3*d^-1*(a^2+-1*b^2)^-2*(a^2+2*b^2+3*a^2//3*b^4//3)*log(a^2//3+b^2//3*tanh(c+d*x)^2+-1*a^1//3*b^1//3*tanh(c+d*x))+1//3*a^2//3*b^1//3*d^-1*(a^2+-1*b^2)^-2*(a^2+2*b^2+3*a^2//3*b^4//3)*log(a^1//3+b^1//3*tanh(c+d*x))+1//3*3^(1/2)*a^2//3*b^1//3*d^-1*(a^2+-1*b^2)^-2*(a^2+2*b^2+-3*a^2//3*b^4//3)*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*tanh(c+d*x))))
@test integrate((a+b*tanh(c+d*x)^3)^-1*csch(c+d*x)^2, x) == :(-1*a^-1*d^-1*coth(c+d*x)+-1//6*a^-4//3*b^1//3*d^-1*log(a^2//3+b^2//3*tanh(c+d*x)^2+-1*a^1//3*b^1//3*tanh(c+d*x))+1//3*a^-4//3*b^1//3*d^-1*log(a^1//3+b^1//3*tanh(c+d*x))+1//3*3^(1/2)*a^-4//3*b^1//3*d^-1*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*tanh(c+d*x))))
@test integrate((a+b*tanh(c+d*x)^3)^-1*csch(c+d*x)^4, x) == :(a^-1*d^-1*coth(c+d*x)+-1//3*a^-1*d^-1*coth(c+d*x)^3+-1*b*a^-2*d^-1*log(tanh(c+d*x))+-1//3*a^-4//3*b^1//3*d^-1*log(a^1//3+b^1//3*tanh(c+d*x))+1//3*b*a^-2*d^-1*log(a+b*tanh(c+d*x)^3)+1//6*a^-4//3*b^1//3*d^-1*log(a^2//3+b^2//3*tanh(c+d*x)^2+-1*a^1//3*b^1//3*tanh(c+d*x))+-1//3*3^(1/2)*a^-4//3*b^1//3*d^-1*arctan(1//3*3^(1/2)*a^-1//3*(a^1//3+-2*b^1//3*tanh(c+d*x))))
@test integrate(cosh(c+d*x)^4*(a+b*tanh(c+d*x)^2), x) == :(x*(-1//8*b+3//8*a)+1//4*d^-1*cosh(c+d*x)^3*(a+b)*sinh(c+d*x)+1//8*d^-1*(-1b+3a)*cosh(c+d*x)*sinh(c+d*x))
@test integrate(cosh(c+d*x)^3*(a+b*tanh(c+d*x)^2), x) == :(a*d^-1*sinh(c+d*x)+1//3*d^-1*sinh(c+d*x)^3*(a+b))
@test integrate(cosh(c+d*x)^2*(a+b*tanh(c+d*x)^2), x) == :(x*((1/2)*a+-1//2*b)+(1/2)*d^-1*(a+b)*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)*cosh(c+d*x), x) == :(d^-1*(a+b)*sinh(c+d*x)+-1*b*d^-1*arctan(sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)*sech(c+d*x), x) == :((1/2)*d^-1*(b+2a)*arctan(sinh(c+d*x))+-1//2*b*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate(sech(c+d*x)^2*(a+b*tanh(c+d*x)^2), x) == :(a*d^-1*tanh(c+d*x)+1//3*b*d^-1*tanh(c+d*x)^3)
@test integrate(sech(c+d*x)^3*(a+b*tanh(c+d*x)^2), x) == :(1//8*d^-1*(b+4a)*arctan(sinh(c+d*x))+-1//4*b*d^-1*sech(c+d*x)^3*tanh(c+d*x)+1//8*d^-1*(b+4a)*sech(c+d*x)*tanh(c+d*x))
@test integrate(sech(c+d*x)^4*(a+b*tanh(c+d*x)^2), x) == :(a*d^-1*tanh(c+d*x)+-1//3*d^-1*tanh(c+d*x)^3*(a+-1b)+-1//5*b*d^-1*tanh(c+d*x)^5)
@test integrate((a+b*tanh(c+d*x)^2)^2*cosh(c+d*x)^4, x) == :(x*(3//8*a^2+3//8*b^2+-1//4*a*b)+1//8*d^-1*(-3*b^2+3*a^2)*cosh(c+d*x)*sinh(c+d*x)+1//4*d^-1*cosh(c+d*x)^3*(a+b)*(a+b*tanh(c+d*x)^2)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*cosh(c+d*x)^3, x) == :(b^2*d^-1*arctan(sinh(c+d*x))+d^-1*(a^2+-1*b^2)*sinh(c+d*x)+1//3*d^-1*(a+b)^2*sinh(c+d*x)^3)
@test integrate((a+b*tanh(c+d*x)^2)^2*cosh(c+d*x)^2, x) == :(x*(a+b)*((1/2)*a+-3//2*b)+b^2*d^-1*tanh(c+d*x)+(1/2)*d^-1*(a+b)^2*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*cosh(c+d*x), x) == :(d^-1*(a+b)^2*sinh(c+d*x)+(1/2)*b^2*d^-1*sech(c+d*x)*tanh(c+d*x)+-1//2*b*d^-1*(3b+4a)*arctan(sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^2*sech(c+d*x), x) == :(1//8*d^-1*(3*b^2+8*a^2+8*a*b)*arctan(sinh(c+d*x))+-3//8*b*d^-1*(b+2a)*sech(c+d*x)*tanh(c+d*x)+-1//4*b*d^-1*sech(c+d*x)^3*(a+sinh(c+d*x)^2*(a+b))*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*sech(c+d*x)^2, x) == :(a^2*d^-1*tanh(c+d*x)+1//5*b^2*d^-1*tanh(c+d*x)^5+2//3*a*b*d^-1*tanh(c+d*x)^3)
@test integrate((a+b*tanh(c+d*x)^2)^2*sech(c+d*x)^3, x) == :(1//16*d^-1*(b^2+8*a^2+4*a*b)*arctan(sinh(c+d*x))+1//16*d^-1*(b^2+8*a^2+4*a*b)*sech(c+d*x)*tanh(c+d*x)+-1//6*b*d^-1*sech(c+d*x)^5*(a+sinh(c+d*x)^2*(a+b))*tanh(c+d*x)+-1//24*b*d^-1*sech(c+d*x)^3*(3b+8a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*sech(c+d*x)^4, x) == :(a^2*d^-1*tanh(c+d*x)+-1//7*b^2*d^-1*tanh(c+d*x)^7+-1//3*a*d^-1*tanh(c+d*x)^3*(a+-2b)+-1//5*b*d^-1*tanh(c+d*x)^5*(-1b+2a))
@test integrate((a+b*tanh(c+d*x)^2)^3*cosh(c+d*x)^4, x) == :(x*(3//8*a+3//8*b)*(a^2+5*b^2+-2*a*b)+-1*b^3*d^-1*tanh(c+d*x)+1//4*d^-1*(a+b)^3*cosh(c+d*x)^3*sinh(c+d*x)+1//8*d^-1*(a+b)^2*(-9b+3a)*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*cosh(c+d*x)^3, x) == :(1//3*d^-1*(a+b)^3*sinh(c+d*x)^3+d^-1*(a+b)^2*(a+-2b)*sinh(c+d*x)+(1/2)*b^2*d^-1*(5b+6a)*arctan(sinh(c+d*x))+-1//2*b^3*d^-1*sech(c+d*x)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*cosh(c+d*x)^2, x) == :(x*(a+b)^2*((1/2)*a+-5//2*b)+1//3*b^3*d^-1*tanh(c+d*x)^3+b^2*d^-1*(2b+3a)*tanh(c+d*x)+(1/2)*d^-1*(a+b)^3*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*cosh(c+d*x), x) == :(d^-1*(a+b)^3*sinh(c+d*x)+-3//8*b*d^-1*((b+2a)^2+4*(a+b)^2)*arctan(sinh(c+d*x))+-1//4*b^3*d^-1*sech(c+d*x)^3*tanh(c+d*x)+3//8*b^2*d^-1*(3b+4a)*sech(c+d*x)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*sech(c+d*x), x) == :(1//16*d^-1*(b+2a)*(5*b^2+8*a^2+8*a*b)*arctan(sinh(c+d*x))+-1//6*b*d^-1*(a+sinh(c+d*x)^2*(a+b))^2*sech(c+d*x)^5*tanh(c+d*x)+-1//48*b*d^-1*(15*b^2+44*a^2+44*a*b)*sech(c+d*x)*tanh(c+d*x)+-5//24*b*d^-1*sech(c+d*x)^3*(a+sinh(c+d*x)^2*(a+b))*(b+2a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*sech(c+d*x)^2, x) == :(a^3*d^-1*tanh(c+d*x)+1//7*b^3*d^-1*tanh(c+d*x)^7+b*a^2*d^-1*tanh(c+d*x)^3+3//5*a*b^2*d^-1*tanh(c+d*x)^5)
@test integrate((a+b*tanh(c+d*x)^2)^3*sech(c+d*x)^3, x) == :(1//128*d^-1*(5*b^3+64*a^3+24*a*b^2+48*b*a^2)*arctan(sinh(c+d*x))+1//128*d^-1*(5*b^3+64*a^3+24*a*b^2+48*b*a^2)*sech(c+d*x)*tanh(c+d*x)+-1//8*b*d^-1*(a+sinh(c+d*x)^2*(a+b))^2*sech(c+d*x)^7*tanh(c+d*x)+-1//192*b*d^-1*sech(c+d*x)^3*(15*b^2+72*a^2+52*a*b)*tanh(c+d*x)+-1//48*b*d^-1*sech(c+d*x)^5*(a+sinh(c+d*x)^2*(a+b))*(5b+12a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*sech(c+d*x)^4, x) == :(a^3*d^-1*tanh(c+d*x)+-1//9*b^3*d^-1*tanh(c+d*x)^9+-1//3*a^2*d^-1*tanh(c+d*x)^3*(a+-3b)+-1//7*b^2*d^-1*tanh(c+d*x)^7*(-1b+3a)+-3//5*a*b*d^-1*tanh(c+d*x)^5*(a+-1b))
@test integrate((a+b*tanh(c+d*x)^2)^-1*cosh(c+d*x)^4, x) == :(1//8*x*(a+b)^-3*(3*a^2+15*b^2+10*a*b)+d^-1*(4a+4b)^-1*cosh(c+d*x)^3*sinh(c+d*x)+a^-1//2*b^5//2*d^-1*(a+b)^-3*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//8*d^-1*(a+b)^-2*(3a+7b)*cosh(c+d*x)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-1*cosh(c+d*x)^3, x) == :(d^-1*(3a+3b)^-1*sinh(c+d*x)^3+d^-1*(a+b)^-2*(a+2b)*sinh(c+d*x)+a^-1//2*b^2*d^-1*(a+b)^-5//2*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*cosh(c+d*x)^2, x) == :((1/2)*x*(a+b)^-2*(a+3b)+d^-1*(2a+2b)^-1*cosh(c+d*x)*sinh(c+d*x)+a^-1//2*b^3//2*d^-1*(a+b)^-2*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*cosh(c+d*x), x) == :(d^-1*(a+b)^-1*sinh(c+d*x)+b*a^-1//2*d^-1*(a+b)^-3//2*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sech(c+d*x), x) == :(a^-1//2*d^-1*(a+b)^-1//2*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sech(c+d*x)^2, x) == :(a^-1//2*b^-1//2*d^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sech(c+d*x)^3, x) == :(-1*b^-1*d^-1*arctan(sinh(c+d*x))+a^-1//2*b^-1*d^-1*(a+b)^(1/2)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sech(c+d*x)^4, x) == :(-1*b^-1*d^-1*tanh(c+d*x)+a^-1//2*b^-3//2*d^-1*(a+b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sech(c+d*x)^5, x) == :(-1//2*b^-1*d^-1*sech(c+d*x)*tanh(c+d*x)+-1//2*b^-2*d^-1*(2a+3b)*arctan(sinh(c+d*x))+a^-1//2*b^-2*d^-1*(a+b)^3//2*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*sech(c+d*x)^6, x) == :(1//3*b^-1*d^-1*tanh(c+d*x)^3+-1*b^-2*d^-1*(a+2b)*tanh(c+d*x)+a^-1//2*b^-5//2*d^-1*(a+b)^2*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*cosh(c+d*x)^3, x) == :(1//3*d^-1*(a+b)^-2*sinh(c+d*x)^3+d^-1*(a+b)^-3*(a+3b)*sinh(c+d*x)+(1/2)*a^-1*b^3*d^-1*(a+b)^-3*(a+sinh(c+d*x)^2*(a+b))^-1*sinh(c+d*x)+(1/2)*a^-3//2*b^2*d^-1*(a+b)^-7//2*(b+6a)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*cosh(c+d*x)^2, x) == :((1/2)*x*(a+b)^-3*(a+5b)+d^-1*(a+b*tanh(c+d*x)^2)^-1*(2a+2b)^-1*cosh(c+d*x)*sinh(c+d*x)+(1/2)*a^-3//2*b^3//2*d^-1*(a+b)^-3*(b+5a)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+-1//2*b*a^-1*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(a+-1b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-2*cosh(c+d*x), x) == :(d^-1*(a+b)^-2*sinh(c+d*x)+(1/2)*b*a^-3//2*d^-1*(a+b)^-5//2*(b+4a)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+(1/2)*a^-1*b^2*d^-1*(a+b)^-2*(a+sinh(c+d*x)^2*(a+b))^-1*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x), x) == :((1/2)*a^-3//2*d^-1*(a+b)^-3//2*(b+2a)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+(1/2)*b*a^-1*d^-1*(a+b)^-1*(a+sinh(c+d*x)^2*(a+b))^-1*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^2, x) == :((1/2)*a^-1*d^-1*(a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)+(1/2)*a^-3//2*b^-1//2*d^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^3, x) == :((1/2)*a^-1*d^-1*(a+sinh(c+d*x)^2*(a+b))^-1*sinh(c+d*x)+(1/2)*a^-3//2*d^-1*(a+b)^-1//2*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^4, x) == :(-1//2*a^-3//2*b^-3//2*d^-1*(a+-1b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+(1/2)*a^-1*b^-1*d^-1*(a+b*tanh(c+d*x)^2)^-1*(a+b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^5, x) == :(b^-2*d^-1*arctan(sinh(c+d*x))+(1/2)*a^-1*b^-1*d^-1*(a+sinh(c+d*x)^2*(a+b))^-1*(a+b)*sinh(c+d*x)+-1//2*a^-3//2*b^-2*d^-1*(a+b)^(1/2)*(-1b+2a)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^6, x) == :(b^-2*d^-1*tanh(c+d*x)+(1/2)*a^-1*b^-2*d^-1*(a+b)^2*(a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)+-1//2*a^-3//2*b^-5//2*d^-1*(a+b)*(-1b+3a)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^7, x) == :((1/2)*b^-3*d^-1*(4a+5b)*arctan(sinh(c+d*x))+-1//2*b^-1*d^-1*(a+sinh(c+d*x)^2*(a+b))^-1*sech(c+d*x)*tanh(c+d*x)+-1//2*a^-3//2*b^-3*d^-1*(a+b)^3//2*(-1b+4a)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+(1/2)*a^-1*b^-2*d^-1*(a+sinh(c+d*x)^2*(a+b))^-1*(a+b)*(b+2a)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*cosh(c+d*x)^2, x) == :((1/2)*x*(a+b)^-4*(a+7b)+d^-1*(a+b*tanh(c+d*x)^2)^-2*(2a+2b)^-1*cosh(c+d*x)*sinh(c+d*x)+1//8*a^-5//2*b^3//2*d^-1*(a+b)^-4*(3*b^2+35*a^2+14*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+-1//4*b*a^-1*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-2*(-1b+2a)*tanh(c+d*x)+-1//8*b*a^-2*d^-1*(a+b)^-3*(a+b*tanh(c+d*x)^2)^-1*(a+-3b)*(b+4a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*cosh(c+d*x), x) == :(d^-1*(a+b)^-3*sinh(c+d*x)+1//4*a^-1*b^3*d^-1*(a+b)^-3*(a+sinh(c+d*x)^2*(a+b))^-2*sinh(c+d*x)+3//8*b*a^-5//2*d^-1*(a+b)^-7//2*(b^2+8*a^2+4*a*b)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+3//8*a^-2*b^2*d^-1*(a+b)^-3*(a+sinh(c+d*x)^2*(a+b))^-1*(b+4a)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x), x) == :(1//8*a^-5//2*d^-1*(a+b)^-5//2*(3*b^2+8*a^2+8*a*b)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+1//4*b*a^-1*d^-1*(a+b)^-1*(a+sinh(c+d*x)^2*(a+b))^-2*cosh(c+d*x)^2*sinh(c+d*x)+3//8*b*a^-2*d^-1*(a+b)^-2*(a+sinh(c+d*x)^2*(a+b))^-1*(b+2a)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x)^2, x) == :(1//4*a^-1*d^-1*(a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)+3//8*a^-2*d^-1*(a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)+3//8*a^-5//2*b^-1//2*d^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x)^3, x) == :(1//8*a^-5//2*d^-1*(a+b)^-3//2*(3b+4a)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+1//4*b*a^-1*d^-1*(a+b)^-1*(a+sinh(c+d*x)^2*(a+b))^-2*sinh(c+d*x)+1//8*a^-2*d^-1*(a+b)^-1*(a+sinh(c+d*x)^2*(a+b))^-1*(3b+4a)*sinh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x)^4, x) == :(-1//8*a^-5//2*b^-3//2*d^-1*(a+-3b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+-1//8*a^-2*b^-1*d^-1*(a+b*tanh(c+d*x)^2)^-1*(a+-3b)*tanh(c+d*x)+1//4*a^-1*b^-1*d^-1*(a+b*tanh(c+d*x)^2)^-2*(a+b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x)^5, x) == :(1//4*a^-1*d^-1*(a+sinh(c+d*x)^2*(a+b))^-2*sinh(c+d*x)+3//8*a^-2*d^-1*(a+sinh(c+d*x)^2*(a+b))^-1*sinh(c+d*x)+3//8*a^-5//2*d^-1*(a+b)^-1//2*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x)^6, x) == :(1//8*d^-1*(a+b*tanh(c+d*x)^2)^-1*(-3*b^-2+3*a^-2)*tanh(c+d*x)+1//8*a^-5//2*b^-5//2*d^-1*(3*a^2+3*b^2+-2*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//4*a^-1*b^-1*d^-1*(a+b*tanh(c+d*x)^2)^-2*sech(c+d*x)^2*(a+b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*sech(c+d*x)^7, x) == :(-1*b^-3*d^-1*arctan(sinh(c+d*x))+1//4*a^-1*b^-1*d^-1*(a+sinh(c+d*x)^2*(a+b))^-2*(a+b)*sinh(c+d*x)+1//8*a^-5//2*b^-3*d^-1*(a+b)^(1/2)*(3*b^2+8*a^2+-4*a*b)*arctan(a^-1//2*(a+b)^(1/2)*sinh(c+d*x))+-1//8*a^-2*b^-2*d^-1*(a+sinh(c+d*x)^2*(a+b))^-1*(a+b)*(-3b+4a)*sinh(c+d*x))
@test integrate(tanh(c+d*x)^4*(a+b*tanh(c+d*x)^2), x) == :(x*(a+b)+-1*d^-1*(a+b)*tanh(c+d*x)+-1//3*d^-1*tanh(c+d*x)^3*(a+b)+-1//5*b*d^-1*tanh(c+d*x)^5)
@test integrate(tanh(c+d*x)^3*(a+b*tanh(c+d*x)^2), x) == :(d^-1*(a+b)*log(cosh(c+d*x))+-1//2*d^-1*tanh(c+d*x)^2*(a+b)+-1//4*b*d^-1*tanh(c+d*x)^4)
@test integrate(tanh(c+d*x)^2*(a+b*tanh(c+d*x)^2), x) == :(x*(a+b)+-1*d^-1*(a+b)*tanh(c+d*x)+-1//3*b*d^-1*tanh(c+d*x)^3)
@test integrate((a+b*tanh(c+d*x)^2)*tanh(c+d*x), x) == :(d^-1*(a+b)*log(cosh(c+d*x))+-1//2*b*d^-1*tanh(c+d*x)^2)
@test integrate(a+b*tanh(c+d*x)^2, x) == :(a*x+b*x+-1*b*d^-1*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)*coth(c+d*x), x) == :(a*d^-1*log(sinh(c+d*x))+b*d^-1*log(cosh(c+d*x)))
@test integrate(coth(c+d*x)^2*(a+b*tanh(c+d*x)^2), x) == :(x*(a+b)+-1*a*d^-1*coth(c+d*x))
@test integrate(coth(c+d*x)^3*(a+b*tanh(c+d*x)^2), x) == :(d^-1*(a+b)*log(sinh(c+d*x))+-1//2*a*d^-1*coth(c+d*x)^2)
@test integrate(coth(c+d*x)^4*(a+b*tanh(c+d*x)^2), x) == :(x*(a+b)+-1*d^-1*(a+b)*coth(c+d*x)+-1//3*a*d^-1*coth(c+d*x)^3)
@test integrate(coth(c+d*x)^5*(a+b*tanh(c+d*x)^2), x) == :(d^-1*(a+b)*log(sinh(c+d*x))+-1//2*d^-1*coth(c+d*x)^2*(a+b)+-1//4*a*d^-1*coth(c+d*x)^4)
@test integrate((a+b*tanh(c+d*x)^2)^2*tanh(c+d*x)^4, x) == :(x*(a+b)^2+-1*d^-1*(a+b)^2*tanh(c+d*x)+-1//3*d^-1*(a+b)^2*tanh(c+d*x)^3+-1//7*b^2*d^-1*tanh(c+d*x)^7+-1//5*b*d^-1*tanh(c+d*x)^5*(b+2a))
@test integrate((a+b*tanh(c+d*x)^2)^2*tanh(c+d*x)^3, x) == :(d^-1*(a+b)^2*log(cosh(c+d*x))+-1//2*d^-1*(a+b)^2*tanh(c+d*x)^2+-1//6*b^2*d^-1*tanh(c+d*x)^6+-1//4*b*d^-1*tanh(c+d*x)^4*(b+2a))
@test integrate((a+b*tanh(c+d*x)^2)^2*tanh(c+d*x)^2, x) == :(x*(a+b)^2+-1*d^-1*(a+b)^2*tanh(c+d*x)+-1//5*b^2*d^-1*tanh(c+d*x)^5+-1//3*b*d^-1*tanh(c+d*x)^3*(b+2a))
@test integrate((a+b*tanh(c+d*x)^2)^2*tanh(c+d*x), x) == :(-1//4*d^-1*(a+b*tanh(c+d*x)^2)^2+d^-1*(a+b)^2*log(cosh(c+d*x))+-1//2*b*d^-1*tanh(c+d*x)^2*(a+b))
@test integrate((a+b*tanh(c+d*x)^2)^2, x) == :(x*(a+b)^2+-1//3*b^2*d^-1*tanh(c+d*x)^3+-1*b*d^-1*(b+2a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x), x) == :(a^2*d^-1*log(tanh(c+d*x))+d^-1*(a+b)^2*log(cosh(c+d*x))+-1//2*b^2*d^-1*tanh(c+d*x)^2)
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x)^2, x) == :(x*(a+b)^2+-1*a^2*d^-1*coth(c+d*x)+-1*b^2*d^-1*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x)^3, x) == :(d^-1*(a+b)^2*log(cosh(c+d*x))+-1//2*a^2*d^-1*coth(c+d*x)^2+a*d^-1*(a+2b)*log(tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x)^4, x) == :(x*(a+b)^2+-1//3*a^2*d^-1*coth(c+d*x)^3+-1*a*d^-1*(a+2b)*coth(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x)^5, x) == :(d^-1*(a+b)^2*log(cosh(c+d*x))+d^-1*(a+b)^2*log(tanh(c+d*x))+-1//4*a^2*d^-1*coth(c+d*x)^4+-1//2*a*d^-1*coth(c+d*x)^2*(a+2b))
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x)^6, x) == :(x*(a+b)^2+-1*d^-1*(a+b)^2*coth(c+d*x)+-1//5*a^2*d^-1*coth(c+d*x)^5+-1//3*a*d^-1*coth(c+d*x)^3*(a+2b))
@test integrate((a+b*tanh(c+d*x)^2)^2*coth(c+d*x)^7, x) == :(d^-1*(a+b)^2*log(cosh(c+d*x))+d^-1*(a+b)^2*log(tanh(c+d*x))+-1//2*d^-1*(a+b)^2*coth(c+d*x)^2+-1//6*a^2*d^-1*coth(c+d*x)^6+-1//4*a*d^-1*coth(c+d*x)^4*(a+2b))
@test integrate((a+b*tanh(c+d*x)^2)^3*tanh(c+d*x)^4, x) == :(x*(a+b)^3+-1*d^-1*(a+b)^3*tanh(c+d*x)+-1//3*d^-1*(a+b)^3*tanh(c+d*x)^3+-1//9*b^3*d^-1*tanh(c+d*x)^9+-1//5*b*d^-1*tanh(c+d*x)^5*(b^2+3*a^2+3*a*b)+-1//7*b^2*d^-1*tanh(c+d*x)^7*(b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^3*tanh(c+d*x)^3, x) == :(d^-1*(a+b)^3*log(cosh(c+d*x))+-1//2*d^-1*(a+b)^3*tanh(c+d*x)^2+-1//8*b^3*d^-1*tanh(c+d*x)^8+-1//4*b*d^-1*tanh(c+d*x)^4*(b^2+3*a^2+3*a*b)+-1//6*b^2*d^-1*tanh(c+d*x)^6*(b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^3*tanh(c+d*x)^2, x) == :(x*(a+b)^3+-1*d^-1*(a+b)^3*tanh(c+d*x)+-1//7*b^3*d^-1*tanh(c+d*x)^7+-1//3*b*d^-1*tanh(c+d*x)^3*(b^2+3*a^2+3*a*b)+-1//5*b^2*d^-1*tanh(c+d*x)^5*(b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^3*tanh(c+d*x), x) == :(-1//6*d^-1*(a+b*tanh(c+d*x)^2)^3+d^-1*(a+b)^3*log(cosh(c+d*x))+-1//4*d^-1*(a+b*tanh(c+d*x)^2)^2*(a+b)+-1//2*b*d^-1*(a+b)^2*tanh(c+d*x)^2)
@test integrate((a+b*tanh(c+d*x)^2)^3, x) == :(x*(a+b)^3+-1//5*b^3*d^-1*tanh(c+d*x)^5+-1*b*d^-1*(b^2+3*a^2+3*a*b)*tanh(c+d*x)+-1//3*b^2*d^-1*tanh(c+d*x)^3*(b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x), x) == :(a^3*d^-1*log(tanh(c+d*x))+d^-1*(a+b)^3*log(cosh(c+d*x))+-1//4*b^3*d^-1*tanh(c+d*x)^4+-1//2*b^2*d^-1*tanh(c+d*x)^2*(b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x)^2, x) == :(x*(a+b)^3+-1*a^3*d^-1*coth(c+d*x)+-1//3*b^3*d^-1*tanh(c+d*x)^3+-1*b^2*d^-1*(b+3a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x)^3, x) == :(d^-1*(a+b)^3*log(cosh(c+d*x))+-1//2*a^3*d^-1*coth(c+d*x)^2+-1//2*b^3*d^-1*tanh(c+d*x)^2+a^2*d^-1*(a+3b)*log(tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x)^4, x) == :(x*(a+b)^3+-1*b^3*d^-1*tanh(c+d*x)+-1//3*a^3*d^-1*coth(c+d*x)^3+-1*a^2*d^-1*(a+3b)*coth(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x)^5, x) == :(d^-1*(a+b)^3*log(cosh(c+d*x))+-1//4*a^3*d^-1*coth(c+d*x)^4+a*d^-1*(a^2+3*b^2+3*a*b)*log(tanh(c+d*x))+-1//2*a^2*d^-1*coth(c+d*x)^2*(a+3b))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x)^6, x) == :(x*(a+b)^3+-1//5*a^3*d^-1*coth(c+d*x)^5+-1*a*d^-1*(a^2+3*b^2+3*a*b)*coth(c+d*x)+-1//3*a^2*d^-1*coth(c+d*x)^3*(a+3b))
@test integrate((a+b*tanh(c+d*x)^2)^3*coth(c+d*x)^7, x) == :(d^-1*(a+b)^3*log(cosh(c+d*x))+d^-1*(a+b)^3*log(tanh(c+d*x))+-1//6*a^3*d^-1*coth(c+d*x)^6+-1//2*a*d^-1*coth(c+d*x)^2*(a^2+3*b^2+3*a*b)+-1//4*a^2*d^-1*coth(c+d*x)^4*(a+3b))
@test integrate((a+b*tanh(c+d*x)^2)^4, x) == :(x*(a+b)^4+-1//7*b^4*d^-1*tanh(c+d*x)^7+-1//3*b^2*d^-1*tanh(c+d*x)^3*(b^2+6*a^2+4*a*b)+-1//5*b^3*d^-1*tanh(c+d*x)^5*(b+4a)+-1*b*d^-1*(b+2a)*(b^2+2*a^2+2*a*b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^5, x) == :(x*(a+b)^5+-1//9*b^5*d^-1*tanh(c+d*x)^9+-1*b*d^-1*(b^4+5*a^4+5*a*b^3+10*b*a^3+10*a^2*b^2)*tanh(c+d*x)+-1//3*b^2*d^-1*tanh(c+d*x)^3*(b^3+10*a^3+5*a*b^2+10*b*a^2)+-1//5*b^3*d^-1*tanh(c+d*x)^5*(b^2+10*a^2+5*a*b)+-1//7*b^4*d^-1*tanh(c+d*x)^7*(b+5a))
@test integrate((a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)^5, x) == :(d^-1*(a+b)^-1*log(cosh(c+d*x))+-1//2*b^-1*d^-1*tanh(c+d*x)^2+(1/2)*a^2*b^-2*d^-1*(a+b)^-1*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)^4, x) == :(x*(a+b)^-1+-1*b^-1*d^-1*tanh(c+d*x)+a^3//2*b^-3//2*d^-1*(a+b)^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)^3, x) == :(d^-1*(a+b)^-1*log(cosh(c+d*x))+-1//2*a*b^-1*d^-1*(a+b)^-1*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)^2, x) == :(x*(a+b)^-1+-1*a^(1/2)*b^-1//2*d^-1*(a+b)^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x), x) == :(d^-1*(a+b)^-1*log(cosh(c+d*x))+d^-1*(2a+2b)^-1*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-1, x) == :(x*(a+b)^-1+a^-1//2*b^(1/2)*d^-1*(a+b)^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*coth(c+d*x), x) == :(a^-1*d^-1*log(tanh(c+d*x))+d^-1*(a+b)^-1*log(cosh(c+d*x))+-1//2*b*a^-1*d^-1*(a+b)^-1*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)^2, x) == :(x*(a+b)^-1+-1*a^-1*d^-1*coth(c+d*x)+-1*a^-3//2*b^3//2*d^-1*(a+b)^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)^3, x) == :(d^-1*(a+b)^-1*log(cosh(c+d*x))+-1//2*a^-1*d^-1*coth(c+d*x)^2+a^-2*d^-1*(a+-1b)*log(tanh(c+d*x))+(1/2)*a^-2*b^2*d^-1*(a+b)^-1*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)^4, x) == :(x*(a+b)^-1+-1//3*a^-1*d^-1*coth(c+d*x)^3+-1*a^-2*d^-1*(a+-1b)*coth(c+d*x)+a^-5//2*b^5//2*d^-1*(a+b)^-1*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)^5, x) == :(d^-1*(a+b)^-2*log(cosh(c+d*x))+-1//2*a^2*b^-2*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1+-1//2*a*b^-2*d^-1*(a+b)^-2*(a+2b)*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)^4, x) == :(x*(a+b)^-2+(1/2)*a*b^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)+-1//2*a^(1/2)*b^-3//2*d^-1*(a+b)^-2*(a+3b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)^3, x) == :(d^-1*(a+b)^-2*log(cosh(c+d*x))+(1/2)*d^-1*(a+b)^-2*log(a+b*tanh(c+d*x)^2)+(1/2)*a*b^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1)
@test integrate((a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)^2, x) == :(x*(a+b)^-2+-1*d^-1*(a+b*tanh(c+d*x)^2)^-1*(2a+2b)^-1*tanh(c+d*x)+-1//2*a^-1//2*b^-1//2*d^-1*(a+b)^-2*(a+-1b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x), x) == :(d^-1*(a+b)^-2*log(cosh(c+d*x))+(1/2)*d^-1*(a+b)^-2*log(a+b*tanh(c+d*x)^2)+-1*d^-1*(a+b*tanh(c+d*x)^2)^-1*(2a+2b)^-1)
@test integrate((a+b*tanh(c+d*x)^2)^-2, x) == :(x*(a+b)^-2+(1/2)*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1*tanh(c+d*x)+(1/2)*a^-3//2*b^(1/2)*d^-1*(a+b)^-2*(b+3a)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*coth(c+d*x), x) == :(a^-2*d^-1*log(tanh(c+d*x))+d^-1*(a+b)^-2*log(cosh(c+d*x))+(1/2)*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1+-1//2*b*a^-2*d^-1*(a+b)^-2*(b+2a)*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-2*coth(c+d*x)^2, x) == :(x*(a+b)^-2+-1//2*a^-2*d^-1*(a+b)^-1*(2a+3b)*coth(c+d*x)+(1/2)*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)+-1//2*a^-5//2*b^3//2*d^-1*(a+b)^-2*(3b+5a)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-2*coth(c+d*x)^3, x) == :(d^-1*(a+b)^-2*log(cosh(c+d*x))+-1//2*a^-2*d^-1*coth(c+d*x)^2+a^-3*d^-1*(a+-2b)*log(tanh(c+d*x))+-1//2*a^-2*b^2*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1+(1/2)*a^-3*b^2*d^-1*(a+b)^-2*(2b+3a)*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-2*coth(c+d*x)^4, x) == :(x*(a+b)^-2+-1//2*a^-3*d^-1*(a+b)^-1*(-5*b^2+2*a^2+-2*a*b)*coth(c+d*x)+-1//6*a^-2*d^-1*(a+b)^-1*coth(c+d*x)^3*(2a+5b)+(1/2)*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)^3+(1/2)*a^-7//2*b^5//2*d^-1*(a+b)^-2*(5b+7a)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x)^6, x) == :(x*(a+b)^-3+-1//8*a^(1/2)*b^-5//2*d^-1*(a+b)^-3*(3*a^2+15*b^2+10*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//4*a*b^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)^3+1//8*a*b^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(3a+7b)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x)^5, x) == :(d^-1*(a+b)^-3*log(cosh(c+d*x))+(1/2)*d^-1*(a+b)^-3*log(a+b*tanh(c+d*x)^2)+-1//4*a^2*b^-2*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2+(1/2)*a*b^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(a+2b))
@test integrate((a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x)^4, x) == :(x*(a+b)^-3+-1//8*a^-1//2*b^-3//2*d^-1*(a+b)^-3*(a^2+-3*b^2+6*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+-1//8*b^-1*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(a+5b)*tanh(c+d*x)+1//4*a*b^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x)^3, x) == :(d^-1*(a+b)^-3*log(cosh(c+d*x))+(1/2)*d^-1*(a+b)^-3*log(a+b*tanh(c+d*x)^2)+-1//2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1+1//4*a*b^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2)
@test integrate((a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x)^2, x) == :(x*(a+b)^-3+-1*d^-1*(a+b*tanh(c+d*x)^2)^-2*(4a+4b)^-1*tanh(c+d*x)+-1//8*a^-1*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(-1b+3a)*tanh(c+d*x)+-1//8*a^-3//2*b^-1//2*d^-1*(a+b)^-3*(-1*b^2+3*a^2+-6*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x)))
@test integrate((a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x), x) == :(d^-1*(a+b)^-3*log(cosh(c+d*x))+(1/2)*d^-1*(a+b)^-3*log(a+b*tanh(c+d*x)^2)+-1*d^-1*(a+b*tanh(c+d*x)^2)^-2*(4a+4b)^-1+-1//2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1)
@test integrate((a+b*tanh(c+d*x)^2)^-3, x) == :(x*(a+b)^-3+1//4*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2*tanh(c+d*x)+1//8*a^-5//2*b^(1/2)*d^-1*(a+b)^-3*(3*b^2+15*a^2+10*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//8*b*a^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(3b+7a)*tanh(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*coth(c+d*x), x) == :(a^-3*d^-1*log(tanh(c+d*x))+d^-1*(a+b)^-3*log(cosh(c+d*x))+1//4*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2+(1/2)*b*a^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(b+2a)+-1//2*b*a^-3*d^-1*(a+b)^-3*(b^2+3*a^2+3*a*b)*log(a+b*tanh(c+d*x)^2))
@test integrate((a+b*tanh(c+d*x)^2)^-3*coth(c+d*x)^2, x) == :(x*(a+b)^-3+-1//8*a^-3*d^-1*(a+b)^-2*(8*a^2+15*b^2+27*a*b)*coth(c+d*x)+-1//8*a^-7//2*b^3//2*d^-1*(a+b)^-3*(15*b^2+35*a^2+42*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//4*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2*coth(c+d*x)+1//8*b*a^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(5b+9a)*coth(c+d*x))
@test integrate((a+b*tanh(c+d*x)^2)^-3*coth(c+d*x)^3, x) == :(d^-1*(a+b)^-3*log(cosh(c+d*x))+-1//2*a^-3*d^-1*coth(c+d*x)^2+a^-4*d^-1*(a+-3b)*log(tanh(c+d*x))+-1//4*a^-2*b^2*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2+(1/2)*a^-4*b^2*d^-1*(a+b)^-3*(3*b^2+6*a^2+8*a*b)*log(a+b*tanh(c+d*x)^2)+-1//2*a^-3*b^2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*(2b+3a))
@test integrate((a+b*tanh(c+d*x)^2)^-3*coth(c+d*x)^4, x) == :(x*(a+b)^-3+-1//8*a^-4*d^-1*(a+b)^-2*(-35*b^3+8*a^3+-55*a*b^2+-8*b*a^2)*coth(c+d*x)+-1//24*a^-3*d^-1*(a+b)^-2*coth(c+d*x)^3*(8*a^2+35*b^2+55*a*b)+1//4*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-2*coth(c+d*x)^3+1//8*a^-9//2*b^5//2*d^-1*(a+b)^-3*(35*b^2+63*a^2+90*a*b)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//8*b*a^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-1*coth(c+d*x)^3*(7b+11a))
@test integrate((a+b*tanh(c+d*x)^2)^-4, x) == :(x*(a+b)^-4+1//6*b*a^-1*d^-1*(a+b)^-1*(a+b*tanh(c+d*x)^2)^-3*tanh(c+d*x)+1//16*a^-7//2*b^(1/2)*d^-1*(a+b)^-4*(5*b^3+35*a^3+21*a*b^2+35*b*a^2)*arctan(a^-1//2*b^(1/2)*tanh(c+d*x))+1//16*b*a^-3*d^-1*(a+b)^-3*(a+b*tanh(c+d*x)^2)^-1*(5*b^2+19*a^2+16*a*b)*tanh(c+d*x)+1//24*b*a^-2*d^-1*(a+b)^-2*(a+b*tanh(c+d*x)^2)^-2*(5b+11a)*tanh(c+d*x))
@test integrate((1+-1*tanh(x)^2)^(1/2), x) == :(arcsin(tanh(x)))
@test integrate((-1+tanh(x)^2)^(1/2), x) == :(-1*arctanh((-1*sech(x)^2)^-1//2*tanh(x)))
@test integrate((1+-1*tanh(x)^2)^3//2, x) == :((1/2)*arcsin(tanh(x))+(1/2)*(sech(x)^2)^(1/2)*tanh(x))
@test integrate((-1+tanh(x)^2)^3//2, x) == :((1/2)*arctanh((-1*sech(x)^2)^-1//2*tanh(x))+-1//2*(-1*sech(x)^2)^(1/2)*tanh(x))
@test integrate((1+-1*tanh(x)^2)^-1//2, x) == :((sech(x)^2)^-1//2*tanh(x))
@test integrate((-1+tanh(x)^2)^-1//2, x) == :((-1*sech(x)^2)^-1//2*tanh(x))
@test integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^5, x) == :(-1*(a+b*tanh(x)^2)^(1/2)+(a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//5*b^-2*(a+b*tanh(x)^2)^5//2+1//3*b^-2*(a+b*tanh(x)^2)^3//2*(a+-1b))
@test integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^4, x) == :((a+b)^(1/2)*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//4*(a+b*tanh(x)^2)^(1/2)*tanh(x)^3+1//8*b^-3//2*(a^2+-8*b^2+-4*a*b)*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//8*b^-1*(a+b*tanh(x)^2)^(1/2)*(a+4b)*tanh(x))
@test integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^3, x) == :(-1*(a+b*tanh(x)^2)^(1/2)+(a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//3*b^-1*(a+b*tanh(x)^2)^3//2)
@test integrate((a+b*tanh(x)^2)^(1/2)*tanh(x)^2, x) == :((a+b)^(1/2)*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//2*(a+b*tanh(x)^2)^(1/2)*tanh(x)+-1//2*b^-1//2*(a+2b)*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^(1/2)*tanh(x), x) == :(-1*(a+b*tanh(x)^2)^(1/2)+(a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^(1/2), x) == :((a+b)^(1/2)*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*b^(1/2)*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^(1/2)*coth(x), x) == :((a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*a^(1/2)*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^(1/2)*coth(x)^2, x) == :((a+b)^(1/2)*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*(a+b*tanh(x)^2)^(1/2)*coth(x))
@test integrate((a+b*tanh(x)^2)^(1/2)*coth(x)^3, x) == :((a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//2*(a+b*tanh(x)^2)^(1/2)*coth(x)^2+-1//2*a^-1//2*(b+2a)*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^(1/2)*coth(x)^4, x) == :((a+b)^(1/2)*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//3*(a+b*tanh(x)^2)^(1/2)*coth(x)^3+-1//3*a^-1*(a+b*tanh(x)^2)^(1/2)*(b+3a)*coth(x))
@test integrate((a+b*tanh(x)^2)^(1/2)*coth(x)^5, x) == :((a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//4*(a+b*tanh(x)^2)^(1/2)*coth(x)^4+-1//8*a^-3//2*(-1*b^2+8*a^2+4*a*b)*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//8*a^-1*(a+b*tanh(x)^2)^(1/2)*coth(x)^2*(b+4a))
@test integrate((a+b*tanh(x)^2)^3//2*tanh(x)^3, x) == :(-1//3*(a+b*tanh(x)^2)^3//2+(a+b)^3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*(a+b*tanh(x)^2)^(1/2)*(a+b)+-1//5*b^-1*(a+b*tanh(x)^2)^5//2)
@test integrate((a+b*tanh(x)^2)^3//2*tanh(x)^2, x) == :((a+b)^3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*(a+b*tanh(x)^2)^(1/2)*((1/2)*b+5//8*a)*tanh(x)+-1//4*b*(a+b*tanh(x)^2)^(1/2)*tanh(x)^3+-1//8*b^-1//2*(3*a^2+8*b^2+12*a*b)*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^3//2*tanh(x), x) == :(-1//3*(a+b*tanh(x)^2)^3//2+(a+b)^3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*(a+b*tanh(x)^2)^(1/2)*(a+b))
@test integrate((a+b*tanh(x)^2)^3//2, x) == :((a+b)^3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//2*b*(a+b*tanh(x)^2)^(1/2)*tanh(x)+-1//2*b^(1/2)*(2b+3a)*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^3//2*coth(x), x) == :((a+b)^3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*b*(a+b*tanh(x)^2)^(1/2)+-1*a^3//2*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^3//2*coth(x)^2, x) == :((a+b)^3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*b^3//2*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*a*(a+b*tanh(x)^2)^(1/2)*coth(x))
@test integrate((1+tanh(x)^2)^(1/2), x) == :(-1*arcsinh(tanh(x))+2^(1/2)*arctanh(2^(1/2)*(1+tanh(x)^2)^-1//2*tanh(x)))
@test integrate((-1+-1*tanh(x)^2)^(1/2), x) == :(-1*2^(1/2)*arctan(2^(1/2)*(-1+-1*tanh(x)^2)^-1//2*tanh(x))+arctan((-1+-1*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((1+tanh(x)^2)^3//2, x) == :(-5//2*arcsinh(tanh(x))+2*2^(1/2)*arctanh(2^(1/2)*(1+tanh(x)^2)^-1//2*tanh(x))+-1//2*(1+tanh(x)^2)^(1/2)*tanh(x))
@test integrate((-1+-1*tanh(x)^2)^3//2, x) == :(-5//2*arctan((-1+-1*tanh(x)^2)^-1//2*tanh(x))+(1/2)*(-1+-1*tanh(x)^2)^(1/2)*tanh(x)+2*2^(1/2)*arctan(2^(1/2)*(-1+-1*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^-1//2*tanh(x)^5, x) == :((a+b)^-1//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//3*b^-2*(a+b*tanh(x)^2)^3//2+b^-2*(a+b*tanh(x)^2)^(1/2)*(a+-1b))
@test integrate((a+b*tanh(x)^2)^-1//2*tanh(x)^4, x) == :((a+b)^-1//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+(1/2)*b^-3//2*(a+-2b)*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//2*b^-1*(a+b*tanh(x)^2)^(1/2)*tanh(x))
@test integrate((a+b*tanh(x)^2)^-1//2*tanh(x)^3, x) == :((a+b)^-1//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*b^-1*(a+b*tanh(x)^2)^(1/2))
@test integrate((a+b*tanh(x)^2)^-1//2*tanh(x)^2, x) == :((a+b)^-1//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*b^-1//2*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^-1//2*tanh(x), x) == :((a+b)^-1//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^-1//2, x) == :((a+b)^-1//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((a+b*tanh(x)^2)^-1//2*coth(x), x) == :((a+b)^-1//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*a^-1//2*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^-1//2*coth(x)^2, x) == :((a+b)^-1//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*a^-1*(a+b*tanh(x)^2)^(1/2)*coth(x))
@test integrate((a+b*tanh(x)^2)^-1//2*coth(x)^3, x) == :((a+b)^-1//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//2*a^-1*(a+b*tanh(x)^2)^(1/2)*coth(x)^2+-1//2*a^-3//2*(-1b+2a)*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2)))
@test integrate((a+b*tanh(x)^2)^-3//2*tanh(x)^5, x) == :((a+b)^-3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*b^-2*(a+b*tanh(x)^2)^(1/2)+-1*a^2*b^-2*(a+b)^-1*(a+b*tanh(x)^2)^-1//2)
@test integrate((a+b*tanh(x)^2)^-3//2*tanh(x)^4, x) == :((a+b)^-3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*b^-3//2*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+a*b^-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2*tanh(x))
@test integrate((a+b*tanh(x)^2)^-3//2*tanh(x)^3, x) == :((a+b)^-3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+a*b^-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2)
@test integrate((a+b*tanh(x)^2)^-3//2*tanh(x)^2, x) == :((a+b)^-3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2*tanh(x))
@test integrate((a+b*tanh(x)^2)^-3//2*tanh(x), x) == :((a+b)^-3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2)
@test integrate((a+b*tanh(x)^2)^-3//2, x) == :((a+b)^-3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+b*a^-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2*tanh(x))
@test integrate((a+b*tanh(x)^2)^-3//2*coth(x), x) == :((a+b)^-3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*a^-3//2*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2))+b*a^-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2)
@test integrate((a+b*tanh(x)^2)^-3//2*coth(x)^2, x) == :((a+b)^-3//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+b*a^-1*(a+b)^-1*(a+b*tanh(x)^2)^-1//2*coth(x)+-1*a^-2*(a+b)^-1*(a+b*tanh(x)^2)^(1/2)*(a+2b)*coth(x))
@test integrate((a+b*tanh(x)^2)^-5//2*tanh(x)^6, x) == :((a+b)^-5//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*b^-5//2*arctanh(b^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+1//3*a*b^-1*(a+b)^-1*(a+b*tanh(x)^2)^-3//2*tanh(x)^3+a*b^-2*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(a+2b)*tanh(x))
@test integrate((a+b*tanh(x)^2)^-5//2*tanh(x)^5, x) == :((a+b)^-5//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1//3*a^2*b^-2*(a+b)^-1*(a+b*tanh(x)^2)^-3//2+a*b^-2*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(a+2b))
@test integrate((a+b*tanh(x)^2)^-5//2*tanh(x)^4, x) == :((a+b)^-5//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1//3*b^-1*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(a+4b)*tanh(x)+1//3*a*b^-1*(a+b)^-1*(a+b*tanh(x)^2)^-3//2*tanh(x))
@test integrate((a+b*tanh(x)^2)^-5//2*tanh(x)^3, x) == :((a+b)^-5//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*(a+b)^-2*(a+b*tanh(x)^2)^-1//2+1//3*a*b^-1*(a+b)^-1*(a+b*tanh(x)^2)^-3//2)
@test integrate((a+b*tanh(x)^2)^-5//2*tanh(x)^2, x) == :((a+b)^-5//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+-1*(a+b*tanh(x)^2)^-3//2*(3a+3b)^-1*tanh(x)+-1//3*a^-1*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(-1b+2a)*tanh(x))
@test integrate((a+b*tanh(x)^2)^-5//2*tanh(x), x) == :((a+b)^-5//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*(a+b)^-2*(a+b*tanh(x)^2)^-1//2+-1*(a+b*tanh(x)^2)^-3//2*(3a+3b)^-1)
@test integrate((a+b*tanh(x)^2)^-5//2, x) == :((a+b)^-5//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+1//3*b*a^-1*(a+b)^-1*(a+b*tanh(x)^2)^-3//2*tanh(x)+1//3*b*a^-2*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(2b+5a)*tanh(x))
@test integrate((a+b*tanh(x)^2)^-5//2*coth(x), x) == :((a+b)^-5//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^2)^(1/2))+-1*a^-5//2*arctanh(a^-1//2*(a+b*tanh(x)^2)^(1/2))+1//3*b*a^-1*(a+b)^-1*(a+b*tanh(x)^2)^-3//2+b*a^-2*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(b+2a))
@test integrate((a+b*tanh(x)^2)^-5//2*coth(x)^2, x) == :((a+b)^-5//2*arctanh((a+b)^(1/2)*(a+b*tanh(x)^2)^-1//2*tanh(x))+1//3*b*a^-1*(a+b)^-1*(a+b*tanh(x)^2)^-3//2*coth(x)+-1//3*a^-3*(a+b)^-2*(a+b*tanh(x)^2)^(1/2)*(a+4b)*(2b+3a)*coth(x)+1//3*b*a^-2*(a+b)^-2*(a+b*tanh(x)^2)^-1//2*(4b+7a)*coth(x))
@test integrate((1+tanh(x)^2)^-1//2, x) == :((1/2)*2^(1/2)*arctanh(2^(1/2)*(1+tanh(x)^2)^-1//2*tanh(x)))
@test integrate((-1+-1*tanh(x)^2)^-1//2, x) == :((1/2)*2^(1/2)*arctan(2^(1/2)*(-1+-1*tanh(x)^2)^-1//2*tanh(x)))
@test integrate((1+tanh(x)^3)^-1, x) == :((1/2)*x+-1*(6+6*tanh(x))^-1+-2//9*3^(1/2)*arctan(1//3*3^(1/2)*(1+-2*tanh(x))))
@test integrate((a+b*tanh(x)^4)^3//2*tanh(x), x) == :(-1//6*(a+b*tanh(x)^4)^3//2+(1/2)*(a+b)^3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^4)^-1//2*(a+b*tanh(x)^2))+-1*(a+b*tanh(x)^4)^(1/2)*((1/2)*a+(1/2)*b+1//4*b*tanh(x)^2)+-1//4*b^(1/2)*(2b+3a)*arctanh(b^(1/2)*(a+b*tanh(x)^4)^-1//2*tanh(x)^2))
@test integrate((a+b*tanh(x)^4)^(1/2)*tanh(x), x) == :(-1//2*(a+b*tanh(x)^4)^(1/2)+(1/2)*(a+b)^(1/2)*arctanh((a+b)^-1//2*(a+b*tanh(x)^4)^-1//2*(a+b*tanh(x)^2))+-1//2*b^(1/2)*arctanh(b^(1/2)*(a+b*tanh(x)^4)^-1//2*tanh(x)^2))
@test integrate((a+b*tanh(x)^4)^-1//2*tanh(x), x) == :((1/2)*(a+b)^-1//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^4)^-1//2*(a+b*tanh(x)^2)))
@test integrate((a+b*tanh(x)^4)^-3//2*tanh(x), x) == :((1/2)*(a+b)^-3//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^4)^-1//2*(a+b*tanh(x)^2))+-1//2*a^-1*(a+b)^-1*(a+b*tanh(x)^4)^-1//2*(a+-1*b*tanh(x)^2))
@test integrate((a+b*tanh(x)^4)^-5//2*tanh(x), x) == :((1/2)*(a+b)^-5//2*arctanh((a+b)^-1//2*(a+b*tanh(x)^4)^-1//2*(a+b*tanh(x)^2))+-1//6*a^-1*(a+b)^-1*(a+b*tanh(x)^4)^-3//2*(a+-1*b*tanh(x)^2)+-1//6*a^-2*(a+b)^-2*(a+b*tanh(x)^4)^-1//2*(3*a^2+-1*b*tanh(x)^2*(2b+5a)))

max_stars_repo_path: test/6 Hyperbolic functions/6.3 Hyperbolic tangent/6.3.7 (d hyper)^m (a+b (c tanh)^n)^p.jl