text:
"""
    isequal(node1,node2)
Check if two nodes are identical.
"""
Base.isequal(x::TSNode, y::TSNode) = ts_node_eq(x, y)

"""
    node_isnull(node::TSNode)

Check if the node is null. Functions like `ts_node_child` and
`ts_node_next_sibling` will return a null node to indicate that no such node
was found.
"""
function node_isnull(node::TSNode)
    ts_node_is_null(node)
end

"""
    node_type(node::TSNode)
Get the node's type as a string
"""
function node_type(node::TSNode)
    type_string = ts_node_type(node)
    return unsafe_string(type_string)
end

"""
    node_type(node::TSNode)
Get the node's type as a numerical id.
"""
function node_symbol(node::TSNode)
    ts_node_symbol(node)
end

"""
    node_string(node::TSNode)

Get an S-expression representing the node as a string.

This string is allocated with `malloc` and the caller is responsible for
freeing it using `free`.
"""
function node_string(node::TSNode)
    s = ts_node_string(node)
    unsafe_string(s)
end

"""
    node_isnamed(node::TSNode)

Check if the node is *named*. Named nodes correspond to named rules in the
grammar, whereas *anonymous* nodes correspond to string literals in the
grammar.
"""
function node_isnamed(node::TSNode)
    ts_node_is_named(node)
end

"""
    node_ismissing(node::TSNode)

Check if the node is *missing*. Missing nodes are inserted by the parser in
order to recover from certain kinds of syntax errors.
"""
function node_ismissing(node::TSNode)
    ts_node_is_missing(node)
end
"""
    node_isextra(node::TSNode)

Check if the node is *extra*. Extra nodes represent things like comments,
which are not required the grammar, but can appear anywhere.
"""
function node_isextra(node::TSNode)
    ts_node_is_extra(node)
end

"""
    node_parent(node::TSNode)
Get the node's immediate parent.
"""
function node_parent(node::TSNode)
    parent = ts_node_parent(node)
    node_isnull(parent) ? nothing : parent
end

"""
    node_child(node, index)

Get a child of the node at a particular index. Use Julian indexing with '1' being
the first child. Returns 'nothing' if the given node does not exist.
"""
function node_child(node::TSNode, index)
    c = ts_node_child(node, index - 1)
    node_isnull(c) ? nothing : c
end

"""
    node_childcount(node)

Return the number of child nodes of a particular node. Can be zero.
"""
function node_childcount(node::TSNode)
    n = ts_node_child_count(node)
    Int(n)
end

"""
    node_next(args)

Return the next sibling of a node if it exists. Nothing otherwise.
"""
function node_next(node::TSNode)
    next = ts_node_next_sibling(node)
    node_isnull(next) ? nothing : next
end

"""
    node_prev(node::TSNode)

Return the previous sibling of a node if it exists. Nothing otherwise.
"""
function node_prev(node::TSNode)
    prev = ts_node_prev_sibling(node)
    node_isnull(prev) ? nothing : prev
end

"""
    node_nextnamed(node::TSNode)

Get the node's next *named* sibling.
"""
function node_nextnamed(node::TSNode)
    next = ts_node_next_named_sibling(node)
    node_isnull(next) ? nothing : next
end

"""
    node_prevnamed(node::TSNode)

Get the node's previous *named* sibling.
"""
function node_prevnamed(node::TSNode)
    prev = ts_node_prev_named_sibling(node)
    node_isnull(prev) ? nothing : prev
end

"""
    node_namedchild_count(node::TSNode)

Get the node's number of *named* children.
"""
function node_namedchild_count(node::TSNode)
    n = ts_node_named_child_count(node)
    Int(n)
end

"""
node_namedchild(node::TSNode, index)

Get the node's *named* child at the given index.
"""
function node_namedchild(node::TSNode, index)
    cnode = ts_node_named_child(node, index - 1)
    node_isnull(cnode) ? nothing : cnode
end

"""
    node_childby_fieldname(node::TSNode, fieldname::AbstractString)

Get the node's child with the given field name.
"""
function node_childby_fieldname(node::TSNode, fieldname::AbstractString)
    child_node = ts_node_child_by_field_name(node, fieldname, length(fieldname))
    node_isnull(child_node) ? nothing : child_node
end

"""
    node_childby_fieldid(node::TSNode, id)

Get the node's child with the given numerical field id.

You can convert a field name to an id using the
`ts_language_field_id_for_name` function.
"""
function node_childby_fieldid(node::TSNode, id)
    child_node = ts_node_child_by_field_id(node, id)
    node_isnull(child_node) ? nothing : child_node
end

"""
    node_startbyte(node::TSNode)

Get the location where start of the node occurs within the source code.
The value returned by this function follows C array indexing such that
the first byte corresponds to a value of '0'.
"""
function node_startbyte(node::TSNode)
    start = ts_node_start_byte(node)
end

"""
    node_stopbyte(node::TSNode)

Get the location where the end of the node occurs within the source code.
The value returned by this function follows C array indexing such that
the first byte corresponds to a value of '0'.
"""
function node_endbyte(node::TSNode)
    stop = ts_node_end_byte(node)
end

"""
    node_children(node::TSNode)

Get an array containing all the children of the node.
Returns 'nothing' if the node does not have any children.
"""
function node_children(node::TSNode)
    l = ts_node_child_count(node)
    l == 0 && return nothing

    c = Vector{TSNode}(undef, l)
    @inbounds for i = 1:l
        c[i] = node_child(node, i)
    end
    c
end

"""
    node_namedchildren(node::TSNode)

Return all children for which there exists a token name.
"""
function node_namedchildren(node::TSNode)
    n = node_namedchild_count(node)
    n == 0 && return nothing

    result = Vector{TSNode}(undef, n)
    @inbounds for i = 1:n
        result[i] = node_namedchild(node, i)
    end
    return result
end

"""
    node_indices(node)
Return the range of text encapsulated by the given node.
"""
function node_indices(node::TSNode)
    start = node_startbyte(node) + 1
    stop = node_endbyte(node)
    return start:stop
end

"""
    node_text(txt, node)
Return a substring corresponding to the text that is associated with the given
node.
"""
function node_text(txt::AbstractString, node::TSNode)
    NI = node_indices(node)
    txt[NI]
end

"""
    node_rootof(tree)
Return the node corresponding to the root of the parsed syntax tree.
"""
function node_rootof(tree::Ptr{TSTree})::TSNode
    ts_tree_root_node(tree)
end

"""
    node_startpoint(node::TSNode)

Get the node's start position in terms of rows and columns.
"""
function node_startpoint(node::TSNode)
    pt = ts_node_start_point(node)
    npt = TSPoint(pt.row + 1, pt.column + 1)
end

"""
    node_endpoint(node::TSNode)

Get the node's end position in terms of rows and columns.
"""
function node_endpoint(node::TSNode)
    ts_node_end_point(node)
end
"""
    NodeLocation

Represents the start and stop location of a node within the source code.
start::TSPoint = [:row =>, :col=> ], stop::TSPoint = [:row =>, :col=> ]
"""
mutable struct NodeLocation
    start::TSPoint
    stop::TSPoint
end

function NodeLocation(node::TSNode)
    NodeLocation(node_startpoint(node), node_endpoint(node))
end


text:
using Test
include("test_linear.jl")
include("simple_continuation.jl")
include("test_newton.jl")
include("test-cont-non-vector.jl")
include("testJacobianFoldDeflation.jl")
include("testHopfMA.jl")
include("test_ms.jl")
include("test_potrap.jl")
include("test-bordered-problem.jl")

ext: jl


text:
using AngleBetweenVectors
using Test

point1 = (1.0, 0.0)
point2 = (0.0, 1.0)
point3 = (-1.0, 0.0)

@test angle(point1, point2) == angle(point2, point1)
@test angle(point1, point3) == angle(point3, point1)
@test angle(point3, point2) == angle(point2, point3)

@test angle(point1, point2) == pi/2.0
@test angle(point1, point3) == pi/1.0

point1 = (1.0, -1.0, 0.0,  0.0)
point2 = (0.0,  1.0, 0.0, -1.0)

# note: 2pi/3 !== Float64(2*BigFloat(pi)/3)
@test angle(point1, point2) == Float64(2*BigFloat(pi)/3)
@test angle(point1, point2) == angle(point2, point1)

@test (@inferred angle(0:1, -1:0)) == pi/2 # abstract vector
@test (@inferred angle(0:1, -1.0:0.0)) == pi/2 # different eltype
@test (@inferred angle(Real[0.0 1], Int16[-1 0])) == pi/2 # array
@test (@inferred angle(0:1, (-1.0:0.0)*1im)) == pi/2 # complex

@test isnan(@inferred angle(zeros(2), 1:2)) # zero point returns NaN


text:
"""
    $(TYPEDEF)

Supertype for all Lyceum environments.
"""
abstract type AbstractEnvironment end

"""
    $(TYPEDSIGNATURES)

Return a subtype of `Shapes.AbstractShape` describing the state space of `env`.

See also: [`getstate!`](@ref), [`getstate`](@ref), [`setstate!`](@ref).
"""
@mustimplement statespace(env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Store the current state of `env` in `s`.

See also: [`statespace`](@ref), [`getstate`](@ref), [`setstate!`](@ref).
"""
@mustimplement getstate!(s, env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Get the current state of `env`.

See also: [`statespace`](@ref), [`getstate!`](@ref), [`setstate!`](@ref).

!!! note
    Implementers of `AbstractEnvironment` subtypes should implement [`statespace`](@ref) and
    [`getstate!`](@ref), which are used internally by `getstate`.
"""
@propagate_inbounds function getstate(env::AbstractEnvironment)
    s = allocate(statespace(env))
    getstate!(s, env)
    return s
end

"""
    $(TYPEDSIGNATURES)

Set the current state of `env` to `s`.

See also: [`statespace`](@ref), [`getstate!`](@ref), [`getstate`](@ref).

!!! note
    Implementers of `AbstractEnvironment` subtypes must guarantee that calls to
    other "getter" functions (e.g. `getreward`) after a call to `setstate!` reflect the
    new state `s`.
"""
@mustimplement setstate!(env::AbstractEnvironment, s)

"""
    $(TYPEDSIGNATURES)

Return a subtype of `Shapes.AbstractShape` describing the observation space of `env`.

See also: [`getobservation!`](@ref), [`getobservation`](@ref).
"""
@mustimplement observationspace(env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Store the current observation of `env` in `o`.

See also: [`observationspace`](@ref), [`getobservation`](@ref).
"""
@mustimplement getobservation!(o, env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Get the current observation of `env`.

See also: [`observationspace`](@ref), [`getobservation!`](@ref).

!!! note
    Implementers of `AbstractEnvironment` subtypes should implement [`observationspace`](@ref) and
    [`getobservation!`](@ref), which are used internally by `getobservation`.
"""
@propagate_inbounds function getobservation(env::AbstractEnvironment)
    o = allocate(observationspace(env))
    getobservation!(o, env)
    o
end

"""
    $(TYPEDSIGNATURES)

Returns a subtype of `Shapes.AbstractShape` describing the action space of `env`.

See also: [`getaction!`](@ref), [`getaction`](@ref), [`setaction!`](@ref).
"""
@mustimplement actionspace(env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Store the current action of `env` in `a`.

See also: [`actionspace`](@ref), [`getaction`](@ref), [`setaction!`](@ref).
"""
@mustimplement getaction!(a, env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Get the current action of `env`.

See also: [`actionspace`](@ref), [`getaction!`](@ref), [`setaction!`](@ref).

!!! note
    Implementers of `AbstractEnvironment` subtypes should implement [`actionspace`](@ref) and
    [`getaction!`](@ref), which are used internally by `getaction`.
"""
@propagate_inbounds function getaction(env::AbstractEnvironment)
    a = allocate(actionspace(env))
    getaction!(a, env)
    a
end

"""
    $(TYPEDSIGNATURES)

Set the current action of `env` to `a`.

See also: [`actionspace`](@ref), [`getaction!`](@ref), [`getaction`](@ref).

!!! note
    Implementers of custom `AbstractEnvironment` subtypes must guarantee that calls to
    other "getter" functions (e.g. `getreward`) after a call to `setaction!` reflect the
    new action `a`.
"""
@mustimplement setaction!(env::AbstractEnvironment, a)

"""
    $(TYPEDSIGNATURES)

Returns a subtype of `Shapes.AbstractShape` describing the reward space of `env`.
Defaults to `Shapes.ScalarShape(Float64)`.

See also: [`getreward`](@ref).

!!! note
    Currently, only scalar spaces are supported.
"""
@inline rewardspace(env::AbstractEnvironment) = ScalarShape(Float64)

"""
    $(TYPEDSIGNATURES)

Get the current reward of `env` as a function of state `s`, action `a`, and observation `o`.

See also: [`rewardspace`](@ref).

!!! note
    Currently, only scalar rewards are supported, so there is no in-place `getreward!`.

!!! note
    Implementers of `AbstractEnvironment` subtypes should be careful to ensure that the result
    of `getreward` is purely a function of `s`/`a`/`o` and and not any internal, dynamic state
    contained in `env`.
"""
@mustimplement getreward(s, a, o, env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Get the current reward of `env`.

See also: [`rewardspace`](@ref).

!!! note
    Implementers of `AbstractEnvironment` subtypes should implement `getreward(s, a, o, env)`.
"""
@propagate_inbounds function getreward(env::AbstractEnvironment)
    getreward(getstate(env), getaction(env), getobservation(env), env)
end

"""
    $(TYPEDSIGNATURES)

Reset `env` to a fixed, initial state with passive dynamics (i.e. a "zero" action).
"""
@mustimplement reset!(env::AbstractEnvironment)

"""
    randreset!([rng::Random.AbstractRNG, ], env::AbstractEnvironment)

Reset `env` to a random state with passive dynamics (i.e. a "zero" action).

!!! note
    Implementers of `AbstractEnvironment` subtypes should implement randreset!(rng, env).
"""
@mustimplement randreset!(rng::Random.AbstractRNG, env::AbstractEnvironment)
@propagate_inbounds randreset!(env::AbstractEnvironment) = randreset!(Random.default_rng(), env)

"""
    $(TYPEDSIGNATURES)

Advance `env` forward by one timestep.

See also: [`timestep`](@ref).
"""
@mustimplement step!(env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Returns `true` if state `s` and observation `o` meet an early termination condition for `env`.
Defaults to `false`.

!!! note
    Implementers of `AbstractEnvironment` subtypes should be careful to ensure that the result of
    `isdone` is purely a function of `s` and `o` and not any internal, dynamic state contained
    in `env`.
"""
isdone(s, o, env::AbstractEnvironment) = false

"""
    $(TYPEDSIGNATURES)

Returns `true` if `env` has met an early termination condition.

Internally calls `isdone(getstate(env), getobservation(env), env)`.

!!! note
    Implementers of `AbstractEnvironment` subtypes should implement `isdone(s, o, env)`.
"""
@propagate_inbounds function isdone(env::AbstractEnvironment)
    isdone(getstate(env), getobservation(env), env)
end

"""
    $(TYPEDSIGNATURES)

Returns the current simulation time, in seconds, of `env`.

See also: [`timestep`](@ref).
"""
@mustimplement Base.time(env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Return the internal simulation timestep, in seconds, of `env`.

See also: [`Base.time`](@ref).
"""
@mustimplement timestep(env::AbstractEnvironment)

"""
    $(TYPEDSIGNATURES)

Return a `NamedTuple` of containing all of `env`'s spaces.

# Examples
```julia
env = FooEnv()
sp = spaces(env)
@assert statespace(env) == sp.statespace
```
"""
function spaces(env::AbstractEnvironment)
    (
        statespace = statespace(env),
        observationspace = observationspace(env),
        actionspace = actionspace(env),
        rewardspace = rewardspace(env),
    )
end


text:
# add.jl
module Add
export foo!

function my_func(x, y)
    return x + y
end

# z is output, should use . to inplace
function foo!(x, y, z)
    z .= my_func(x, y)
end

end


text:
"""
# module HRGVisualization

- Julia version:
- Author: bramb
- Date: 2019-01-24

# Examples

```jldoctest
julia>using HRGVisualization

julia>he = HyperEdge("S", ["1"], ["2"])

julia>dot = to_dot(he)
```
"""
module HRGVisualization

export to_dot,
       HRGrammarRules,
       HyperEdge,
       HyperGraph,
       display

include("types.jl") # the type definitions should come from the main HRG module

function to_dot(he::HyperEdge)
    source_buf = IOBuffer()
    source_vars = String[]
    for (i,s) in enumerate(he.source)
        shape = _node_shape(s)
        line = """
            s$i[shape=$shape;label="";xlabel="$s";fontsize=10]
        """
        print(source_buf,line)
        push!(source_vars,"s$i")
    end
    sv = join(source_vars,",")

    target_buf = IOBuffer()
    target_vars = String[]
    for (i,t) in enumerate(he.target)
        shape = _node_shape(t)
        line = """
            t$i[shape=$shape;label="";xlabel="$t";fontsize=10]
        """
        print(target_buf,line)
        push!(target_vars,"t$i")
    end
    tv = join(target_vars,",")

    source = String(take!(source_buf))
    target = String(take!(target_buf))
    dot = """
    digraph HyperEdge {
        rankdir=LR
        labelloc=b
        color=white
        edge [arrowsize=0.5]
        $source
        he[shape=box;label="$(he.label)"]
        $target
        {$sv} -> he -> {$tv}
    }
    """
    return dot
end

function to_dot(hg::HyperGraph)
    hypergraph = _hypergraph_as_dot(hg)

    dot = """
    digraph HyperGraph {
        rankdir=LR
        labelloc=b
        color=white
        edge [arrowsize=0.5]
        $hypergraph
    }
    """
    return dot
end

function to_dot(rules::HRGrammarRules)
    replacements_buf = IOBuffer()

    ordered_keys = reverse(_order_keys(rules))
    for (i,lhs) in enumerate(ordered_keys)
        rhs = rules[lhs]
        hypergraph = _hypergraph_as_dot(rhs,"rule$(i)_")

        cluster = """
        subgraph cluster_$i {
            label="$lhs ⇒"
            $hypergraph
        }
        """
        print(replacements_buf,cluster)
    end

    replacements = String(take!(replacements_buf))
    dot = """
    digraph HRG_Rules {
        rankdir=LR
        edge [arrowsize=0.5]
        $replacements
    }
    """
    return dot
end

import Base.display
function display(mime::MIME"image/svg+xml", he::HyperEdge)
    _display_svg(he)
end

function display(mime::MIME"image/png", he::HyperEdge)
    _display_png(he)
end

function display(mime::MIME"image/svg+xml", hg::HyperGraph)
    _display_svg(hg)
end

function display(mime::MIME"image/png", hg::HyperGraph)
    _display_png(hg)
end

function display(mime::MIME"image/svg+xml", rules::HRGrammarRules)
    _display_svg(rules)
end

function display(mime::MIME"image/png", rules::HRGrammarRules)
    _display_png(rules)
end

function _display_svg(x)
    file = "tmp.dot"
    write(file,to_dot(x))
    display("image/svg+xml", read(`dot -Tsvg $file`,String))
end

function _display_png(x)
    file = "tmp.dot"
    write(file,to_dot(x))
    display("image/png", read(`dot -Tpng -Gfontname=Sans $file`))
end

function _hypergraph_as_dot(hg::HyperGraph, prefix::String="")
    hyperedges_buf = IOBuffer()
    node_vars = Dict{Node,String}()
    node_set = Set()

    # collect all source and target nodes of all the hyperedges in the hypergraph, and count the external nodes "_"
    for (i,he) in enumerate(hg)
        map(n -> push!(node_set,n), vcat(he.source,he.target))
        # the "_" stands for a unique external node, so these should be handled differently
        # we can keep a placeholder in the node_vars

        line = """
        $(prefix)he$i[shape=box;label="$(he.label)"]
        """
        print(hyperedges_buf,line)
    end

    external_node_count = _external_node_count(hg)
    nodes_buf = IOBuffer()
    for (i,n) in enumerate(sort(collect(node_set)))
        var = "$(prefix)n$i"
        node_vars[n] = var
        if (n == "_")
            for j in 1:external_node_count
                node_def = """
                $(var)_$(j)[shape=circle;width=0.05;label=""]
                """
                print(nodes_buf,node_def)
            end
        else
            node_def = """
            $(var)[shape=point;label="";xlabel="$n";fontsize=10]
            """
            print(nodes_buf,node_def)
        end
    end

    edges_buf = IOBuffer()
    external_node_counter = 0
    for (i,he) in enumerate(hg)
        source_vars = []
        for s in he.source
            source_var = node_vars[s]
            if s == "_"
                external_node_counter = external_node_counter + 1
                source_var = "$(source_var)_$(external_node_counter)"
            end
            push!(source_vars,source_var)
        end
        sv = join(source_vars,",")

        target_vars = []
        for t in he.target
            target_var = node_vars[t]
            if t == "_"
                external_node_counter = external_node_counter + 1
                target_var = "$(target_var)_$(external_node_counter)"
            end
            push!(target_vars,target_var)
        end
        tv = join(target_vars,",")

        line = """
            {$sv} -> $(prefix)he$i -> {$tv}
        """
        print(edges_buf,line)
    end

    nodes = String(take!(nodes_buf))
    hyperedges = String(take!(hyperedges_buf))
    edges = String(take!(edges_buf))
    dot = """
    $nodes
    $hyperedges
    $edges
    """
    return dot
end

_node_shape(label::String) = label == "_" ? "" : "point"

function _external_node_count(hg::HyperGraph)
    nodes = String[]
    for he in hg
        nodes = vcat(nodes, vcat(he.source,he.target))
    end
    return count(n -> (n == "_"), nodes)
end

_order_keys(rules::HRGrammarRules) = _process_nonterminal("S",String[],rules)

function _process_nonterminal(nonterminal::String, keys::Array{String}, rules::HRGrammarRules)
    push!(keys,nonterminal)
    for nt in _get_nonterminals(rules[nonterminal])
        if !(nt in keys)
            keys = _process_nonterminal(nt,keys,rules)
        end
    end
    return keys
end

_get_nonterminals(hg::HyperGraph) = [he.label for he in hg if _is_nonterminal(he.label)]

_is_nonterminal(s::String) = all(c->isuppercase(c), s)

end


text:
mutable struct Tank
   dry_mass::Float64    # excluding propellant
   total_mass::Float64  # including propellant
   propellant::Float64  # propellant mass left

   "Create a full tank"
   function Tank(dry_mass::Number, total_mass::Number)
      new(dry_mass, total_mass, total_mass - dry_mass)
   end
end

mass(tank::Tank) = tank.dry_mass + tank.propellant

abstract type Payload end

struct Capsule <: Payload
   mass::Float64
end

struct SpaceProbe <: Payload
   mass::Float64
end

struct Satellite <: Payload
   mass::Float64
end

mass(probe::SpaceProbe) = probe.mass
mass(capsule::Capsule) = capsule.mass
mass(satellite::Satellite) = satellite.mass

abstract type Engine end

struct SingleEngine <: Engine
   thrust::Float64  # Newton
   Isp::Float64     # Specific Impulse
   mass::Float64    # Kg
end

# constructor. Can use Engine since its an abstract type without its own constructor
function Engine(thrust::Number, Isp::Number, mass::Number)
    SingleEngine(thrust, Isp, mass)
end

struct EngineCluster <: Engine
   engine::SingleEngine
   count::Int8
end

thrust(engine::SingleEngine)   = engine.thrust
thrust(cluster::EngineCluster) = thrust(cluster.engine) * cluster.count

Isp(engine::SingleEngine)   = engine.Isp
Isp(cluster::EngineCluster) = Isp(cluster.engine)

mass(engine::SingleEngine)  = engine.mass
mass(cluster::EngineCluster) = mass(cluster.engine) * cluster.count

mutable struct Rocket <: Payload
   payload::Payload
   tank::Tank
   engine::Engine
end

function mass(r::Rocket)
   mass(r.payload) + mass(r.tank) + mass(r.engine)
end

g₀ = 9.80665 # m/s^2 acceleration of gravity on earth
mass_flow(thrust::Number, Isp::Number) = thrust / (Isp * g₀)

# update propellant depletion over time
function update!(r::Rocket, Δt::Number)
   mflow = mass_flow(thrust(r.engine), Isp(r.engine))
   r.tank.propellant -= min(mflow * Δt, r.tank.propellant)
end

#Example

# second_stage = Rocket(SpaceProbe(22.8e6),
#                      Tank(4e3, 111.5e3),
#                      Engine(845e3, 348, 470)
#                      )

# first_stage = Rocket(second_stage,
#                      Tank(22e3, 433e3),
#                      EngineCluster(Engine(845e3, 282, 470), 9))

max_stars_repo_name: FourMInfo/JuliaforBeginners

max_issues_repo_name: FourMInfo/JuliaforBeginners

max_forks_repo_name: FourMInfo/JuliaforBeginners


text:
N = 100
alldata = collect(1:1.0:N)

chunk = 10 # current chunk len to feed the buffer
prev_len = 20 # amount of previous data to hold in buffer
buflen = chunk + prev_len

buf = RollingBuffer{Float64}(buflen)

for i = 1 : chunk : N-chunk+1
    push!(buf, view(alldata, i:i+chunk-1))
    println("Iteration $i | data feed: $(i:i+chunk-1) | buffered data: $(firstindex(buf):lastindex(buf))")
end

same_index = map(i-> buf[i] == alldata[i], eachindex(buf)) |> all

if same_index
    println("Buffer hold last elenements of the original data array with the same indexes.")
end


text:
export BrickletNFCRFIDTagID
struct BrickletNFCRFIDTagID
    tag_type::Integer
    tid_length::Integer
    tid::Vector{Integer}
end

export BrickletNFCRFIDState
struct BrickletNFCRFIDState
    state::Integer
    idle::Bool
end

export BrickletNFCRFIDIdentity
struct BrickletNFCRFIDIdentity
    uid::String
    connected_uid::String
    position::Char
    hardware_version::Vector{Integer}
    firmware_version::Vector{Integer}
    device_identifier::Integer
end

export BrickletNFCRFID
"""
Reads and writes NFC and RFID tags
"""
mutable struct BrickletNFCRFID <: TinkerforgeDevice
    ipcon::IPConnection
    deviceInternal::PyObject

    """
    Creates an object with the unique device ID *uid* and adds it to
    the IP Connection *ipcon*.
    """
    function BrickletNFCRFID(uid::String, ipcon::IPConnection)
        package = pyimport("tinkerforge.bricklet_nfc_rfid")
        deviceInternal = package.BrickletNFCRFID(uid, ipcon.ipconInternal)

        return new(ipcon, deviceInternal)
    end
end

export request_tag_id
"""
    $(SIGNATURES)

To read or write a tag that is in proximity of the NFC/RFID Bricklet you
first have to call this function with the expected tag type as parameter.
It is no problem if you don't know the tag type. You can cycle through
the available tag types until the tag gives an answer to the request.

Currently the following tag types are supported:

* Mifare Classic
* NFC Forum Type 1
* NFC Forum Type 2

After you call :func:`Request Tag ID` the NFC/RFID Bricklet will try to read
the tag ID from the tag. After this process is done the state will change.
You can either register the :cb:`State Changed` callback or you can poll
:func:`Get State` to find out about the state change.

If the state changes to *RequestTagIDError* it means that either there was
no tag present or that the tag is of an incompatible type. If the state
changes to *RequestTagIDReady* it means that a compatible tag was found
and that the tag ID could be read out. You can now get the tag ID by
calling :func:`Get Tag ID`.

If two tags are in the proximity of the NFC/RFID Bricklet, this
function will cycle through the tags. To select a specific tag you have
to call :func:`Request Tag ID` until the correct tag id is found.

In case of any *Error* state the selection is lost and you have to
start again by calling :func:`Request Tag ID`.
"""
function request_tag_id(device::BrickletNFCRFID, tag_type)
    device.deviceInternal.request_tag_id(tag_type)
end

export get_tag_id
"""
    $(SIGNATURES)

Returns the tag type, tag ID and the length of the tag ID
(4 or 7 bytes are possible length). This function can only be called if the
NFC/RFID is currently in one of the *Ready* states. The returned ID
is the ID that was saved through the last call of :func:`Request Tag ID`.

To get the tag ID of a tag the approach is as follows:

1. Call :func:`Request Tag ID`
2. Wait for state to change to *RequestTagIDReady* (see :func:`Get State` or
   :cb:`State Changed` callback)
3. Call :func:`Get Tag ID`
"""
function get_tag_id(device::BrickletNFCRFID)
    return device.deviceInternal.get_tag_id()
end

export get_state
"""
    $(SIGNATURES)

Returns the current state of the NFC/RFID Bricklet.

On startup the Bricklet will be in the *Initialization* state. The
initialization will only take about 20ms. After that it changes to *Idle*.

The functions of this Bricklet can be called in the *Idle* state and all of
the *Ready* and *Error* states.

Example: If you call :func:`Request Page`, the state will change to
*RequestPage* until the reading of the page is finished. Then it will change
to either *RequestPageReady* if it worked or to *RequestPageError* if it
didn't. If the request worked you can get the page by calling :func:`Get Page`.

The same approach is used analogously for the other API functions.
"""
function get_state(device::BrickletNFCRFID)
    return device.deviceInternal.get_state()
end

export authenticate_mifare_classic_page
"""
    $(SIGNATURES)

Mifare Classic tags use authentication. If you want to read from or write to
a Mifare Classic page you have to authenticate it beforehand.
Each page can be authenticated with two keys: A (``key_number`` = 0) and B
(``key_number`` = 1). A new Mifare Classic
tag that has not yet been written to can be accessed with key A
and the default key ``[0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]``.

The approach to read or write a Mifare Classic page is as follows:

1. Call :func:`Request Tag ID`
2. Wait for state to change to *RequestTagIDReady* (see :func:`Get State`
   or :cb:`State Changed` callback)
3. If looking for a specific tag then call :func:`Get Tag ID` and check if the
   expected tag was found, if it was not found go back to step 1
4. Call :func:`Authenticate Mifare Classic Page` with page and key for the page
5. Wait for state to change to *AuthenticatingMifareClassicPageReady* (see
   :func:`Get State` or :cb:`State Changed` callback)
6. Call :func:`Request Page` or :func:`Write Page` to read/write page
"""
function authenticate_mifare_classic_page(device::BrickletNFCRFID, page, key_number, key)
    device.deviceInternal.authenticate_mifare_classic_page(page, key_number, key)
end

export write_page
"""
    $(SIGNATURES)

Writes 16 bytes starting from the given page. How many pages are written
depends on the tag type. The page sizes are as follows:

* Mifare Classic page size: 16 byte (one page is written)
* NFC Forum Type 1 page size: 8 byte (two pages are written)
* NFC Forum Type 2 page size: 4 byte (four pages are written)

The general approach for writing to a tag is as follows:

1. Call :func:`Request Tag ID`
2. Wait for state to change to *RequestTagIDReady* (see :func:`Get State` or
   :cb:`State Changed` callback)
3. If looking for a specific tag then call :func:`Get Tag ID` and check if the
   expected tag was found, if it was not found got back to step 1
4. Call :func:`Write Page` with page number and data
5. Wait for state to change to *WritePageReady* (see :func:`Get State` or
   :cb:`State Changed` callback)

If you use a Mifare Classic tag you have to authenticate a page before you
can write to it. See :func:`Authenticate Mifare Classic Page`.
"""
function write_page(device::BrickletNFCRFID, page, data)
    device.deviceInternal.write_page(page, data)
end

export request_page
"""
    $(SIGNATURES)

Reads 16 bytes starting from the given page and stores them into a buffer.
The buffer can then be read out with :func:`Get Page`.
How many pages are read depends on the tag type. The page sizes are
as follows:

* Mifare Classic page size: 16 byte (one page is read)
* NFC Forum Type 1 page size: 8 byte (two pages are read)
* NFC Forum Type 2 page size: 4 byte (four pages are read)

The general approach for reading a tag is as follows:

1. Call :func:`Request Tag ID`
2. Wait for state to change to *RequestTagIDReady* (see :func:`Get State`
   or :cb:`State Changed` callback)
3. If looking for a specific tag then call :func:`Get Tag ID` and check if the
   expected tag was found, if it was not found got back to step 1
4. Call :func:`Request Page` with page number
5. Wait for state to change to *RequestPageReady* (see :func:`Get State`
   or :cb:`State Changed` callback)
6. Call :func:`Get Page` to retrieve the page from the buffer

If you use a Mifare Classic tag you have to authenticate a page before you
can read it. See :func:`Authenticate Mifare Classic Page`.
"""
function request_page(device::BrickletNFCRFID, page)
    device.deviceInternal.request_page(page)
end

export get_page
"""
    $(SIGNATURES)

Returns 16 bytes of data from an internal buffer. To fill the buffer
with specific pages you have to call :func:`Request Page` beforehand.
"""
function get_page(device::BrickletNFCRFID)
    return device.deviceInternal.get_page()
end

export get_identity
"""
    $(SIGNATURES)

Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
position 'z'.

The device identifier numbers can be found :ref:`here <device_identifier>`.
|device_identifier_constant|
"""
function get_identity(device::BrickletNFCRFID)
    return device.deviceInternal.get_identity()
end

export register_callback
"""
Registers the given *function* with the given *callback_id*.
"""
function register_callback(device::BrickletNFCRFID, callback_id, function_)
    if isnothing(function_)
        device.registered_callbacks.pop(callback_id, None)
    else
        device.registered_callbacks[callback_id] = function_
    end
end


text:
using Test, LazyArtifacts, Sandbox

@testset "SandboxConfig" begin
    rootfs_dir = Sandbox.alpine_rootfs()

    @testset "minimal config" begin
        config = SandboxConfig(Dict("/" => rootfs_dir))

        @test haskey(config.read_only_maps, "/")
        @test config.read_only_maps["/"] == rootfs_dir
        @test isempty(config.read_write_maps)
        @test isempty(config.env)
        @test config.pwd == "/"
        @test config.stdin == Base.devnull
        @test config.stdout == Base.stdout
        @test config.stderr == Base.stderr
    end

    @testset "full options" begin
        stdout = IOBuffer()
        config = SandboxConfig(
            # read-only maps
            Dict(
                "/" => rootfs_dir,
                "/lib" => "/lib",
            ),
            # read-write maps
            Dict("/workspace" => @__DIR__),
            # env
            Dict("PATH" => "/bin:/usr/bin");
            entrypoint = "/init",
            pwd = "/lib",
            persist = true,
            stdin = Base.stdout,
            stdout = stdout,
            stderr = Base.devnull
        )
        @test config.read_only_maps["/"] == rootfs_dir
        @test config.read_only_maps["/lib"] == "/lib"
        @test config.read_write_maps["/workspace"] == @__DIR__
        @test config.env["PATH"] == "/bin:/usr/bin"
        @test config.entrypoint == "/init"
        @test config.pwd == "/lib"
        @test config.persist
        @test config.stdin == Base.stdout
        @test config.stdout == stdout
        @test config.stderr == Base.devnull
    end

    @testset "errors" begin
        # No root dir error
        @test_throws ArgumentError SandboxConfig(Dict("/rootfs" => rootfs_dir))

        # relative dirs error
        @test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir, "rootfs" => rootfs_dir))
        @test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir, "/rootfs" => basename(rootfs_dir)))
        @test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir), Dict("rootfs" => rootfs_dir))
        @test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir), Dict("/rootfs" => basename(rootfs_dir)))
        @test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir); pwd="lib")
        @test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir); entrypoint="init")
    end
end


text:
#= Design summary:

This is a so-called "traits-based" design, as follows.

The main body of the file defines versions of elementary functions with all allowed
interval rounding types, e.g.
+(IntervalRounding{:tight}, a, b, RoundDown)
+(IntervalRounding{:accurate}, a, b, RoundDown)
+(IntervalRounding{:slow}, a, b, RoundDown)
+(IntervalRounding{:none}, a, b, RoundDown)

The current allowed rounding types are
- :tight     # fast, tight (correct) rounding with errorfree arithmetic via FastRounding.jl
- :accurate # fast "accurate" rounding using prevfloat and nextfloat  (slightly wider than needed)
- :slow    # tight (correct) rounding by changing rounding mode (slow)
- :none     # no rounding (for speed comparisons; no enclosure is guaranteed)

The function `setrounding(Interval, rounding_type)` then defines rounded
 functions *without* an explicit rounding type, e.g.

sin(x, r::RoundingMode) = sin(IntervalRounding{:slow}, x, r)

These are overwritten when `setrounding(Interval, rounding_type)` is called again.

In Julia v0.6 and later (but *not* in Julia v0.5), this automatically redefines all relevant functions, in particular those used in +(a::Interval, b::Interval) etc., so that all interval functions automatically use the correct interval rounding type from then on.
=#

"""Interval rounding trait type"""
struct IntervalRounding{T} end

# Functions that are the same for all rounding types:

# unary plus and minus:
+(a::T, ::RoundingMode) where {T<:AbstractFloat} =  a  # ignore rounding
-(a::T, ::RoundingMode) where {T<:AbstractFloat} = -a  # ignore rounding

# zero:
zero(a::Interval{T}, ::RoundingMode) where {T<:AbstractFloat} = zero(T)
zero(::Type{T}, ::RoundingMode) where {T<:AbstractFloat} = zero(T)

convert(::Type{BigFloat}, x, rounding_mode::RoundingMode) =
    setrounding(BigFloat, rounding_mode) do
        convert(BigFloat, x)
    end

parse(::Type{T}, x::AbstractString, rounding_mode::RoundingMode) where {T} = setrounding(T, rounding_mode) do
    parse(T, x)
end

# use BigFloat parser to get round issues on Windows:
function parse(::Type{Float64}, s::AbstractString, r::RoundingMode)
    a = setprecision(BigFloat, 53) do
            setrounding(BigFloat, r) do
                parse(BigFloat, s)   # correctly takes account of rounding mode
            end
        end

    return Float64(a, r)
end

sqrt(a::T, rounding_mode::RoundingMode) where {T<:Rational} = setrounding(float(T), rounding_mode) do
    sqrt(float(a))
end

# no-ops for rational rounding:
for f in (:+, :-, :*, :/)
    @eval $f(a::T, b::T, ::RoundingMode) where {T<:Rational} = $f(a, b)
end

# error-free arithmetic:

for (op, f) in ( (:+, :add), (:-, :sub), (:*, :mul), (:/, :div) )
    ff = Symbol(f, "_round")

    for T in (Float32, Float64)
        for mode in (:Down, :Up)

            mode1 = Expr(:quote, mode)
            mode1 = :(::RoundingMode{$mode1})

            mode2 = Symbol("Round", mode)

            @eval $op(::IntervalRounding{:tight},
                                a::$T, b::$T, $mode1) = $ff(a, b, $mode2)
        end
    end
end

for T in (Float32, Float64)
    for mode in (:Down, :Up)

        mode1 = Expr(:quote, mode)
        mode1 = :(::RoundingMode{$mode1})

        mode2 = Symbol("Round", mode)

        @eval inv(::IntervalRounding{:tight},
                            a::$T, $mode1) = inv_round(a, $mode2)

                @eval sqrt(::IntervalRounding{:tight},
                            a::$T, $mode1) = sqrt_round(a, $mode2)
        end
end

# Define functions with different rounding types:
for mode in (:Down, :Up)

    mode1 = Expr(:quote, mode)
    mode1 = :(::RoundingMode{$mode1})

    mode2 = Symbol("Round", mode)

    if mode == :Down
        directed = :prev_float
    else
        directed = :next_float
    end

    # binary functions:
    for f in (:+, :-, :*, :/, :atan2)

        @eval function $f(::IntervalRounding{:slow},
                          a::T, b::T, $mode1) where T<:AbstractFloat
                    setrounding(T, $mode2) do
                        $f(a, b)
                    end
                end

        @eval function $f(::IntervalRounding{:tight},
                                  a::T, b::T, $mode1) where T<:AbstractFloat
                            setrounding(T, $mode2) do
                                $f(a, b)
                            end
                        end

        @eval $f(::IntervalRounding{:accurate},
                  a::T, b::T, $mode1) where {T<:AbstractFloat} = $directed($f(a, b))

        @eval $f(::IntervalRounding{:none},
                  a::T, b::T, $mode1) where {T<:AbstractFloat} = $f(a, b)

    end

    # power:

    @eval function ^(::IntervalRounding{:slow},
                               a::BigFloat, b::S, $mode1) where S<:Real
                  setrounding(BigFloat, $mode2) do
                      ^(a, b)
                  end
           end

    # for correct rounding for Float64, must pass through BigFloat:
    @eval function ^(::IntervalRounding{:slow}, a::Float64, b::S, $mode1) where S<:Real
        setprecision(BigFloat, 53) do
            Float64(^(IntervalRounding{:slow}, BigFloat(a), b, $mode2))
        end
    end

    @eval ^(::IntervalRounding{:accurate},
      a::T, b::S, $mode1) where {T<:AbstractFloat,S<:Real} = $directed(a^b)

    @eval ^(::IntervalRounding{:none},
      a::T, b::S, $mode1) where {T<:AbstractFloat,S<:Real} = a^b

    # functions not in CRlibm:
    for f in (:sqrt, :inv, :tanh, :asinh, :acosh, :atanh)

        @eval function $f(::IntervalRounding{:slow},
                          a::T, $mode1) where T<:AbstractFloat
                            setrounding(T, $mode2) do
                                $f(a)
                            end
               end

        @eval $f(::IntervalRounding{:accurate},
                  a::T, $mode1) where {T<:AbstractFloat} = $directed($f(a))

        @eval $f(::IntervalRounding{:none},
                  a::T, $mode1) where {T<:AbstractFloat} = $f(a)

    end

    # Functions defined in CRlibm

    for f in CRlibm.functions
        @eval $f(::IntervalRounding{:slow},
              a::T, $mode1) where {T<:AbstractFloat} = CRlibm.$f(a, $mode2)

        @eval $f(::IntervalRounding{:accurate},
                  a::T, $mode1) where {T<:AbstractFloat} = $directed($f(a))

        @eval $f(::IntervalRounding{:none},
                  a::T, $mode1) where {T<:AbstractFloat} = $f(a)

    end
end

const rounding_types = (:tight, :accurate, :slow, :none)

function _setrounding(::Type{Interval}, rounding_type::Symbol)

    if rounding_type == current_rounding_type[]
        return  # no need to redefine anything
    end

    if rounding_type ∉ rounding_types
        throw(ArgumentError("Rounding type must be one of $rounding_types"))
    end

    roundtype = IntervalRounding{rounding_type}()

    # binary functions:
    for f in (:+, :-, :*, :/)
        @eval $f(a::T, b::T, r::RoundingMode) where {T<:AbstractFloat} = $f($roundtype, a, b, r)
    end

    if rounding_type == :tight   # for remaining functions, use CRlibm
        roundtype = IntervalRounding{:slow}()
    end

    for f in (:^, :atan2)

        @eval $f(a::T, b::T, r::RoundingMode) where {T<:AbstractFloat} = $f($roundtype, a, b, r)
    end

    @eval ^(a::T, b::S, r::RoundingMode) where {T<:AbstractFloat, S<:Real} = ^($roundtype, promote(a, b)..., r)

    # unary functions:
    for f in vcat(CRlibm.functions,
                [:sqrt, :inv, :tanh, :asinh, :acosh, :atanh])

        @eval $f(a::T, r::RoundingMode) where {T<:AbstractFloat} = $f($roundtype, a, r)

        @eval $f(x::Real, r::RoundingMode) = $f(float(x), r)

    end

    current_rounding_type[] = rounding_type
end

"""
    setrounding(Interval, rounding_type::Symbol)

Set the rounding type used for all interval calculations on Julia v0.6 and above.
Valid `rounding_type`s are $rounding_types.
"""
function setrounding(::Type{Interval}, rounding_type::Symbol)

    # suppress redefinition warnings:
    # modified from OhMyREPL.jl

    # dump the warnings to a file, and check the file to make
    # sure they are only redefinition warnings

    path, io = mktemp()

    old_stderr = stderr
    redirect_stderr(io)

    _setrounding(Interval, rounding_type)

    redirect_stderr(old_stderr)

    close(io)

    # check
    lines = readlines(path)

    # print(lines)

    for line in lines

        if line == ""
            continue
        end

        if !startswith(line, "WARNING: Method definition")

            if startswith(line, "WARNING") || startswith(line, "Use")
                warn(line)

            else
                println("Error on line: ", line)
                error(line)
            end
        end
    end

    return rounding_type

end

rounding(Interval) = current_rounding_type[]

# default: correct rounding
const current_rounding_type = Symbol[:undefined]
setrounding(Interval, :tight)


text:
module TestFactorizationMachines

using FactorizationMachines
using Base.Test

info("Testing squared error loss")
y =  [1.0, 1.0, -1.0, -1.0, 0.5]
yhat = [1.0, -1.0, 1.0, -1.0, -0.25]
expected_loss = [0, 4, 4, 0, 0.5625]
for i in 1:length(y)
  @test expected_loss[i] == Common.sqerr(yhat[i], y[i])
end

info("Testing 0-1 loss")
y =  [1.0, 1.0, -1.0, -1.0]
yhat = [1.0, -1.0, 1.0, -1.0]
expected_loss = [0, 1, 1, 0]
for i in 1:length(y)
  @test expected_loss[i] == Common.heaviside(yhat[i], y[i])
end

info("Testing negative logistic sigmoid loss for {1, -1} labels")
y =  [1.0, 1.0, -1.0, -1.0]
yhat = [1.0, -1.0, 1.0, -1.0]
expected_loss = [-log(Common.sigmoid(1)), log(1 + e), log(1 + e), -log(Common.sigmoid(1))]
for i in 1:length(y)
  @test expected_loss[i] == Common.nlogsig(yhat[i], y[i])
end

info("Testing negative logistic sigmoid loss for {1, 0} labels")
y =  [1.0, 1.0, 0.0, 0.0]
yhat = [1.0, 0.0, 1.0, 0.0]
expected_loss = [-log(Common.sigmoid(1)), log(2), log(2), log(2)]
for i in 1:length(y)
  @test expected_loss[i] == Common.nlogsig(yhat[i], y[i])
end

end


text:
# ---
# title: 343. Integer Break
# id: problem343
# author: Tian Jun
# date: 2020-10-31
# difficulty: Medium
# categories: Math, Dynamic Programming
# link: <https://leetcode.com/problems/integer-break/description/>
# hidden: true
# ---
#
# Given a positive integer _n_ , break it into the sum of **at least** two
# positive integers and maximize the product of those integers. Return the
# maximum product you can get.
#
# **Example 1:**
#
#
#
#     Input: 2
#     Output: 1
#     Explanation: 2 = 1 + 1, 1 × 1 = 1.
#
# **Example 2:**
#
#
#
#     Input: 10
#     Output: 36
#     Explanation: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36.
#
# **Note** : You may assume that _n_ is not less than 2 and not larger than 58.
#
#
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end


text:
"""
    init_window(;[
        name="Simulation", res=(1280, 720), color=RGBA(1., 1., 1., 1.),
        fullscreen=false
    ])

Creates a window (screen) and starts the renderloop asynchronously. Returns the
window (screen).
"""
function init_window(;
        name::String = "Lattice Visualization",
        res = (1280, 720),
        color = RGBA(1., 1., 1., 1.),
        fullscreen = false
    )
    screen = glscreen(name, resolution=res, color=color, fullscreen=fullscreen)
    @async renderloop(screen)
    screen
end

"""
    _camera(window[,
        rot_v=Signal(0.01f0), trans_v=Signal(4f0), position=Vec3f0(4.),
        lookat=Vec3f0(0.), up=Vec3f0(0., 0., 1.)
    ])

Sets up and returns a custom perspective camera. Mostly used for more sane
control speed defaults and easier manipulation of those.
"""
function camera(
        window::GLWindow.Screen;
        rot_v::Signal{Float32}=Signal(0.01f0),
        trans_v::Signal{Float32}=Signal(4f0),
        position::Vec3f0 = Vec3f0(4),
        lookat::Vec3f0 = Vec3f0(0),
        up::Vec3f0=Vec3f0(0., 0., 1.)
    )

    keep = map((a, b) -> !a && b, window.hidden, window.inputs[:mouseinside])
    theta, trans = default_camera_control(
        window.inputs, rot_v, trans_v, keep
    )

    lookat, eyepos, up = Signal(lookat), Signal(position), Signal(up)
    farclip = map(eyepos, lookat) do a,b
        max(norm(b-a) * 5f0, 30f0)
    end
    minclip = map(eyepos, lookat) do a,b
        norm(b-a) * 0.007f0
    end

    PerspectiveCamera(
        theta,
        trans,
        lookat,
        eyepos,
        up,
        window.inputs[:window_area],
        Signal(41f0), # Field of View
        Signal(0.001f0),  # Min distance (clip distance)
        farclip # Max distance (clip distance)
    )
end


text:
# a() is some operation
a() = sum(i for i in 1:100000)

# b is the Task of
b = Task(a)

# shows the current task
current_task()

# Query if the specified is done
println("Is the task done yet?:", istaskdone(b))

schedule(b)

yield()

result = istaskdone(b)
println("Is the task done?:", result)

max_stars_repo_name: ryanorsinger/JuliaPlayground

max_issues_repo_name: ryanorsinger/JuliaPlayground

max_forks_repo_name: ryanorsinger/JuliaPlayground


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

@test integrate((e*cot(c+d*x))^5//2*(a+a*cot(c+d*x)), x) == :(-2//5*a*d^-1*(e*cot(c+d*x))^5//2+2*a*d^-1*e^2*(e*cot(c+d*x))^(1/2)+-2//3*a*e*d^-1*(e*cot(c+d*x))^3//2+-1*a*2^(1/2)*d^-1*e^5//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^3//2*(a+a*cot(c+d*x)), x) == :(-2//3*a*d^-1*(e*cot(c+d*x))^3//2+-2*a*e*d^-1*(e*cot(c+d*x))^(1/2)+-1*a*2^(1/2)*d^-1*e^3//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x)), x) == :(-2*a*d^-1*(e*cot(c+d*x))^(1/2)+a*2^(1/2)*d^-1*e^(1/2)*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x)), x) == :(a*2^(1/2)*d^-1*e^-1//2*arctan((1/2)*2^(1/2)*e^(1/2)*(e*cot(c+d*x))^-1//2*(1+-1*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x)), x) == :(2*a*d^-1*e^-1*(e*cot(c+d*x))^-1//2+-1*a*2^(1/2)*d^-1*e^-3//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-5//2*(a+a*cot(c+d*x)), x) == :(2*a*d^-1*e^-2*(e*cot(c+d*x))^-1//2+2//3*a*d^-1*e^-1*(e*cot(c+d*x))^-3//2+-1*a*2^(1/2)*d^-1*e^-5//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^5//2*(a+a*cot(c+d*x))^2, x) == :(-4//5*a^2*d^-1*(e*cot(c+d*x))^5//2+4*a^2*d^-1*e^2*(e*cot(c+d*x))^(1/2)+-2//7*a^2*d^-1*e^-1*(e*cot(c+d*x))^7//2+2^(1/2)*a^2*d^-1*e^5//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^5//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1*2^(1/2)*a^2*d^-1*e^5//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^5//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^3//2*(a+a*cot(c+d*x))^2, x) == :(-4//3*a^2*d^-1*(e*cot(c+d*x))^3//2+-2//5*a^2*d^-1*e^-1*(e*cot(c+d*x))^5//2+2^(1/2)*a^2*d^-1*e^3//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^3//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1*2^(1/2)*a^2*d^-1*e^3//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^3//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^2, x) == :(-4*a^2*d^-1*(e*cot(c+d*x))^(1/2)+-2//3*a^2*d^-1*e^-1*(e*cot(c+d*x))^3//2+2^(1/2)*a^2*d^-1*e^(1/2)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^(1/2)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1*2^(1/2)*a^2*d^-1*e^(1/2)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^(1/2)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x))^2, x) == :(-2*a^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)+2^(1/2)*a^2*d^-1*e^-1//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^-1//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1*2^(1/2)*a^2*d^-1*e^-1//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^-1//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x))^2, x) == :(2*a^2*d^-1*e^-1*(e*cot(c+d*x))^-1//2+2^(1/2)*a^2*d^-1*e^-3//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^-3//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1*2^(1/2)*a^2*d^-1*e^-3//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^-3//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-5//2*(a+a*cot(c+d*x))^2, x) == :(4*a^2*d^-1*e^-2*(e*cot(c+d*x))^-1//2+2//3*a^2*d^-1*e^-1*(e*cot(c+d*x))^-3//2+2^(1/2)*a^2*d^-1*e^-5//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^-5//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1*2^(1/2)*a^2*d^-1*e^-5//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^-5//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-7//2*(a+a*cot(c+d*x))^2, x) == :(2//5*a^2*d^-1*e^-1*(e*cot(c+d*x))^-5//2+4//3*a^2*d^-1*e^-2*(e*cot(c+d*x))^-3//2+2^(1/2)*a^2*d^-1*e^-7//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^2*d^-1*e^-7//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1*2^(1/2)*a^2*d^-1*e^-7//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^2*d^-1*e^-7//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^5//2*(a+a*cot(c+d*x))^3, x) == :(-4//5*a^3*d^-1*(e*cot(c+d*x))^5//2+4*a^3*d^-1*e^2*(e*cot(c+d*x))^(1/2)+-40//63*a^3*d^-1*e^-1*(e*cot(c+d*x))^7//2+-2//9*d^-1*e^-1*(e*cot(c+d*x))^7//2*(a^3+a^3*cot(c+d*x))+4//3*e*a^3*d^-1*(e*cot(c+d*x))^3//2+2*2^(1/2)*a^3*d^-1*e^5//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^3//2*(a+a*cot(c+d*x))^3, x) == :(-4//3*a^3*d^-1*(e*cot(c+d*x))^3//2+4*e*a^3*d^-1*(e*cot(c+d*x))^(1/2)+-32//35*a^3*d^-1*e^-1*(e*cot(c+d*x))^5//2+-2//7*d^-1*e^-1*(e*cot(c+d*x))^5//2*(a^3+a^3*cot(c+d*x))+-2*2^(1/2)*a^3*d^-1*e^3//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^3, x) == :(-4*a^3*d^-1*(e*cot(c+d*x))^(1/2)+-8//5*a^3*d^-1*e^-1*(e*cot(c+d*x))^3//2+-2//5*d^-1*e^-1*(e*cot(c+d*x))^3//2*(a^3+a^3*cot(c+d*x))+-2*2^(1/2)*a^3*d^-1*e^(1/2)*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x))^3, x) == :(-16//3*a^3*d^-1*e^-1*(e*cot(c+d*x))^(1/2)+-2//3*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a^3+a^3*cot(c+d*x))+2*2^(1/2)*a^3*d^-1*e^-1//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x))^3, x) == :(d^-1*e^-1*(e*cot(c+d*x))^-1//2*(2*a^3+2*a^3*cot(c+d*x))+-4*a^3*d^-1*e^-2*(e*cot(c+d*x))^(1/2)+2*2^(1/2)*a^3*d^-1*e^-3//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-5//2*(a+a*cot(c+d*x))^3, x) == :(1//3*d^-1*e^-1*(e*cot(c+d*x))^-3//2*(2*a^3+2*a^3*cot(c+d*x))+16//3*a^3*d^-1*e^-2*(e*cot(c+d*x))^-1//2+-2*2^(1/2)*a^3*d^-1*e^-5//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-7//2*(a+a*cot(c+d*x))^3, x) == :(4*a^3*d^-1*e^-3*(e*cot(c+d*x))^-1//2+1//5*d^-1*e^-1*(e*cot(c+d*x))^-5//2*(2*a^3+2*a^3*cot(c+d*x))+8//5*a^3*d^-1*e^-2*(e*cot(c+d*x))^-3//2+-2*2^(1/2)*a^3*d^-1*e^-7//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-9//2*(a+a*cot(c+d*x))^3, x) == :(-4*a^3*d^-1*e^-4*(e*cot(c+d*x))^-1//2+1//7*d^-1*e^-1*(e*cot(c+d*x))^-7//2*(2*a^3+2*a^3*cot(c+d*x))+4//3*a^3*d^-1*e^-3*(e*cot(c+d*x))^-3//2+32//35*a^3*d^-1*e^-2*(e*cot(c+d*x))^-5//2+2*2^(1/2)*a^3*d^-1*e^-9//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^5//2*(a+a*cot(c+d*x))^-1, x) == :(a^-1*d^-1*e^5//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-2*a^-1*d^-1*e^2*(e*cot(c+d*x))^(1/2)+-1//2*2^(1/2)*a^-1*d^-1*e^5//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^3//2*(a+a*cot(c+d*x))^-1, x) == :(-1*a^-1*d^-1*e^3//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^-1*d^-1*e^3//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-1, x) == :(a^-1*d^-1*e^(1/2)*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*2^(1/2)*a^-1*d^-1*e^(1/2)*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x))^-1, x) == :(-1*a^-1*d^-1*e^-1//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*a^-1*d^-1*e^-1//2*arctanh((1/2)*2^(1/2)*e^(1/2)*(e*cot(c+d*x))^-1//2*(1+cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x))^-1, x) == :(a^-1*d^-1*e^-3//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+2*a^-1*d^-1*e^-1*(e*cot(c+d*x))^-1//2+-1//2*2^(1/2)*a^-1*d^-1*e^-3//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-5//2*(a+a*cot(c+d*x))^-1, x) == :(-1*a^-1*d^-1*e^-5//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-2*a^-1*d^-1*e^-2*(e*cot(c+d*x))^-1//2+2//3*a^-1*d^-1*e^-1*(e*cot(c+d*x))^-3//2+(1/2)*2^(1/2)*a^-1*d^-1*e^-5//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^5//2*(a+a*cot(c+d*x))^-2, x) == :((1/2)*d^-1*e^2*(e*cot(c+d*x))^(1/2)*(a^2+a^2*cot(c+d*x))^-1+-3//2*a^-2*d^-1*e^5//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*a^-2*d^-1*e^5//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//8*2^(1/2)*a^-2*d^-1*e^5//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*a^-2*d^-1*e^5//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//8*2^(1/2)*a^-2*d^-1*e^5//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^3//2*(a+a*cot(c+d*x))^-2, x) == :((1/2)*a^-2*d^-1*e^3//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*e*d^-1*(e*cot(c+d*x))^(1/2)*(a^2+a^2*cot(c+d*x))^-1+-1//4*2^(1/2)*a^-2*d^-1*e^3//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//8*2^(1/2)*a^-2*d^-1*e^3//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*a^-2*d^-1*e^3//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//8*2^(1/2)*a^-2*d^-1*e^3//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-2, x) == :((1/2)*d^-1*(e*cot(c+d*x))^(1/2)*(a^2+a^2*cot(c+d*x))^-1+(1/2)*a^-2*d^-1*e^(1/2)*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*a^-2*d^-1*e^(1/2)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//8*2^(1/2)*a^-2*d^-1*e^(1/2)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*a^-2*d^-1*e^(1/2)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//8*2^(1/2)*a^-2*d^-1*e^(1/2)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x))^-2, x) == :(-3//2*a^-2*d^-1*e^-1//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a^2+a^2*cot(c+d*x))^-1+-1//4*2^(1/2)*a^-2*d^-1*e^-1//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//8*2^(1/2)*a^-2*d^-1*e^-1//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*a^-2*d^-1*e^-1//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//8*2^(1/2)*a^-2*d^-1*e^-1//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x))^-2, x) == :(-1//2*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a^2+a^2*cot(c+d*x))^-1+5//2*a^-2*d^-1*e^-1*(e*cot(c+d*x))^-1//2+5//2*a^-2*d^-1*e^-3//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*a^-2*d^-1*e^-3//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//8*2^(1/2)*a^-2*d^-1*e^-3//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*a^-2*d^-1*e^-3//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//8*2^(1/2)*a^-2*d^-1*e^-3//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-5//2*(a+a*cot(c+d*x))^-2, x) == :(-9//2*a^-2*d^-1*e^-2*(e*cot(c+d*x))^-1//2+-7//2*a^-2*d^-1*e^-5//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*d^-1*e^-1*(e*cot(c+d*x))^-3//2*(a^2+a^2*cot(c+d*x))^-1+7//6*a^-2*d^-1*e^-1*(e*cot(c+d*x))^-3//2+-1//4*2^(1/2)*a^-2*d^-1*e^-5//2*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//8*2^(1/2)*a^-2*d^-1*e^-5//2*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*a^-2*d^-1*e^-5//2*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//8*2^(1/2)*a^-2*d^-1*e^-5//2*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^5//2*(a+a*cot(c+d*x))^-3, x) == :(-1//8*a^-3*d^-1*e^5//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-5//8*a^-3*d^-1*e^2*(e*cot(c+d*x))^(1/2)*(1+cot(c+d*x))^-1+1//4*2^(1/2)*a^-3*d^-1*e^5//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x)))+1//4*a^-1*d^-1*e^2*(e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-2)
@test integrate((e*cot(c+d*x))^3//2*(a+a*cot(c+d*x))^-3, x) == :(1//8*e*d^-1*(e*cot(c+d*x))^(1/2)*(a^3+a^3*cot(c+d*x))^-1+5//8*a^-3*d^-1*e^3//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*e*a^-1*d^-1*(e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-2+1//4*2^(1/2)*a^-3*d^-1*e^3//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-3, x) == :(3//8*d^-1*(e*cot(c+d*x))^(1/2)*(a^3+a^3*cot(c+d*x))^-1+-1//8*a^-3*d^-1*e^(1/2)*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+1//4*a^-1*d^-1*(e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-2+-1//4*2^(1/2)*a^-3*d^-1*e^(1/2)*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x))^-3, x) == :(-11//8*a^-3*d^-1*e^-1//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-7//8*a^-3*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(1+cot(c+d*x))^-1+-1//4*2^(1/2)*a^-3*d^-1*e^-1//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x)))+-1//4*a^-1*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a+a*cot(c+d*x))^-2)
@test integrate((e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x))^-3, x) == :(27//8*a^-3*d^-1*e^-1*(e*cot(c+d*x))^-1//2+31//8*a^-3*d^-1*e^-3//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+-9//8*a^-3*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(1+cot(c+d*x))^-1+-1//4*a^-1*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a+a*cot(c+d*x))^-2+1//4*2^(1/2)*a^-3*d^-1*e^-3//2*arctanh((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+e^(1/2)*cot(c+d*x))))
@test integrate((e*cot(c+d*x))^-5//2*(a+a*cot(c+d*x))^-3, x) == :(-63//8*a^-3*d^-1*e^-2*(e*cot(c+d*x))^-1//2+-59//8*a^-3*d^-1*e^-5//2*arctan(e^-1//2*(e*cot(c+d*x))^(1/2))+55//24*a^-3*d^-1*e^-1*(e*cot(c+d*x))^-3//2+-11//8*a^-3*d^-1*e^-1*(e*cot(c+d*x))^-3//2*(1+cot(c+d*x))^-1+-1//4*a^-1*d^-1*e^-1*(e*cot(c+d*x))^-3//2*(a+a*cot(c+d*x))^-2+1//4*2^(1/2)*a^-3*d^-1*e^-5//2*arctan((1/2)*2^(1/2)*(e*cot(c+d*x))^-1//2*(e^(1/2)+-1*e^(1/2)*cot(c+d*x))))
@test integrate((1+cot(x))^(1/2)*cot(x)^2, x) == :(-2//3*(1+cot(x))^3//2+(1/2+(1/2)*2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+2*(1+cot(x))^(1/2)))+(1/2)*(2+2*2^(1/2))^-1//2*log(1+2^(1/2)+-1*(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x))+-1*(1/2+(1/2)*2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+-2*(1+cot(x))^(1/2)))+-1//2*(2+2*2^(1/2))^-1//2*log(1+2^(1/2)+(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x)))
@test integrate((1+cot(x))^(1/2)*cot(x), x) == :(-2*(1+cot(x))^(1/2)+(1/2+(1/2)*2^(1/2))^(1/2)*arctanh((1/2)*(1+cot(x))^-1//2*(7+5*2^(1/2))^-1//2*(4+3*2^(1/2)+(2+2^(1/2))*cot(x)))+(-1//2+(1/2)*2^(1/2))^(1/2)*arctan((1/2)*(1+cot(x))^-1//2*(-7+5*2^(1/2))^-1//2*(4+-3*2^(1/2)+(2+-1*2^(1/2))*cot(x))))
@test integrate((1+cot(x))^3//2*cot(x)^2, x) == :(2*(1+cot(x))^(1/2)+-2//5*(1+cot(x))^5//2+-1*(1+2^(1/2))^(1/2)*arctanh((1+cot(x))^-1//2*(14+10*2^(1/2))^-1//2*(3+2*2^(1/2)+(1+2^(1/2))*cot(x)))+-1*(-1+2^(1/2))^(1/2)*arctan((1+cot(x))^-1//2*(-14+10*2^(1/2))^-1//2*(3+-2*2^(1/2)+(1+-1*2^(1/2))*cot(x))))
@test integrate((1+cot(x))^3//2*cot(x), x) == :(-2*(1+cot(x))^(1/2)+-2//3*(1+cot(x))^3//2+(1+2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+2*(1+cot(x))^(1/2)))+(1/2)*(1+2^(1/2))^-1//2*log(1+2^(1/2)+(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x))+-1*(1+2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+-2*(1+cot(x))^(1/2)))+-1//2*(1+2^(1/2))^-1//2*log(1+2^(1/2)+-1*(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x)))
@test integrate((1+cot(x))^-1//2*cot(x)^2, x) == :(-2*(1+cot(x))^(1/2)+(1/2)*(1+2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+2*(1+cot(x))^(1/2)))+-1//2*(1+2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+-2*(1+cot(x))^(1/2)))+-1//4*(1+2^(1/2))^-1//2*log(1+2^(1/2)+-1*(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x))+1//4*(1+2^(1/2))^-1//2*log(1+2^(1/2)+(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x)))
@test integrate((1+cot(x))^-1//2*cot(x), x) == :((1/2)*(1+2^(1/2))^(1/2)*arctanh((1+cot(x))^-1//2*(14+10*2^(1/2))^-1//2*(3+2*2^(1/2)+(1+2^(1/2))*cot(x)))+(1/2)*(-1+2^(1/2))^(1/2)*arctan((1+cot(x))^-1//2*(-14+10*2^(1/2))^-1//2*(3+-2*2^(1/2)+(1+-1*2^(1/2))*cot(x))))
@test integrate((1+cot(x))^-3//2*cot(x)^2, x) == :((1+cot(x))^-1//2+(1/2)*(1/2+(1/2)*2^(1/2))^(1/2)*arctanh((1/2)*(1+cot(x))^-1//2*(7+5*2^(1/2))^-1//2*(4+3*2^(1/2)+(2+2^(1/2))*cot(x)))+(1/2)*(-1//2+(1/2)*2^(1/2))^(1/2)*arctan((1/2)*(1+cot(x))^-1//2*(-7+5*2^(1/2))^-1//2*(4+-3*2^(1/2)+(2+-1*2^(1/2))*cot(x))))
@test integrate((1+cot(x))^-3//2*cot(x), x) == :(-1*(1+cot(x))^-1//2+(1/2)*(1/2+(1/2)*2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+-2*(1+cot(x))^(1/2)))+-1//2*(1/2+(1/2)*2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+2*(1+cot(x))^(1/2)))+-1//4*(2+2*2^(1/2))^-1//2*log(1+2^(1/2)+-1*(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x))+1//4*(2+2*2^(1/2))^-1//2*log(1+2^(1/2)+(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x)))
@test integrate((1+cot(x))^-5//2*cot(x)^2, x) == :(-1*(1+cot(x))^-1//2+1//3*(1+cot(x))^-3//2+1//4*(1+2^(1/2))^(1/2)*arctanh((1+cot(x))^-1//2*(14+10*2^(1/2))^-1//2*(3+2*2^(1/2)+(1+2^(1/2))*cot(x)))+1//4*(-1+2^(1/2))^(1/2)*arctan((1+cot(x))^-1//2*(-14+10*2^(1/2))^-1//2*(3+-2*2^(1/2)+(1+-1*2^(1/2))*cot(x))))
@test integrate((1+cot(x))^-5//2*cot(x), x) == :(-1//3*(1+cot(x))^-3//2+-1//4*(1+2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+2*(1+cot(x))^(1/2)))+-1//8*(1+2^(1/2))^-1//2*log(1+2^(1/2)+(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x))+1//4*(1+2^(1/2))^(1/2)*arctan((-2+2*2^(1/2))^-1//2*((2+2*2^(1/2))^(1/2)+-2*(1+cot(x))^(1/2)))+1//8*(1+2^(1/2))^-1//2*log(1+2^(1/2)+-1*(1+cot(x))^(1/2)*(2+2*2^(1/2))^(1/2)+cot(x)))
@test integrate((e*cot(c+d*x))^3//2*(a+b*cot(c+d*x)), x) == :(-2//3*b*d^-1*(e*cot(c+d*x))^3//2+-2*a*e*d^-1*(e*cot(c+d*x))^(1/2)+(1/2)*2^(1/2)*d^-1*e^3//2*(a+b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^3//2*(a+b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^3//2*(a+-1b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^3//2*(a+-1b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x)), x) == :(-2*b*d^-1*(e*cot(c+d*x))^(1/2)+(1/2)*2^(1/2)*d^-1*e^(1/2)*(a+-1b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^(1/2)*(a+-1b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^(1/2)*(a+b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^(1/2)*(a+b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x)), x) == :((1/2)*2^(1/2)*d^-1*e^-1//2*(a+b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-1//2*(a+b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-1//2*(a+-1b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-1//2*(a+-1b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x)), x) == :(2*a*d^-1*e^-1*(e*cot(c+d*x))^-1//2+(1/2)*2^(1/2)*d^-1*e^-3//2*(a+-1b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-3//2*(a+-1b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-3//2*(a+b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-3//2*(a+b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-5//2*(a+b*cot(c+d*x)), x) == :(2*b*d^-1*e^-2*(e*cot(c+d*x))^-1//2+2//3*a*d^-1*e^-1*(e*cot(c+d*x))^-3//2+(1/2)*2^(1/2)*d^-1*e^-5//2*(a+b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-5//2*(a+b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-5//2*(a+-1b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-5//2*(a+-1b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^2, x) == :(-1*e*d^-1*(e*cot(c+d*x))^(1/2)*(-2*b^2+2*a^2)+-4//3*a*b*d^-1*(e*cot(c+d*x))^3//2+-2//5*b^2*d^-1*e^-1*(e*cot(c+d*x))^5//2+(1/2)*2^(1/2)*d^-1*e^3//2*(a^2+-1*b^2+2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^3//2*(a^2+-1*b^2+2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^3//2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^3//2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^2, x) == :(-4*a*b*d^-1*(e*cot(c+d*x))^(1/2)+-2//3*b^2*d^-1*e^-1*(e*cot(c+d*x))^3//2+(1/2)*2^(1/2)*d^-1*e^(1/2)*(a^2+-1*b^2+-2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^(1/2)*(a^2+-1*b^2+-2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^2, x) == :(-2*b^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)+(1/2)*2^(1/2)*d^-1*e^-1//2*(a^2+-1*b^2+2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-1//2*(a^2+-1*b^2+2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-1//2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-1//2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x))^2, x) == :(2*a^2*d^-1*e^-1*(e*cot(c+d*x))^-1//2+(1/2)*2^(1/2)*d^-1*e^-3//2*(a^2+-1*b^2+-2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-3//2*(a^2+-1*b^2+-2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-3//2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-3//2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-5//2*(a+b*cot(c+d*x))^2, x) == :(2//3*a^2*d^-1*e^-1*(e*cot(c+d*x))^-3//2+(1/2)*2^(1/2)*d^-1*e^-5//2*(a^2+-1*b^2+2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+4*a*b*d^-1*e^-2*(e*cot(c+d*x))^-1//2+-1//2*2^(1/2)*d^-1*e^-5//2*(a^2+-1*b^2+2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-5//2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-5//2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-7//2*(a+b*cot(c+d*x))^2, x) == :(-1*d^-1*e^-3*(e*cot(c+d*x))^-1//2*(-2*b^2+2*a^2)+2//5*a^2*d^-1*e^-1*(e*cot(c+d*x))^-5//2+(1/2)*2^(1/2)*d^-1*e^-7//2*(a^2+-1*b^2+-2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-7//2*(a^2+-1*b^2+-2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-7//2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-7//2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+4//3*a*b*d^-1*e^-2*(e*cot(c+d*x))^-3//2)
@test integrate((e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^3, x) == :(-2//3*b*d^-1*(e*cot(c+d*x))^3//2*(-1*b^2+3*a^2)+-2*a*e*d^-1*(e*cot(c+d*x))^(1/2)*(a^2+-3*b^2)+-32//35*a*b^2*d^-1*e^-1*(e*cot(c+d*x))^5//2+-2//7*b^2*d^-1*e^-1*(e*cot(c+d*x))^5//2*(a+b*cot(c+d*x))+(1/2)*2^(1/2)*d^-1*e^3//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^3//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^3//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^3//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^3, x) == :(-2*b*d^-1*(e*cot(c+d*x))^(1/2)*(-1*b^2+3*a^2)+-8//5*a*b^2*d^-1*e^-1*(e*cot(c+d*x))^3//2+-2//5*b^2*d^-1*e^-1*(e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))+(1/2)*2^(1/2)*d^-1*e^(1/2)*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^(1/2)*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^(1/2)*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^(1/2)*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^3, x) == :(-16//3*a*b^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)+-2//3*b^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))+(1/2)*2^(1/2)*d^-1*e^-1//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-1//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-1//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-1//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x))^3, x) == :(-2*b*d^-1*e^-2*(e*cot(c+d*x))^(1/2)*(a^2+b^2)+2*a^2*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))+(1/2)*2^(1/2)*d^-1*e^-3//2*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-3//2*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-3//2*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-3//2*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-5//2*(a+b*cot(c+d*x))^3, x) == :(2//3*a^2*d^-1*e^-1*(e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x))+16//3*b*a^2*d^-1*e^-2*(e*cot(c+d*x))^-1//2+(1/2)*2^(1/2)*d^-1*e^-5//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-5//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-5//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-5//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-7//2*(a+b*cot(c+d*x))^3, x) == :(-2*a*d^-1*e^-3*(e*cot(c+d*x))^-1//2*(a^2+-3*b^2)+2//5*a^2*d^-1*e^-1*(e*cot(c+d*x))^-5//2*(a+b*cot(c+d*x))+8//5*b*a^2*d^-1*e^-2*(e*cot(c+d*x))^-3//2+(1/2)*2^(1/2)*d^-1*e^-7//2*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-7//2*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-7//2*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-7//2*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-9//2*(a+b*cot(c+d*x))^3, x) == :(-2*b*d^-1*e^-4*(e*cot(c+d*x))^-1//2*(-1*b^2+3*a^2)+-2//3*a*d^-1*e^-3*(e*cot(c+d*x))^-3//2*(a^2+-3*b^2)+2//7*a^2*d^-1*e^-1*(e*cot(c+d*x))^-7//2*(a+b*cot(c+d*x))+32//35*b*a^2*d^-1*e^-2*(e*cot(c+d*x))^-5//2+(1/2)*2^(1/2)*d^-1*e^-9//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-9//2*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-9//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-9//2*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^5//2*(a+b*cot(c+d*x))^-1, x) == :(-2*b^-1*d^-1*e^2*(e*cot(c+d*x))^(1/2)+(1/2)*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-1*(a+b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+2*a^5//2*b^-3//2*d^-1*e^5//2*(a^2+b^2)^-1*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-1*(a+b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-1*(a+-1b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-1*(a+-1b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^-1, x) == :((1/2)*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-1*(a+-1b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-2*a^3//2*b^-1//2*d^-1*e^3//2*(a^2+b^2)^-1*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-1*(a+-1b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-1*(a+b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-1*(a+b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1, x) == :((1/2)*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-1*(a+b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+2*a^(1/2)*b^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-1*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-1*(a+b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-1*(a+-1b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-1*(a+-1b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^-1, x) == :((1/2)*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-1*(a+-1b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-2*a^-1//2*b^3//2*d^-1*e^-1//2*(a^2+b^2)^-1*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-1*(a+-1b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-1*(a+b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-1*(a+b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x))^-1, x) == :(2*a^-1*d^-1*e^-1*(e*cot(c+d*x))^-1//2+(1/2)*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-1*(a+b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+2*a^-3//2*b^5//2*d^-1*e^-3//2*(a^2+b^2)^-1*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-1*(a+b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-1*(a+-1b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-1*(a+-1b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-5//2*(a+b*cot(c+d*x))^-1, x) == :(2//3*a^-1*d^-1*e^-1*(e*cot(c+d*x))^-3//2+-2*b*a^-2*d^-1*e^-2*(e*cot(c+d*x))^-1//2+(1/2)*2^(1/2)*d^-1*e^-5//2*(a^2+b^2)^-1*(a+-1b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-2*a^-5//2*b^7//2*d^-1*e^-5//2*(a^2+b^2)^-1*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-5//2*(a^2+b^2)^-1*(a+-1b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-5//2*(a^2+b^2)^-1*(a+b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-5//2*(a^2+b^2)^-1*(a+b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^7//2*(a+b*cot(c+d*x))^-2, x) == :((1/2)*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1*b^-2*d^-1*e^3*(e*cot(c+d*x))^(1/2)*(a^2+b^2)^-1*(2*b^2+3*a^2)+-1//2*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+a^2*b^-1*d^-1*e^2*(e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1+a^5//2*b^-5//2*d^-1*e^7//2*(a^2+b^2)^-2*(3*a^2+7*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^5//2*(a+b*cot(c+d*x))^-2, x) == :((1/2)*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+a^2*b^-1*d^-1*e^2*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1+-1*a^3//2*b^-3//2*d^-1*e^5//2*(a^2+b^2)^-2*(a^2+5*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^-2, x) == :((1/2)*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1*a*e*d^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1+-1//2*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1*a^(1/2)*b^-1//2*d^-1*e^3//2*(a^2+b^2)^-2*(a^2+-3*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-2, x) == :(b*d^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1+(1/2)*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+a^-1//2*b^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-2*(-1*b^2+3*a^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^-2, x) == :((1/2)*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1*a^-1*b^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1+-1*a^-3//2*b^3//2*d^-1*e^-1//2*(a^2+b^2)^-2*(b^2+5*a^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x))^-2, x) == :(a^-2*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a^2+b^2)^-1*(2*a^2+3*b^2)+(1/2)*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-2*(a^2+-1*b^2+2*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-2*(a^2+-1*b^2+-2*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+a^-5//2*b^5//2*d^-1*e^-3//2*(a^2+b^2)^-2*(3*b^2+7*a^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1*a^-1*b^2*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1)
@test integrate((e*cot(c+d*x))^9//2*(a+b*cot(c+d*x))^-3, x) == :(-1//4*b^-3*d^-1*e^4*(e*cot(c+d*x))^(1/2)*(a^2+b^2)^-2*(8*b^4+15*a^4+31*a^2*b^2)+(1/2)*2^(1/2)*d^-1*e^9//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*a^2*b^-1*d^-1*e^2*(e*cot(c+d*x))^5//2*(a+b*cot(c+d*x))^-2*(a^2+b^2)^-1+-1//2*2^(1/2)*d^-1*e^9//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^9//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^9//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*a^5//2*b^-7//2*d^-1*e^9//2*(a^2+b^2)^-3*(15*a^4+63*b^4+46*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//4*a^2*b^-2*d^-1*e^3*(e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(5*a^2+13*b^2))
@test integrate((e*cot(c+d*x))^7//2*(a+b*cot(c+d*x))^-3, x) == :((1/2)*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*a^2*b^-1*d^-1*e^2*(e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^-2*(a^2+b^2)^-1+-1//2*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1//4*a^3//2*b^-5//2*d^-1*e^7//2*(a^2+b^2)^-3*(3*a^4+35*b^4+6*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^7//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*a^2*b^-2*d^-1*e^3*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(3*a^2+11*b^2))
@test integrate((e*cot(c+d*x))^5//2*(a+b*cot(c+d*x))^-3, x) == :((1/2)*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+(1/2)*a^2*b^-1*d^-1*e^2*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-2*(a^2+b^2)^-1+-1//2*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1//4*a^(1/2)*b^-3//2*d^-1*e^5//2*(a^2+b^2)^-3*(a^4+-15*b^4+18*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^5//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1//4*a*b^-1*d^-1*e^2*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(a^2+9*b^2))
@test integrate((e*cot(c+d*x))^3//2*(a+b*cot(c+d*x))^-3, x) == :(-1*a*e*d^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-2*(2*a^2+2*b^2)^-1+-1//4*e*d^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(-5*b^2+3*a^2)+(1/2)*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1//4*a^-1//2*b^-1//2*d^-1*e^3//2*(a^2+b^2)^-3*(3*a^4+3*b^4+-26*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^3//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x)))
@test integrate((e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-3, x) == :(b*d^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-2*(2*a^2+2*b^2)^-1+(1/2)*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*b*a^-1*d^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(-1*b^2+7*a^2)+1//4*2^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*a^-3//2*b^(1/2)*d^-1*e^(1/2)*(a^2+b^2)^-3*(-1*b^4+15*a^4+-18*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2)))
@test integrate((e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^-3, x) == :((1/2)*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*a^-1*b^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-2*(a^2+b^2)^-1+-1//4*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+-1//4*a^-5//2*b^3//2*d^-1*e^-1//2*(a^2+b^2)^-3*(3*b^4+35*a^4+6*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+1//4*2^(1/2)*d^-1*e^-1//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+-1//4*a^-2*b^2*d^-1*e^-1*(e*cot(c+d*x))^(1/2)*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(3*b^2+11*a^2))
@test integrate((e*cot(c+d*x))^-3//2*(a+b*cot(c+d*x))^-3, x) == :(1//4*a^-3*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a^2+b^2)^-2*(8*a^4+15*b^4+31*a^2*b^2)+(1/2)*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-3*(a+-1b)*(a^2+b^2+4*a*b)*arctan(1+-1*2^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//2*a^-1*b^2*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^-2*(a^2+b^2)^-1+-1//4*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+2^(1/2)*(e*cot(c+d*x))^(1/2)+e^(1/2)*cot(c+d*x))+1//4*2^(1/2)*d^-1*e^-3//2*(a^2+b^2)^-3*(a+b)*(a^2+b^2+-4*a*b)*log(e^(1/2)+e^(1/2)*cot(c+d*x)+-1*2^(1/2)*(e*cot(c+d*x))^(1/2))+1//4*a^-7//2*b^5//2*d^-1*e^-3//2*(a^2+b^2)^-3*(15*b^4+63*a^4+46*a^2*b^2)*arctan(a^-1//2*b^(1/2)*e^-1//2*(e*cot(c+d*x))^(1/2))+-1//4*a^-2*b^2*d^-1*e^-1*(e*cot(c+d*x))^-1//2*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(5*b^2+13*a^2))
@test integrate((a+b*cot(c+d*x))^-1//2*(1+im*cot(c+d*x)), x) == :(2*im*d^-1*(a+-1*im*b)^-1//2*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2))
@test integrate((a+b*cot(c+d*x))^-1//2*(1+-1*im*cot(c+d*x)), x) == :(-2*im*d^-1*(a+im*b)^-1//2*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^-1*(A+B*cot(c+d*x)), x) == :(x*(a^2+b^2)^-1*(A*a+B*b)+-1*d^-1*(a^2+b^2)^-1*(A*b+-1*B*a)*log(a*sin(c+d*x)+b*cos(c+d*x)))
@test integrate((a+b*cot(c+d*x))^-2*(A+B*cot(c+d*x)), x) == :(x*(a^2+b^2)^-2*(A*a^2+-1*A*b^2+2*B*a*b)+d^-1*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-1*(A*b+-1*B*a)+-1*d^-1*(a^2+b^2)^-2*(B*b^2+-1*B*a^2+2*A*a*b)*log(a*sin(c+d*x)+b*cos(c+d*x)))
@test integrate((a+b*cot(c+d*x))^-3*(A+B*cot(c+d*x)), x) == :(x*(a^2+b^2)^-3*(A*a^3+-1*B*b^3+-3*A*a*b^2+3*B*b*a^2)+d^-1*(a+b*cot(c+d*x))^-1*(a^2+b^2)^-2*(B*b^2+-1*B*a^2+2*A*a*b)+d^-1*(a+b*cot(c+d*x))^-2*(2*a^2+2*b^2)^-1*(A*b+-1*B*a)+-1*d^-1*(a^2+b^2)^-3*(-1*A*b^3+-1*B*a^3+3*A*b*a^2+3*B*a*b^2)*log(a*sin(c+d*x)+b*cos(c+d*x)))
@test integrate((a+b*cot(c+d*x))^5//2*(A+B*cot(c+d*x)), x) == :(-1*d^-1*(a+b*cot(c+d*x))^(1/2)*(-2*B*b^2+2*B*a^2+4*A*a*b)+-2//5*B*d^-1*(a+b*cot(c+d*x))^5//2+-1//3*d^-1*(a+b*cot(c+d*x))^3//2*(2*A*b+2*B*a)+d^-1*(a+-1*im*b)^5//2*(B+im*A)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-1*d^-1*(a+im*b)^5//2*(-1B+im*A)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^3//2*(A+B*cot(c+d*x)), x) == :(-1*d^-1*(a+b*cot(c+d*x))^(1/2)*(2*A*b+2*B*a)+-2//3*B*d^-1*(a+b*cot(c+d*x))^3//2+d^-1*(a+-1*im*b)^3//2*(B+im*A)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-1*d^-1*(a+im*b)^3//2*(-1B+im*A)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^(1/2)*(A+B*cot(c+d*x)), x) == :(-2*B*d^-1*(a+b*cot(c+d*x))^(1/2)+d^-1*(a+-1*im*b)^(1/2)*(B+im*A)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-1*d^-1*(a+im*b)^(1/2)*(-1B+im*A)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^5//2*(-1a+b*cot(c+d*x)), x) == :(-2//5*b*d^-1*(a+b*cot(c+d*x))^5//2+d^-1*(a+im*b)^5//2*(b+im*a)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2))+-1*d^-1*(a+-1*im*b)^5//2*(-1b+im*a)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+2*b*d^-1*(a+b*cot(c+d*x))^(1/2)*(a^2+b^2))
@test integrate((a+b*cot(c+d*x))^3//2*(-1a+b*cot(c+d*x)), x) == :(-2//3*b*d^-1*(a+b*cot(c+d*x))^3//2+(1/2)*b*2^(1/2)*d^-1*(a+-1*(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)*arctanh((a+-1*(a^2+b^2)^(1/2))^-1//2*((a+(a^2+b^2)^(1/2))^(1/2)+-1*2^(1/2)*(a+b*cot(c+d*x))^(1/2)))+-1//2*b*2^(1/2)*d^-1*(a+-1*(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)*arctanh((a+-1*(a^2+b^2)^(1/2))^-1//2*((a+(a^2+b^2)^(1/2))^(1/2)+2^(1/2)*(a+b*cot(c+d*x))^(1/2)))+-1//4*b*2^(1/2)*d^-1*(a+(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)*log(a+(a^2+b^2)^(1/2)+b*cot(c+d*x)+2^(1/2)*(a+(a^2+b^2)^(1/2))^(1/2)*(a+b*cot(c+d*x))^(1/2))+1//4*b*2^(1/2)*d^-1*(a+(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)*log(a+(a^2+b^2)^(1/2)+b*cot(c+d*x)+-1*2^(1/2)*(a+(a^2+b^2)^(1/2))^(1/2)*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^(1/2)*(-1a+b*cot(c+d*x)), x) == :(-2*b*d^-1*(a+b*cot(c+d*x))^(1/2)+(1/2)*b*2^(1/2)*d^-1*(a+-1*(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)^(1/2)*arctanh((a+-1*(a^2+b^2)^(1/2))^-1//2*((a+(a^2+b^2)^(1/2))^(1/2)+-1*2^(1/2)*(a+b*cot(c+d*x))^(1/2)))+-1//2*b*2^(1/2)*d^-1*(a+-1*(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)^(1/2)*arctanh((a+-1*(a^2+b^2)^(1/2))^-1//2*((a+(a^2+b^2)^(1/2))^(1/2)+2^(1/2)*(a+b*cot(c+d*x))^(1/2)))+-1//4*b*2^(1/2)*d^-1*(a+(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)^(1/2)*log(a+(a^2+b^2)^(1/2)+b*cot(c+d*x)+-1*2^(1/2)*(a+(a^2+b^2)^(1/2))^(1/2)*(a+b*cot(c+d*x))^(1/2))+1//4*b*2^(1/2)*d^-1*(a+(a^2+b^2)^(1/2))^-1//2*(a^2+b^2)^(1/2)*log(a+(a^2+b^2)^(1/2)+b*cot(c+d*x)+2^(1/2)*(a+(a^2+b^2)^(1/2))^(1/2)*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^-1//2*(A+B*cot(c+d*x)), x) == :(d^-1*(a+-1*im*b)^-1//2*(B+im*A)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-1*d^-1*(a+im*b)^-1//2*(-1B+im*A)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^-3//2*(A+B*cot(c+d*x)), x) == :(d^-1*(a+b*cot(c+d*x))^-1//2*(a^2+b^2)^-1*(-2*B*a+2*A*b)+d^-1*(a+-1*im*b)^-3//2*(B+im*A)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-1*d^-1*(a+im*b)^-3//2*(-1B+im*A)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^-5//2*(A+B*cot(c+d*x)), x) == :(d^-1*(a+b*cot(c+d*x))^-3//2*(3*a^2+3*b^2)^-1*(-2*B*a+2*A*b)+d^-1*(a+b*cot(c+d*x))^-1//2*(a^2+b^2)^-2*(-2*B*a^2+2*B*b^2+4*A*a*b)+d^-1*(a+-1*im*b)^-5//2*(B+im*A)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-1*d^-1*(a+im*b)^-5//2*(-1B+im*A)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2)))
@test integrate((a+b*cot(c+d*x))^-1//2*(-1a+b*cot(c+d*x)), x) == :(d^-1*(a+im*b)^-1//2*(b+im*a)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2))+-1*d^-1*(a+-1*im*b)^-1//2*(-1b+im*a)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2))
@test integrate((a+b*cot(c+d*x))^-3//2*(-1a+b*cot(c+d*x)), x) == :(d^-1*(a+im*b)^-3//2*(b+im*a)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2))+-1*d^-1*(a+-1*im*b)^-3//2*(-1b+im*a)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-4*a*b*d^-1*(a+b*cot(c+d*x))^-1//2*(a^2+b^2)^-1)
@test integrate((a+b*cot(c+d*x))^-5//2*(-1a+b*cot(c+d*x)), x) == :(d^-1*(a+im*b)^-5//2*(b+im*a)*arctanh((a+im*b)^-1//2*(a+b*cot(c+d*x))^(1/2))+-1*d^-1*(a+-1*im*b)^-5//2*(-1b+im*a)*arctanh((a+b*cot(c+d*x))^(1/2)*(a+-1*im*b)^-1//2)+-4*a*b*d^-1*(a+b*cot(c+d*x))^-3//2*(3*a^2+3*b^2)^-1+-2*b*d^-1*(a+b*cot(c+d*x))^-1//2*(a^2+b^2)^-2*(-1*b^2+3*a^2))

max_stars_repo_path: test/4 Trig functions/4.4 Cotangent/4.4.2.1 (a+b cot)^m (c+d cot)^n.jl


text:
module DepParser

using Merlin
using ProgressMeter
using HDF5

include("decoder.jl")
include("nn.jl")

end