text:
"""
    parse_nested(s::AbstractString (, iy = []))

return a contraction-tree consisting of `NestedEinsum`
objects as nodes and `IndexGroup` as leaves.
`s` should only contain the `ixs` part
"""

function parse_nested(s::AbstractString, iy = [])
    count(==('('),s) == count(==(')'),s) || throw(
        ArgumentError("Parentheses don't pair up in $s"))

    _, out = parse_parens(s, firstindex(s), 1)
    append!(out.iy, iy)
    filliys!(out)
    return stabilize(out)
end

"""
    parse_parens(s::AbstractString, i, narg)

parse one level of parens starting at index `i` where `narg` counts which tensor the
current group of indices, e.g. "ijk", belongs to.
Recursively calls itself for each new opening paren that's opened.
"""
function parse_parens(s::AbstractString, i, narg)
    out = NestedEinsum{Char}([], [], [])
    g = IndexGroup{Char}([],narg)

    while i <= lastindex(s)
        c = s[i]
        j = nextind(s,i)
        if c === '('
            # opening a parens means that next a new contraction is parsed
            j, out2, narg = parse_parens(s, j, narg)
            push!(out, out2)
            union!(out.inds, out2.inds)
        elseif c === ')' || c === ','
            # either closing a parens or a comma means that a tensors indices
            # are complete and can be added to the contraction-object
            if !isempty(g)
                push!(out, g)
                union!(out.inds, g.inds)
            end
            if  c === ','
                # comma implies that a new tensor is parsed for the current contraction
                narg += 1
                g = IndexGroup{Char}([], narg)
            else
                # parens implies that the current contraction is complete
                return j, out, narg
            end
        elseif isletter(c) # could allow isnumeric() too
            push!(g,c)
        else
            throw(ArgumentError("parsing $s failed, $c is not a valid entry"))
        end
        i = j
    end
    if !isempty(g)
        push!(out, g)
        union!(out.inds, g.inds)
    end
    return i, out
end

"""
    filliys!(neinsum::NestedEinsum)

goes through all `NestedEinsum` objects in the tree and saves the correct `iy` in them.
"""
function filliys!(neinsum)
    iy = neinsum.iy
    args = neinsum.args
    for i in 1:length(neinsum.args)
        arg = args[i]
        arg isa IndexGroup && continue
        union!(arg.iy, intersect(arg.inds, iy))
        for j in 1:length(neinsum.args)
            i === j && continue
            union!(arg.iy, intersect(arg.inds, args[j].inds))
        end
        filliys!(arg)
    end
    return neinsum
end

"""
    IndexGroup

Leaf in a contractiontree, contains the indices and the number of the tensor it
describes, e.g. in "ij,jk -> ik", indices "ik" belong to tensor `1`, so
would be described by IndexGroup(['i','k'], 1).
"""
struct IndexGroup{T}
    inds::Vector{T}
    n::Int
end

Base.push!(ig::IndexGroup, c) = (push!(ig.inds,c); ig)
Base.isempty(ig::IndexGroup) = isempty(ig.inds)

"""
    NestedEinsum

describes a (potentially) nested einsum. Important fields:
- `args`, vector of all inputs, either `IndexGroup` objects corresponding to tensors or `NestedEinsum`
- `iy`, indices of output
"""
struct NestedEinsum{T}
    args::Vector{Union{NestedEinsum{T}, IndexGroup{T}}}
    inds::Vector{T}
    iy::Vector{T}
end

Base.push!(neinsum::NestedEinsum, x) = (push!(neinsum.args,x); neinsum)

using MacroTools

function _nested_ein_macro(ex; einsum=:einsum)
    @capture(ex, (left_ := right_)) || throw(ArgumentError("expected A[] := B[]... "))
    @capture(left, Z_[leftind__] | [leftind__] ) || throw(
        ArgumentError("can't understand LHS, expected A[i,j] etc."))
    Z === nothing && @gensym Z
    primefix!(leftind)
    allinds = unique(leftind)

    MacroTools.postwalk(right) do x
        @capture(x, A_[inds__]) && union!(allinds, inds)
        x
    end
    primefix!(allinds)

    tensors = Symbol[]
    nein = parse_nested_expr(right, tensors, allinds)
    append!(nein.iy, indexin(leftind,allinds))
    filliys!(nein)
    snein = stabilize(nein)

    tensornames = map(esc, tensors)
    :($(esc(Z)) = $snein(($(tensornames...),)...))
end

function parse_nested_expr(expr, tensors, allinds)
    if @capture(expr, *(args__))
        einargs = map(x -> parse_nested_expr(x,tensors, allinds), args)
        intinds = union(mapreduce(x -> x.inds, vcat, einargs))
        return NestedEinsum{Int}(einargs, intinds, Int[])
    elseif @capture(expr, A_[inds__])
        push!(tensors,A)
        return IndexGroup{Int}(indexin(primefix!(inds), allinds), length(tensors))
    end
end

"""
apply a NestedEinsum to arguments evaluates the nested einsum
"""
function (neinsum::NestedEinsum)(xs...; size_dict = nothing)
    ixs = Tuple(map(extractixs, neinsum.args))
    iy = Tuple(neinsum.iy)
    EinCode(ixs,iy)(map(arg -> extractxs(xs, arg), neinsum.args)...)
end

"""
extract the indices of the tensor that is associated with x (if x isa IndexGroup)
or results from x (if x isa NestedEinsum)
"""
extractixs(x::IndexGroup) = Tuple(x.inds)
extractixs(x::NestedEinsum) = Tuple(x.iy)

"""
extract the tensor associated with x (if x isa IndexGroup)
or evaluate and return the tensor associated with x (if x isa NestedEinsum)
"""
extractxs(xs, x::NestedEinsum) = x(xs...)
extractxs(xs, x::IndexGroup) = xs[x.n]

struct NestedEinsumStable{T,S,N}
    args::S
    eins::T
end

@doc raw"
    stabilize(nein::NestedEinsum)

turn the nested einsum into a `NestedEinsumStable` which is type-stable and
more performant.
"
function stabilize(nein::OMEinsum.NestedEinsum)
    ixs = Tuple(map(OMEinsum.extractixs, nein.args))
    iy = Tuple(nein.iy)
    eins = EinCode{ixs,iy}()
    args = Tuple(map(x -> x isa OMEinsum.NestedEinsum ? stabilize(x) : x.n,nein.args))
    return NestedEinsumStable{typeof(eins), typeof(args), length(iy)}(args, eins)
end

function (neinsum::NestedEinsumStable{<:Any,<:Any,N})(xs...; size_dict = nothing) where N
    mxs = map(x -> extractxs(xs, x), neinsum.args)
    neinsum.eins(mxs...)
end

extractxs(xs, x::NestedEinsumStable) = x(xs...)
extractxs(xs, i::Int) = xs[i]

function match_rule(code::NestedEinsumStable)
    return (match_rule(code.eins), match_rule.(code.args))
end

match_rule(code::Int64) = code


text:
#find row based on the code, to improve this function
# and the find_column could do a hi_lo funtion
# and then call that for both find_row and find_column

function find_row(code)
  row_code = code[1:7]
  lo_n = 0
  hi_n = 127

  count = 1

  for i in row_code
     #find the bounds of the range depending if we can the upper or lower half
     if i =='F'
        hi_n = lo_n + div(hi_n+1 - lo_n,2) - 1
        if count == 7
           return hi_n
        end
     else
        lo_n = lo_n + div(hi_n+1 - lo_n,2)
        if count == 7
           return lo_n
        end
     end

    count += 1

  end

  return 1
end

function find_column(code)
  col_code = code[8:end]

  lo_n = 0
  hi_n = 7

  count = 1

  for i in col_code

     if i =='L'
        hi_n = lo_n + div(hi_n+1 - lo_n,2) - 1
        if count == 3
           return hi_n
        end
     else
        lo_n = lo_n + div(hi_n+1 - lo_n,2)
        if count == 3
           return lo_n
        end
     end

    count += 1

  end

  return 1
end

function create_ids()

  ids = zeros(Int, 128, 8)

  for r = 0:127
      for c = 0:7
          ids[r+1,c+1] = r*8 + c
      end
  end

  return ids
end

using DelimitedFiles

# reading the input
data = readdlm("input_day5")

#get all ids from r: 0-127 and c: 0-7
#also store corresponding r and c
all_ids = create_ids()

#get ids from the inputs
for temp_code in data
   r = find_row(temp_code)
   c = find_column(temp_code)

   #calculate id
   id = r*8 + c

   #find if id is in array with all the ids
   #if so change that entry with a 0
   loc = findfirst(isequal(id),all_ids)
   global  all_ids[loc[1],loc[2]] = 0

end

#print ids that are not a 0
for r = 0:127
    for c = 0:7
       if all_ids[r+1,c+1] != 0
          println("r: "*string(r)*" c: "*string(c))
          println(all_ids[r+1,c+1])
       end
    end
end

ext: jl


text:
@testset "1.2.2.6 P(x) (d x)^m (a+b x^2+c x^4)^p" begin
    (A, B, C, a, b, c, d, e, f, g, m, p, x, ) = @variables A B C a b c d e f g m p x

    #= ::Package:: =#

    #= ::Title:: =#
    #=Integrands*of*the*form*P(x)*(d*x)^m*(a+b*x^2+c*x^4)^p=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*P(x)*(d*x)^m*(a+b*x^2+c*x^4)^p=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P2(x)*x^m*(a+b*x^2+c*x^4)^p=#

    #= ::Subsubsection::Closed:: =#
    #=p>0=#

    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)*x^2, x, 2, (1/3)*a*A*x^3 + (1/4)*a*B*x^4 + (1/5)*(A*b + a*C)*x^5 + (1/6)*b*B*x^6 + (1/7)*(A*c + b*C)*x^7 + (1/8)*B*c*x^8 + (1/9)*c*C*x^9]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)*x^1, x, 2, (1/2)*a*A*x^2 + (1/3)*a*B*x^3 + (1/4)*(A*b + a*C)*x^4 + (1/5)*b*B*x^5 + (1/6)*(A*c + b*C)*x^6 + (1/7)*B*c*x^7 + (1/8)*c*C*x^8]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)*x^0, x, 2, a*A*x + (1/2)*a*B*x^2 + (1/3)*(A*b + a*C)*x^3 + (1/4)*b*B*x^4 + (1/5)*(A*c + b*C)*x^5 + (1/6)*B*c*x^6 + (1/7)*c*C*x^7]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^1, x, 2, a*B*x + (1/2)*(A*b + a*C)*x^2 + (1/3)*b*B*x^3 + (1/4)*(A*c + b*C)*x^4 + (1/5)*B*c*x^5 + (1/6)*c*C*x^6 + a*A*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^2, x, 2, -((a*A)/x) + (A*b + a*C)*x + (1/2)*b*B*x^2 + (1/3)*(A*c + b*C)*x^3 + (1/4)*B*c*x^4 + (1/5)*c*C*x^5 + a*B*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^3, x, 2, -((a*A)/(2*x^2)) - (a*B)/x + b*B*x + (1/2)*(A*c + b*C)*x^2 + (1/3)*B*c*x^3 + (1/4)*c*C*x^4 + (A*b + a*C)*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^4, x, 2, -((a*A)/(3*x^3)) - (a*B)/(2*x^2) - (A*b + a*C)/x + (A*c + b*C)*x + (1/2)*B*c*x^2 + (1/3)*c*C*x^3 + b*B*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^5, x, 2, -((a*A)/(4*x^4)) - (a*B)/(3*x^3) - (A*b + a*C)/(2*x^2) - (b*B)/x + B*c*x + (1/2)*c*C*x^2 + (A*c + b*C)*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^6, x, 2, -((a*A)/(5*x^5)) - (a*B)/(4*x^4) - (A*b + a*C)/(3*x^3) - (b*B)/(2*x^2) - (A*c + b*C)/x + c*C*x + B*c*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)/x^7, x, 2, -((a*A)/(6*x^6)) - (a*B)/(5*x^5) - (A*b + a*C)/(4*x^4) - (b*B)/(3*x^3) - (A*c + b*C)/(2*x^2) - (B*c)/x + c*C*log(x)]

    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2*x^2, x, 2, (1/3)*a^2*A*x^3 + (1/4)*a^2*B*x^4 + (1/5)*a*(2*A*b + a*C)*x^5 + (1/3)*a*b*B*x^6 + (1/7)*(A*(b^2 + 2*a*c) + 2*a*b*C)*x^7 + (1/8)*B*(b^2 + 2*a*c)*x^8 + (1/9)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^9 + (1/5)*b*B*c*x^10 + (1/11)*c*(A*c + 2*b*C)*x^11 + (1/12)*B*c^2*x^12 + (1/13)*c^2*C*x^13]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2*x^1, x, 2, (1/2)*a^2*A*x^2 + (1/3)*a^2*B*x^3 + (1/4)*a*(2*A*b + a*C)*x^4 + (2/5)*a*b*B*x^5 + (1/6)*(A*(b^2 + 2*a*c) + 2*a*b*C)*x^6 + (1/7)*B*(b^2 + 2*a*c)*x^7 + (1/8)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^8 + (2/9)*b*B*c*x^9 + (1/10)*c*(A*c + 2*b*C)*x^10 + (1/11)*B*c^2*x^11 + (1/12)*c^2*C*x^12]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2*x^0, x, 2, a^2*A*x + (1/2)*a^2*B*x^2 + (1/3)*a*(2*A*b + a*C)*x^3 + (1/2)*a*b*B*x^4 + (1/5)*(A*(b^2 + 2*a*c) + 2*a*b*C)*x^5 + (1/6)*B*(b^2 + 2*a*c)*x^6 + (1/7)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^7 + (1/4)*b*B*c*x^8 + (1/9)*c*(A*c + 2*b*C)*x^9 + (1/10)*B*c^2*x^10 + (1/11)*c^2*C*x^11]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^1, x, 2, a^2*B*x + (1/2)*a*(2*A*b + a*C)*x^2 + (2/3)*a*b*B*x^3 + (1/4)*(A*(b^2 + 2*a*c) + 2*a*b*C)*x^4 + (1/5)*B*(b^2 + 2*a*c)*x^5 + (1/6)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^6 + (2/7)*b*B*c*x^7 + (1/8)*c*(A*c + 2*b*C)*x^8 + (1/9)*B*c^2*x^9 + (1/10)*c^2*C*x^10 + a^2*A*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^2, x, 2, -((a^2*A)/x) + a*(2*A*b + a*C)*x + a*b*B*x^2 + (1/3)*(A*(b^2 + 2*a*c) + 2*a*b*C)*x^3 + (1/4)*B*(b^2 + 2*a*c)*x^4 + (1/5)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^5 + (1/3)*b*B*c*x^6 + (1/7)*c*(A*c + 2*b*C)*x^7 + (1/8)*B*c^2*x^8 + (1/9)*c^2*C*x^9 + a^2*B*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^3, x, 2, -((a^2*A)/(2*x^2)) - (a^2*B)/x + 2*a*b*B*x + (1/2)*(A*(b^2 + 2*a*c) + 2*a*b*C)*x^2 + (1/3)*B*(b^2 + 2*a*c)*x^3 + (1/4)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^4 + (2/5)*b*B*c*x^5 + (1/6)*c*(A*c + 2*b*C)*x^6 + (1/7)*B*c^2*x^7 + (1/8)*c^2*C*x^8 + a*(2*A*b + a*C)*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^4, x, 2, -((a^2*A)/(3*x^3)) - (a^2*B)/(2*x^2) - (a*(2*A*b + a*C))/x + (A*(b^2 + 2*a*c) + 2*a*b*C)*x + (1/2)*B*(b^2 + 2*a*c)*x^2 + (1/3)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^3 + (1/2)*b*B*c*x^4 + (1/5)*c*(A*c + 2*b*C)*x^5 + (1/6)*B*c^2*x^6 + (1/7)*c^2*C*x^7 + 2*a*b*B*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^5, x, 2, -((a^2*A)/(4*x^4)) - (a^2*B)/(3*x^3) - (a*(2*A*b + a*C))/(2*x^2) - (2*a*b*B)/x + B*(b^2 + 2*a*c)*x + (1/2)*(2*A*b*c + (b^2 + 2*a*c)*C)*x^2 + (2/3)*b*B*c*x^3 + (1/4)*c*(A*c + 2*b*C)*x^4 + (1/5)*B*c^2*x^5 + (1/6)*c^2*C*x^6 + (A*(b^2 + 2*a*c) + 2*a*b*C)*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^6, x, 2, -((a^2*A)/(5*x^5)) - (a^2*B)/(4*x^4) - (a*(2*A*b + a*C))/(3*x^3) - (a*b*B)/x^2 - (A*(b^2 + 2*a*c) + 2*a*b*C)/x + (2*A*b*c + (b^2 + 2*a*c)*C)*x + b*B*c*x^2 + (1/3)*c*(A*c + 2*b*C)*x^3 + (1/4)*B*c^2*x^4 + (1/5)*c^2*C*x^5 + B*(b^2 + 2*a*c)*log(x)]
    @test_int [(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2/x^7, x, 2, -((a^2*A)/(6*x^6)) - (a^2*B)/(5*x^5) - (a*(2*A*b + a*C))/(4*x^4) - (2*a*b*B)/(3*x^3) - (A*(b^2 + 2*a*c) + 2*a*b*C)/(2*x^2) - (B*(b^2 + 2*a*c))/x + 2*b*B*c*x + (1/2)*c*(A*c + 2*b*C)*x^2 + (1/3)*B*c^2*x^3 + (1/4)*c^2*C*x^4 + (2*A*b*c + (b^2 + 2*a*c)*C)*log(x)]

    #= ::Subsubsection::Closed:: =#
    #=p<0=#

    @test_int [x^4*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4), x, 13, ((A*c - b*C)*x)/c^2 + (B*x^2)/(2*c) + (C*x^3)/(3*c) - ((A*b*c - b^2*C + a*c*C - (A*c*(b^2 - 2*a*c) - b*(b^2 - 3*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(5/2)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((A*b*c - b^2*C + a*c*C + (A*c*(b^2 - 2*a*c) - b*(b^2 - 3*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(5/2)*sqrt(b + sqrt(b^2 - 4*a*c))) - (B*(b^2 - 2*a*c)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^2*sqrt(b^2 - 4*a*c)) - (b*B*log(a + b*x^2 + c*x^4))/(4*c^2)]
    @test_int [x^3*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4), x, 12, (B*x)/c + (C*x^2)/(2*c) - (B*(b - (b^2 - 2*a*c)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) - (B*(b + (b^2 - 2*a*c)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c))) + ((A*b*c - b^2*C + 2*a*c*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^2*sqrt(b^2 - 4*a*c)) + ((A*c - b*C)*log(a + b*x^2 + c*x^4))/(4*c^2)]
    @test_int [x^2*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4), x, 11, (C*x)/c + ((A*c - b*C - (A*b*c - (b^2 - 2*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((A*c - b*C + (A*b*c - b^2*C + 2*a*c*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c))) + (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c*sqrt(b^2 - 4*a*c)) + (B*log(a + b*x^2 + c*x^4))/(4*c)]
    @test_int [x^1*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4), x, 10, -((B*sqrt(b - sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*sqrt(c)*sqrt(b^2 - 4*a*c))) + (B*sqrt(b + sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*sqrt(c)*sqrt(b^2 - 4*a*c)) - ((2*A*c - b*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c*sqrt(b^2 - 4*a*c)) + (C*log(a + b*x^2 + c*x^4))/(4*c)]
    @test_int [x^0*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4), x, 8, ((C + (2*A*c - b*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*sqrt(c)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((C - (2*A*c - b*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*sqrt(c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/sqrt(b^2 - 4*a*c)]
    @test_int [(A + B*x + C*x^2)/(x^1*(a + b*x^2 + c*x^4)), x, 12, (sqrt(2)*B*sqrt(c)*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(2)*B*sqrt(c)*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) + ((A*b - 2*a*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a*sqrt(b^2 - 4*a*c)) + (A*log(x))/a - (A*log(a + b*x^2 + c*x^4))/(4*a)]
    @test_int [(A + B*x + C*x^2)/(x^2*(a + b*x^2 + c*x^4)), x, 13, -(A/(a*x)) - (sqrt(c)*(A + (A*b - 2*a*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*a*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(c)*(A - (A*b - 2*a*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*a*sqrt(b + sqrt(b^2 - 4*a*c))) + (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a*sqrt(b^2 - 4*a*c)) + (B*log(x))/a - (B*log(a + b*x^2 + c*x^4))/(4*a)]
    @test_int [(A + B*x + C*x^2)/(x^3*(a + b*x^2 + c*x^4)), x, 13, -(A/(2*a*x^2)) - B/(a*x) - (B*sqrt(c)*(1 + b/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*a*sqrt(b - sqrt(b^2 - 4*a*c))) - (B*sqrt(c)*(1 - b/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*a*sqrt(b + sqrt(b^2 - 4*a*c))) - ((A*(b^2 - 2*a*c) - a*b*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^2*sqrt(b^2 - 4*a*c)) - ((A*b - a*C)*log(x))/a^2 + ((A*b - a*C)*log(a + b*x^2 + c*x^4))/(4*a^2)]

    @test_int [x^4*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 11, ((2*A*c - b*C)*x)/(2*c*(b^2 - 4*a*c)) + (B*x^2*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x^3*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((A*b*c + (b^2 - 6*a*c)*C - (A*c*(b^2 + 4*a*c) + b*(b^2 - 8*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(3/2)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((A*b*c + (b^2 - 6*a*c)*C + (A*c*(b^2 + 4*a*c) + b*(b^2 - 8*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(3/2)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) + (2*a*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [x^3*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 10, (B*x*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (a*(2*A*c - b*C) + (A*b*c - b^2*C + 2*a*c*C)*x^2)/(2*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (B*(b - (b^2 + 4*a*c)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + (B*(b^2 + 4*a*c + b*sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c))) - ((A*b - 2*a*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [x^2*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 10, (B*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*A*c - b*C - (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*A*c - b*C + (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [x^1*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 10, -((B*x*(b + 2*c*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4))) - (A*b - 2*a*C + (2*A*c - b*C)*x^2)/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (B*sqrt(c)*(2*b - sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*(b^2 - 4*a*c)^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) - (B*sqrt(c)*(2*b + sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*(b^2 - 4*a*c)^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c))) + ((2*A*c - b*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [x^0*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 10, -((B*(b + 2*c*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4))) + (x*(A*b^2 - 2*a*A*c - a*b*C + c*(A*b - 2*a*C)*x^2))/(2*a*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (sqrt(c)*(A*b - 2*a*C + (A*(b^2 - 12*a*c) + 4*a*b*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + (sqrt(c)*(A*b - 2*a*C - (A*b^2 - 12*a*A*c + 4*a*b*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) + (2*B*c*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [(A + B*x + C*x^2)/(x^1*(a + b*x^2 + c*x^4)^2), x, 14, (B*x*(b^2 - 2*a*c + b*c*x^2))/(2*a*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (A*(b^2 - 2*a*c) - a*b*C + c*(A*b - 2*a*C)*x^2)/(2*a*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (B*sqrt(c)*(b^2 - 12*a*c + b*sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*(b^2 - 4*a*c)^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) - (B*sqrt(c)*(b^2 - 12*a*c - b*sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*(b^2 - 4*a*c)^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c))) + ((A*(b^3 - 6*a*b*c) + 4*a^2*c*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^2*(b^2 - 4*a*c)^(3/2)) + (A*log(x))/a^2 - (A*log(a + b*x^2 + c*x^4))/(4*a^2)]
    @test_int [(A + B*x + C*x^2)/(x^2*(a + b*x^2 + c*x^4)^2), x, 15, -((3*A*b^2 - 10*a*A*c - a*b*C)/(2*a^2*(b^2 - 4*a*c)*x)) + (B*(b^2 - 2*a*c + b*c*x^2))/(2*a*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (A*(b^2 - 2*a*c) - a*b*C + c*(A*b - 2*a*C)*x^2)/(2*a*(b^2 - 4*a*c)*x*(a + b*x^2 + c*x^4)) - (sqrt(c)*(A*(3*b^3 - 16*a*b*c + 3*b^2*sqrt(b^2 - 4*a*c) - 10*a*c*sqrt(b^2 - 4*a*c)) - a*(b^2 - 12*a*c + b*sqrt(b^2 - 4*a*c))*C)*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*(b^2 - 4*a*c)^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(c)*(3*A*b^2 - 10*a*A*c - a*b*C - (A*(3*b^3 - 16*a*b*c) - a*(b^2 - 12*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) + (b*B*(b^2 - 6*a*c)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^2*(b^2 - 4*a*c)^(3/2)) + (B*log(x))/a^2 - (B*log(a + b*x^2 + c*x^4))/(4*a^2)]
    @test_int [(A + B*x + C*x^2)/(x^3*(a + b*x^2 + c*x^4)^2), x, 15, -((2*A*b^2 - 6*a*A*c - a*b*C)/(2*a^2*(b^2 - 4*a*c)*x^2)) - (B*(3*b^2 - 10*a*c))/(2*a^2*(b^2 - 4*a*c)*x) + (B*(b^2 - 2*a*c + b*c*x^2))/(2*a*(b^2 - 4*a*c)*x*(a + b*x^2 + c*x^4)) + (A*(b^2 - 2*a*c) - a*b*C + c*(A*b - 2*a*C)*x^2)/(2*a*(b^2 - 4*a*c)*x^2*(a + b*x^2 + c*x^4)) - (B*sqrt(c)*(3*b^3 - 16*a*b*c + (3*b^2 - 10*a*c)*sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*(b^2 - 4*a*c)^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) + (B*sqrt(c)*(3*b^3 - 16*a*b*c - (3*b^2 - 10*a*c)*sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*(b^2 - 4*a*c)^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c))) - ((2*A*(b^4 - 6*a*b^2*c + 6*a^2*c^2) - a*b*(b^2 - 6*a*c)*C)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^3*(b^2 - 4*a*c)^(3/2)) - ((2*A*b - a*C)*log(x))/a^3 + ((2*A*b - a*C)*log(a + b*x^2 + c*x^4))/(4*a^3)]

    #= ::Subsection:: =#
    #=Integrands*of*the*form*P2(x)*x^m*(a+b*x^2+c*x^4)^(p/2)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P2(x)*(d*x)^m*(a+b*x^2+c*x^4)^p*when*m*symbolic=#

    @test_int [(d*x)^m*(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^3, x, 2, (a^3*A*(d*x)^(1 + m))/(d*(1 + m)) + (a^3*B*(d*x)^(2 + m))/(d^2*(2 + m)) + (a^2*(3*A*b + a*C)*(d*x)^(3 + m))/(d^3*(3 + m)) + (3*a^2*b*B*(d*x)^(4 + m))/(d^4*(4 + m)) + (3*a*(A*(b^2 + a*c) + a*b*C)*(d*x)^(5 + m))/(d^5*(5 + m)) + (3*a*B*(b^2 + a*c)*(d*x)^(6 + m))/(d^6*(6 + m)) + ((A*(b^3 + 6*a*b*c) + 3*a*(b^2 + a*c)*C)*(d*x)^(7 + m))/(d^7*(7 + m)) + (b*B*(b^2 + 6*a*c)*(d*x)^(8 + m))/(d^8*(8 + m)) + ((3*A*c*(b^2 + a*c) + b*(b^2 + 6*a*c)*C)*(d*x)^(9 + m))/(d^9*(9 + m)) + (3*B*c*(b^2 + a*c)*(d*x)^(10 + m))/(d^10*(10 + m)) + (3*c*(A*b*c + (b^2 + a*c)*C)*(d*x)^(11 + m))/(d^11*(11 + m)) + (3*b*B*c^2*(d*x)^(12 + m))/(d^12*(12 + m)) + (c^2*(A*c + 3*b*C)*(d*x)^(13 + m))/(d^13*(13 + m)) + (B*c^3*(d*x)^(14 + m))/(d^14*(14 + m)) + (c^3*C*(d*x)^(15 + m))/(d^15*(15 + m))]
    @test_int [(d*x)^m*(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^2, x, 2, (a^2*A*(d*x)^(1 + m))/(d*(1 + m)) + (a^2*B*(d*x)^(2 + m))/(d^2*(2 + m)) + (a*(2*A*b + a*C)*(d*x)^(3 + m))/(d^3*(3 + m)) + (2*a*b*B*(d*x)^(4 + m))/(d^4*(4 + m)) + ((A*(b^2 + 2*a*c) + 2*a*b*C)*(d*x)^(5 + m))/(d^5*(5 + m)) + (B*(b^2 + 2*a*c)*(d*x)^(6 + m))/(d^6*(6 + m)) + ((2*A*b*c + (b^2 + 2*a*c)*C)*(d*x)^(7 + m))/(d^7*(7 + m)) + (2*b*B*c*(d*x)^(8 + m))/(d^8*(8 + m)) + (c*(A*c + 2*b*C)*(d*x)^(9 + m))/(d^9*(9 + m)) + (B*c^2*(d*x)^(10 + m))/(d^10*(10 + m)) + (c^2*C*(d*x)^(11 + m))/(d^11*(11 + m))]
    @test_int [(d*x)^m*(A + B*x + C*x^2)*(a + b*x^2 + c*x^4)^1, x, 2, (a*A*(d*x)^(1 + m))/(d*(1 + m)) + (a*B*(d*x)^(2 + m))/(d^2*(2 + m)) + ((A*b + a*C)*(d*x)^(3 + m))/(d^3*(3 + m)) + (b*B*(d*x)^(4 + m))/(d^4*(4 + m)) + ((A*c + b*C)*(d*x)^(5 + m))/(d^5*(5 + m)) + (B*c*(d*x)^(6 + m))/(d^6*(6 + m)) + (c*C*(d*x)^(7 + m))/(d^7*(7 + m))]
    @test_int [(d*x)^m*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^1, x, 8, ((C + (2*A*c - b*C)/sqrt(b^2 - 4*a*c))*(d*x)^(1 + m)*HypergeometricFunctions._₂F₁(1, (1 + m)/2, (3 + m)/2, -((2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))))/((b - sqrt(b^2 - 4*a*c))*d*(1 + m)) + ((C - (2*A*c - b*C)/sqrt(b^2 - 4*a*c))*(d*x)^(1 + m)*HypergeometricFunctions._₂F₁(1, (1 + m)/2, (3 + m)/2, -((2*c*x^2)/(b + sqrt(b^2 - 4*a*c)))))/((b + sqrt(b^2 - 4*a*c))*d*(1 + m)) + (2*B*c*(d*x)^(2 + m)*HypergeometricFunctions._₂F₁(1, (2 + m)/2, (4 + m)/2, -((2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))))/(sqrt(b^2 - 4*a*c)*(b - sqrt(b^2 - 4*a*c))*d^2*(2 + m)) - (2*B*c*(d*x)^(2 + m)*HypergeometricFunctions._₂F₁(1, (2 + m)/2, (4 + m)/2, -((2*c*x^2)/(b + sqrt(b^2 - 4*a*c)))))/(sqrt(b^2 - 4*a*c)*(b + sqrt(b^2 - 4*a*c))*d^2*(2 + m))]
    @test_int [(d*x)^m*(A + B*x + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 10, (B*(d*x)^(2 + m)*(b^2 - 2*a*c + b*c*x^2))/(2*a*(b^2 - 4*a*c)*d^2*(a + b*x^2 + c*x^4)) + ((d*x)^(1 + m)*(A*(b^2 - 2*a*c) - a*b*C + c*(A*b - 2*a*C)*x^2))/(2*a*(b^2 - 4*a*c)*d*(a + b*x^2 + c*x^4)) + (c*(2*a*C*(2*b - sqrt(b^2 - 4*a*c)*(1 - m)) + A*(b^2*(1 - m) + b*sqrt(b^2 - 4*a*c)*(1 - m) - 4*a*c*(3 - m)))*(d*x)^(1 + m)*HypergeometricFunctions._₂F₁(1, (1 + m)/2, (3 + m)/2, -((2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))))/(2*a*(b^2 - 4*a*c)^(3/2)*(b - sqrt(b^2 - 4*a*c))*d*(1 + m)) - (c*(2*a*C*(2*b + sqrt(b^2 - 4*a*c)*(1 - m)) + A*(b^2*(1 - m) - b*sqrt(b^2 - 4*a*c)*(1 - m) - 4*a*c*(3 - m)))*(d*x)^(1 + m)*HypergeometricFunctions._₂F₁(1, (1 + m)/2, (3 + m)/2, -((2*c*x^2)/(b + sqrt(b^2 - 4*a*c)))))/(2*a*(b^2 - 4*a*c)^(3/2)*(b + sqrt(b^2 - 4*a*c))*d*(1 + m)) - (B*c*(4*a*c*(2 - m) + b*(b + sqrt(b^2 - 4*a*c))*m)*(d*x)^(2 + m)*HypergeometricFunctions._₂F₁(1, (2 + m)/2, (4 + m)/2, -((2*c*x^2)/(b - sqrt(b^2 - 4*a*c)))))/(2*a*(b^2 - 4*a*c)^(3/2)*(b - sqrt(b^2 - 4*a*c))*d^2*(2 + m)) + (B*c*(4*a*c*(2 - m) + b*(b - sqrt(b^2 - 4*a*c))*m)*(d*x)^(2 + m)*HypergeometricFunctions._₂F₁(1, (2 + m)/2, (4 + m)/2, -((2*c*x^2)/(b + sqrt(b^2 - 4*a*c)))))/(2*a*(b^2 - 4*a*c)^(3/2)*(b + sqrt(b^2 - 4*a*c))*d^2*(2 + m))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P(x)*x^m*(a+b*x^2+c*x^4)^p=#

    #= Note: The*following*integrands*are*equal. =#
    @test_int [x^2*(A*x^0 + B*x^1 + C*x^2)/(a + b*x^2 + c*x^4)^2, x, 10, (B*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*A*c - b*C - (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*A*c - b*C + (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [x^1*(A*x^1 + B*x^2 + C*x^3)/(a + b*x^2 + c*x^4)^2, x, 11, (B*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*A*c - b*C - (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*A*c - b*C + (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [x^0*(A*x^2 + B*x^3 + C*x^4)/(a + b*x^2 + c*x^4)^2, x, 11, (B*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*A*c - b*C - (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*A*c - b*C + (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [(A*x^3 + B*x^4 + C*x^5)/(x^1*(a + b*x^2 + c*x^4)^2), x, 11, (B*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*A*c - b*C - (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*A*c - b*C + (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [(A*x^4 + B*x^5 + C*x^6)/(x^2*(a + b*x^2 + c*x^4)^2), x, 11, (B*(2*a + b*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (x*(A*b - 2*a*C + (2*A*c - b*C)*x^2))/(2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*A*c - b*C - (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*A*c - b*C + (4*A*b*c - (b^2 + 4*a*c)*C)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c))) - (b*B*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*P(x^2)*(d*x)^m*(a+b*x^2+c*x^4)^p=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P2(x^2)*x^m*(a+b*x^2+c*x^4)^p=#

    #= ::Subsubsection:: =#
    #=p>0=#

    #= ::Subsubsection::Closed:: =#
    #=p<0=#

    @test_int [x^7*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 7, ((b^2*c*e - a*c^2*e - b^3*f - b*c*(c*d - 2*a*f))*x^2)/(2*c^4) + ((c^2*d + b^2*f - c*(b*e + a*f))*x^4)/(4*c^3) + ((c*e - b*f)*x^6)/(6*c^2) + (f*x^8)/(8*c) - ((b^4*c*e - 4*a*b^2*c^2*e + 2*a^2*c^3*e - b^5*f - b^3*c*(c*d - 5*a*f) + a*b*c^2*(3*c*d - 5*a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^5*sqrt(b^2 - 4*a*c)) - ((b^3*c*e - 2*a*b*c^2*e - b^4*f - b^2*c*(c*d - 3*a*f) + a*c^2*(c*d - a*f))*log(a + b*x^2 + c*x^4))/(4*c^5)]
    @test_int [x^5*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 7, ((c^2*d + b^2*f - c*(b*e + a*f))*x^2)/(2*c^3) + ((c*e - b*f)*x^4)/(4*c^2) + (f*x^6)/(6*c) + ((b^3*c*e - 3*a*b*c^2*e - b^4*f - b^2*c*(c*d - 4*a*f) + 2*a*c^2*(c*d - a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^4*sqrt(b^2 - 4*a*c)) + ((b^2*c*e - a*c^2*e - b^3*f - b*c*(c*d - 2*a*f))*log(a + b*x^2 + c*x^4))/(4*c^4)]
    @test_int [x^3*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 7, ((c*e - b*f)*x^2)/(2*c^2) + (f*x^4)/(4*c) - ((b^2*c*e - 2*a*c^2*e - b^3*f - b*c*(c*d - 3*a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^3*sqrt(b^2 - 4*a*c)) + ((c^2*d + b^2*f - c*(b*e + a*f))*log(a + b*x^2 + c*x^4))/(4*c^3)]
    @test_int [x^1*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 7, (f*x^2)/(2*c) - ((2*c^2*d - b*c*e + b^2*f - 2*a*c*f)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^2*sqrt(b^2 - 4*a*c)) + ((c*e - b*f)*log(a + b*x^2 + c*x^4))/(4*c^2)]
    @test_int [(d + e*x^2 + f*x^4)/(x^1*(a + b*x^2 + c*x^4)), x, 7, ((b*c*d - 2*a*c*e + a*b*f)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a*c*sqrt(b^2 - 4*a*c)) + (d*log(x))/a - ((c*d - a*f)*log(a + b*x^2 + c*x^4))/(4*a*c)]
    @test_int [(d + e*x^2 + f*x^4)/(x^3*(a + b*x^2 + c*x^4)), x, 7, -(d/(2*a*x^2)) - ((b^2*d - a*b*e - 2*a*(c*d - a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^2*sqrt(b^2 - 4*a*c)) - ((b*d - a*e)*log(x))/a^2 + ((b*d - a*e)*log(a + b*x^2 + c*x^4))/(4*a^2)]
    @test_int [(d + e*x^2 + f*x^4)/(x^5*(a + b*x^2 + c*x^4)), x, 7, -(d/(4*a*x^4)) + (b*d - a*e)/(2*a^2*x^2) + ((b^3*d - a*b^2*e + 2*a^2*c*e - a*b*(3*c*d - a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^3*sqrt(b^2 - 4*a*c)) + ((b^2*d - a*b*e - a*(c*d - a*f))*log(x))/a^3 - ((b^2*d - a*b*e - a*(c*d - a*f))*log(a + b*x^2 + c*x^4))/(4*a^3)]
    @test_int [(d + e*x^2 + f*x^4)/(x^7*(a + b*x^2 + c*x^4)), x, 7, -(d/(6*a*x^6)) + (b*d - a*e)/(4*a^2*x^4) - (b^2*d - a*b*e - a*(c*d - a*f))/(2*a^3*x^2) - ((b^4*d - a*b^3*e + 3*a^2*b*c*e + 2*a^2*c*(c*d - a*f) - a*b^2*(4*c*d - a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^4*sqrt(b^2 - 4*a*c)) - ((b^3*d - a*b^2*e + a^2*c*e - a*b*(2*c*d - a*f))*log(x))/a^4 + ((b^3*d - a*b^2*e + a^2*c*e - a*b*(2*c*d - a*f))*log(a + b*x^2 + c*x^4))/(4*a^4)]

    @test_int [x^4*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 5, ((c^2*d + b^2*f - c*(b*e + a*f))*x)/c^3 + ((c*e - b*f)*x^3)/(3*c^2) + (f*x^5)/(5*c) + ((b^2*c*e - a*c^2*e - b^3*f - b*c*(c*d - 2*a*f) - (b^3*c*e - 3*a*b*c^2*e - b^4*f - b^2*c*(c*d - 4*a*f) + 2*a*c^2*(c*d - a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(7/2)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((b^2*c*e - a*c^2*e - b^3*f - b*c*(c*d - 2*a*f) + (b^3*c*e - 3*a*b*c^2*e - b^4*f - b^2*c*(c*d - 4*a*f) + 2*a*c^2*(c*d - a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(7/2)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^2*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 5, ((c*e - b*f)*x)/c^2 + (f*x^3)/(3*c) + ((c^2*d - b*c*e + b^2*f - a*c*f + (b^2*c*e - 2*a*c^2*e - b^3*f - b*c*(c*d - 3*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(5/2)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((c^2*d - b*c*e + b^2*f - a*c*f - (b^2*c*e - 2*a*c^2*e - b^3*f - b*c*(c*d - 3*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(5/2)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^0*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4), x, 5, (f*x)/c + ((c*e - b*f + (2*c^2*d + b^2*f - c*(b*e + 2*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((c*e - b*f - (2*c^2*d - b*c*e + b^2*f - 2*a*c*f)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*c^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [(d + e*x^2 + f*x^4)/(x^2*(a + b*x^2 + c*x^4)), x, 5, -(d/(a*x)) - ((c*d - a*f + (b*c*d - 2*a*c*e + a*b*f)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*a*sqrt(c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((c*d - a*f - (b*c*d - 2*a*c*e + a*b*f)/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*a*sqrt(c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [(d + e*x^2 + f*x^4)/(x^4*(a + b*x^2 + c*x^4)), x, 5, -(d/(3*a*x^3)) + (b*d - a*e)/(a^2*x) + (sqrt(c)*(b*d - a*e + (b^2*d - a*b*e - 2*a*(c*d - a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*a^2*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(c)*(b^2*d - b*(sqrt(b^2 - 4*a*c)*d + a*e) - a*(2*c*d - sqrt(b^2 - 4*a*c)*e - 2*a*f))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*a^2*sqrt(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [(d + e*x^2 + f*x^4)/(x^6*(a + b*x^2 + c*x^4)), x, 5, -(d/(5*a*x^5)) + (b*d - a*e)/(3*a^2*x^3) - (b^2*d - a*b*e - a*(c*d - a*f))/(a^3*x) - (sqrt(c)*(b^2*d - a*b*e - a*(c*d - a*f) + (b^3*d - a*b^2*e + 2*a^2*c*e - a*b*(3*c*d - a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(sqrt(2)*a^3*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(c)*(b^2*d - a*b*e - a*(c*d - a*f) - (b^3*d - a*b^2*e + 2*a^2*c*e - a*b*(3*c*d - a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(sqrt(2)*a^3*sqrt(b + sqrt(b^2 - 4*a*c)))]

    @test_int [x^7*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 8, ((2*b^2*c*e - 6*a*c^2*e - 3*b^3*f - b*c*(c*d - 11*a*f))*x^2)/(2*c^3*(b^2 - 4*a*c)) + ((4*c^2*d + 3*b^2*f - 2*c*(b*e + 4*a*f))*x^4)/(4*c^2*(b^2 - 4*a*c)) + (x^6*(2*a*c*e - b*(c*d + a*f) - (2*c^2*d - b*c*e + b^2*f - 2*a*c*f)*x^2))/(2*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*b^4*c*e - 12*a*b^2*c^2*e + 12*a^2*c^3*e - 3*b^5*f - b^3*c*(c*d - 20*a*f) + 6*a*b*c^2*(c*d - 5*a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^4*(b^2 - 4*a*c)^(3/2)) + ((c^2*d + 3*b^2*f - 2*c*(b*e + a*f))*log(a + b*x^2 + c*x^4))/(4*c^4)]
    @test_int [x^5*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 7, ((2*c^2*d + 2*b^2*f - c*(b*e + 6*a*f))*x^2)/(2*c^2*(b^2 - 4*a*c)) + (x^4*(2*a*c*e - b*(c*d + a*f) - (2*c^2*d - b*c*e + b^2*f - 2*a*c*f)*x^2))/(2*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((12*a^2*c^2*f - b^3*(c*e - 2*b*f) - 2*a*c*(2*c^2*d - 3*b*c*e + 6*b^2*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^3*(b^2 - 4*a*c)^(3/2)) + ((c*e - 2*b*f)*log(a + b*x^2 + c*x^4))/(4*c^3)]
    @test_int [x^3*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 6, (x^2*(2*a*c*e - b*(c*d + a*f) - (2*c^2*d - b*c*e + b^2*f - 2*a*c*f)*x^2))/(2*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((4*a*c^2*e + b^3*f - 2*b*c*(c*d + 3*a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*c^2*(b^2 - 4*a*c)^(3/2)) + (f*log(a + b*x^2 + c*x^4))/(4*c^2)]
    @test_int [x^1*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 5, (2*a*c*e - b*(c*d + a*f) - (2*c^2*d - b*c*e + b^2*f - 2*a*c*f)*x^2)/(2*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((2*c*d - b*e + 2*a*f)*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(b^2 - 4*a*c)^(3/2)]
    @test_int [(d + e*x^2 + f*x^4)/(x^1*(a + b*x^2 + c*x^4)^2), x, 8, (b^2*d - a*b*e - 2*a*(c*d - a*f) + (b*c*d - 2*a*c*e + a*b*f)*x^2)/(2*a*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((b^3*d + 4*a^2*c*e - 2*a*b*(3*c*d + a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^2*(b^2 - 4*a*c)^(3/2)) + (d*log(x))/a^2 - (d*log(a + b*x^2 + c*x^4))/(4*a^2)]
    @test_int [(d + e*x^2 + f*x^4)/(x^3*(a + b*x^2 + c*x^4)^2), x, 8, -(d/(2*a^2*x^2)) - (b^3*d - a*b^2*e + 2*a^2*c*e - a*b*(3*c*d - a*f) + c*(b^2*d - a*b*e - 2*a*(c*d - a*f))*x^2)/(2*a^2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*b^4*d - 12*a*b^2*c*d - a*b^3*e + 6*a^2*b*c*e + 4*a^2*c*(3*c*d - a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^3*(b^2 - 4*a*c)^(3/2)) - ((2*b*d - a*e)*log(x))/a^3 + ((2*b*d - a*e)*log(a + b*x^2 + c*x^4))/(4*a^3)]
    @test_int [(d + e*x^2 + f*x^4)/(x^5*(a + b*x^2 + c*x^4)^2), x, 8, -(d/(4*a^2*x^4)) + (2*b*d - a*e)/(2*a^3*x^2) + (b^4*d - a*b^3*e + 3*a^2*b*c*e + 2*a^2*c*(c*d - a*f) - a*b^2*(4*c*d - a*f) + c*(b^3*d - a*b^2*e + 2*a^2*c*e - a*b*(3*c*d - a*f))*x^2)/(2*a^3*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((3*b^5*d - 2*a*b^4*e + 12*a^2*b^2*c*e - 12*a^3*c^2*e + 6*a^2*b*c*(5*c*d - a*f) - a*b^3*(20*c*d - a*f))*atanh((b + 2*c*x^2)/sqrt(b^2 - 4*a*c)))/(2*a^4*(b^2 - 4*a*c)^(3/2)) + ((3*b^2*d - 2*a*b*e - a*(2*c*d - a*f))*log(x))/a^4 - ((3*b^2*d - 2*a*b*e - a*(2*c*d - a*f))*log(a + b*x^2 + c*x^4))/(4*a^4)]

    @test_int [x^6*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 6, ((c*e - 2*b*f)*x)/c^3 + (f*x^3)/(3*c^2) + (x*(a*(b^2*c*e - 2*a*c^2*e - b^3*f - b*c*(c*d - 3*a*f)) + (b^3*c*e - 3*a*b*c^2*e - b^4*f - b^2*c*(c*d - 4*a*f) + 2*a*c^2*(c*d - a*f))*x^2))/(2*c^3*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((3*b^3*c*e - 13*a*b*c^2*e - 5*b^4*f - b^2*c*(c*d - 24*a*f) + 2*a*c^2*(3*c*d - 7*a*f) - (3*b^4*c*e - 19*a*b^2*c^2*e + 20*a^2*c^3*e - 5*b^5*f - b^3*c*(c*d - 34*a*f) + 4*a*b*c^2*(2*c*d - 13*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(7/2)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((3*b^3*c*e - 13*a*b*c^2*e - 5*b^4*f - b^2*c*(c*d - 24*a*f) + 2*a*c^2*(3*c*d - 7*a*f) + (3*b^4*c*e - 19*a*b^2*c^2*e + 20*a^2*c^3*e - 5*b^5*f - b^3*c*(c*d - 34*a*f) + 4*a*b*c^2*(2*c*d - 13*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(7/2)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^4*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 6, (f*x)/c^2 + (x*(a*(2*c^2*d - b*c*e + b^2*f - 2*a*c*f) - (b^2*c*e - 2*a*c^2*e - b^3*f - b*c*(c*d - 3*a*f))*x^2))/(2*c^2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((b^2*c*e - 6*a*c^2*e - 3*b^3*f + b*c*(c*d + 13*a*f) - (b^3*c*e - 8*a*b*c^2*e - 3*b^4*f + 4*a*c^2*(c*d - 5*a*f) + b^2*c*(c*d + 19*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(5/2)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((b^2*c*e - 6*a*c^2*e - 3*b^3*f + b*c*(c*d + 13*a*f) + (b^3*c*e - 8*a*b*c^2*e - 3*b^4*f + 4*a*c^2*(c*d - 5*a*f) + b^2*c*(c*d + 19*a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(5/2)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^2*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 4, -((x*(b*c*d - 2*a*c*e + a*b*f + (2*c^2*d - b*c*e + b^2*f - 2*a*c*f)*x^2))/(2*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4))) - ((2*c*d - b*e + 6*a*f - (b^2*f)/c + (b^2*c*e + 4*a*c^2*e + b^3*f - 4*b*c*(c*d + 2*a*f))/(c*sqrt(b^2 - 4*a*c)))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*c*d - b*e + 6*a*f - (b^2*f)/c - (b^2*c*e + 4*a*c^2*e + b^3*f - 4*b*c*(c*d + 2*a*f))/(c*sqrt(b^2 - 4*a*c)))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^0*(d + e*x^2 + f*x^4)/(a + b*x^2 + c*x^4)^2, x, 4, (x*(b^2*d - a*b*e - 2*a*(c*d - a*f) + (b*c*d - 2*a*c*e + a*b*f)*x^2))/(2*a*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((b*c*d - 2*a*c*e + a*b*f + (4*a*b*c*e + b^2*(c*d - a*f) - 4*a*c*(3*c*d + a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((b*c*d - 2*a*c*e + a*b*f - (4*a*b*c*e + b^2*(c*d - a*f) - 4*a*c*(3*c*d + a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [(d + e*x^2 + f*x^4)/(x^2*(a + b*x^2 + c*x^4)^2), x, 6, -(d/(a^2*x)) - (x*(a*((b^3*d)/a - b*(3*c*d + b*e) + a*(2*c*e + b*f)) + c*(b^2*d - a*b*e - 2*a*(c*d - a*f))*x^2))/(2*a^2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - (sqrt(c)*(3*b^2*d - a*b*e - 2*a*(5*c*d - a*f) + (3*b^3*d - a*b^2*e + 12*a^2*c*e - 4*a*b*(4*c*d + a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(c)*(3*b^2*d - a*b*e - 2*a*(5*c*d - a*f) - (3*b^3*d - a*b^2*e + 12*a^2*c*e - 4*a*b*(4*c*d + a*f))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [(d + e*x^2 + f*x^4)/(x^4*(a + b*x^2 + c*x^4)^2), x, 6, -(d/(3*a^2*x^3)) + (2*b*d - a*e)/(a^3*x) + (x*(a^2*((b^4*d)/a^2 + 2*c^2*d + 3*b*c*e - (b^2*(4*c*d + b*e))/a + b^2*f - 2*a*c*f) + c*(b^3*d - a*b^2*e + 2*a^2*c*e - a*b*(3*c*d - a*f))*x^2))/(2*a^3*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (sqrt(c)*(5*b^4*d + b^3*(5*sqrt(b^2 - 4*a*c)*d - 3*a*e) + 2*a^2*c*(14*c*d + 5*sqrt(b^2 - 4*a*c)*e - 6*a*f) - a*b^2*(29*c*d + 3*sqrt(b^2 - 4*a*c)*e - a*f) - a*b*(19*c*sqrt(b^2 - 4*a*c)*d - 16*a*c*e - a*sqrt(b^2 - 4*a*c)*f))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^3*(b^2 - 4*a*c)^(3/2)*sqrt(b - sqrt(b^2 - 4*a*c))) - (sqrt(c)*(5*b^4*d - b^3*(5*sqrt(b^2 - 4*a*c)*d + 3*a*e) + 2*a^2*c*(14*c*d - 5*sqrt(b^2 - 4*a*c)*e - 6*a*f) - a*b^2*(29*c*d - 3*sqrt(b^2 - 4*a*c)*e - a*f) + a*b*(19*c*sqrt(b^2 - 4*a*c)*d + 16*a*c*e - a*sqrt(b^2 - 4*a*c)*f))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^3*(b^2 - 4*a*c)^(3/2)*sqrt(b + sqrt(b^2 - 4*a*c)))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P3(x^2)*x^m*(a+b*x^2+c*x^4)^p=#

    #= ::Subsubsection:: =#
    #=p>0=#

    #= ::Subsubsection::Closed:: =#
    #=p<0=#

    @test_int [x^9*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 7, (-(1/2))*(293*x^2) + (49*x^4)/2 - (9*x^6)/2 + (5*x^8)/8 + (414 + 415*x^2)/(2*(2 + 3*x^2 + x^4)) + 2*log(1 + x^2) + 392*log(2 + x^2)]
    @test_int [x^7*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 7, 49*x^2 - (27*x^4)/4 + (5*x^6)/6 - (206 + 207*x^2)/(2*(2 + 3*x^2 + x^4)) - (5/2)*log(1 + x^2) - 144*log(2 + x^2)]
    @test_int [x^5*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 7, -((27*x^2)/2) + (5*x^4)/4 + (102 + 103*x^2)/(2*(2 + 3*x^2 + x^4)) + 3*log(1 + x^2) + 46*log(2 + x^2)]
    @test_int [x^3*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 7, (5*x^2)/2 - (50 + 51*x^2)/(2*(2 + 3*x^2 + x^4)) - (7/2)*log(1 + x^2) - 10*log(2 + x^2)]
    @test_int [x^1*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 5, (24 + 25*x^2)/(2*(2 + 3*x^2 + x^4)) + 4*log(1 + x^2) - (3/2)*log(2 + x^2)]
    @test_int [1/x^1*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 4, -((11 + 12*x^2)/(2*(2 + 3*x^2 + x^4))) + log(x) - (9/2)*log(1 + x^2) + 4*log(2 + x^2)]
    @test_int [1/x^3*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 4, -(1/(2*x^2)) + (9 + 11*x^2)/(4*(2 + 3*x^2 + x^4)) - (11*log(x))/4 + 5*log(1 + x^2) - (29/8)*log(2 + x^2)]
    @test_int [1/x^5*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 4, -(1/(4*x^4)) + 11/(8*x^2) - (5 + 9*x^2)/(8*(2 + 3*x^2 + x^4)) + (23*log(x))/4 - (11/2)*log(1 + x^2) + (21/8)*log(2 + x^2)]

    @test_int [x^8*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 6, -293*x + (98*x^3)/3 - (27*x^5)/5 + (5*x^7)/7 - (x*(206 + 207*x^2))/(2*(2 + 3*x^2 + x^4)) + (9*atan(x))/2 + 340*sqrt(2)*atan(x/sqrt(2))]
    @test_int [x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 6, 98*x - 9*x^3 + x^5 + (x*(102 + 103*x^2))/(2*(2 + 3*x^2 + x^4)) - (11*atan(x))/2 - 118*sqrt(2)*atan(x/sqrt(2))]
    @test_int [x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 6, -27*x + (5*x^3)/3 - (x*(50 + 51*x^2))/(2*(2 + 3*x^2 + x^4)) + (13*atan(x))/2 + 33*sqrt(2)*atan(x/sqrt(2))]
    @test_int [x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 6, 5*x + (x*(24 + 25*x^2))/(2*(2 + 3*x^2 + x^4)) - (15*atan(x))/2 - (7*atan(x/sqrt(2)))/sqrt(2)]
    @test_int [x^0*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 4, -((x*(11 + 12*x^2))/(2*(2 + 3*x^2 + x^4))) + (17*atan(x))/2 - (19*atan(x/sqrt(2)))/(2*sqrt(2))]
    @test_int [1/x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 5, -(1/x) + (x*(9 + 11*x^2))/(4*(2 + 3*x^2 + x^4)) - (19*atan(x))/2 + (45*atan(x/sqrt(2)))/(4*sqrt(2))]
    @test_int [1/x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 5, -(1/(3*x^3)) + 11/(4*x) - (x*(5 + 9*x^2))/(8*(2 + 3*x^2 + x^4)) + (21*atan(x))/2 - (71*atan(x/sqrt(2)))/(8*sqrt(2))]
    @test_int [1/x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 5, -(1/(5*x^5)) + 11/(12*x^3) - 23/(4*x) - (x*(3 - 5*x^2))/(16*(2 + 3*x^2 + x^4)) - (23*atan(x))/2 + (97*atan(x/sqrt(2)))/(16*sqrt(2))]
    @test_int [1/x^8*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^2, x, 5, -(1/(7*x^7)) + 11/(20*x^5) - 23/(12*x^3) + 137/(16*x) + (x*(19 + 3*x^2))/(32*(2 + 3*x^2 + x^4)) + (25*atan(x))/2 - (123*atan(x/sqrt(2)))/(32*sqrt(2))]

    @test_int [x^10*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 7, 214*x - 14*x^3 + x^5 + (x*(414 + 415*x^2))/(4*(2 + 3*x^2 + x^4)^2) + (x*(824 + 1669*x^2))/(8*(2 + 3*x^2 + x^4)) + (477*atan(x))/8 - 351*sqrt(2)*atan(x/sqrt(2))]
    @test_int [x^8*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 7, -42*x + (5*x^3)/3 - (x*(206 + 207*x^2))/(4*(2 + 3*x^2 + x^4)^2) + (x*(24 - 409*x^2))/(8*(2 + 3*x^2 + x^4)) - (449*atan(x))/8 + (219*atan(x/sqrt(2)))/sqrt(2)]
    @test_int [x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 7, 5*x + (x*(102 + 103*x^2))/(4*(2 + 3*x^2 + x^4)^2) - (x*(244 + 15*x^2))/(8*(2 + 3*x^2 + x^4)) + (413*atan(x))/8 - (191*atan(x/sqrt(2)))/(2*sqrt(2))]
    @test_int [x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 5, -((x*(50 + 51*x^2))/(4*(2 + 3*x^2 + x^4)^2)) + (x*(254 + 125*x^2))/(8*(2 + 3*x^2 + x^4)) - (369*atan(x))/8 + (267*atan(x/sqrt(2)))/(4*sqrt(2))]
    @test_int [x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 5, (x*(24 + 25*x^2))/(4*(2 + 3*x^2 + x^4)^2) - (x*(211 + 130*x^2))/(8*(2 + 3*x^2 + x^4)) + (317*atan(x))/8 - (447*atan(x/sqrt(2)))/(8*sqrt(2))]
    @test_int [x^0*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 5, -((x*(11 + 12*x^2))/(4*(2 + 3*x^2 + x^4)^2)) + (x*(335 + 217*x^2))/(16*(2 + 3*x^2 + x^4)) - (257*atan(x))/8 + (731*atan(x/sqrt(2)))/(16*sqrt(2))]
    @test_int [1/x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 6, -(1/(2*x)) + (x*(9 + 11*x^2))/(8*(2 + 3*x^2 + x^4)^2) - (x*(547 + 347*x^2))/(32*(2 + 3*x^2 + x^4)) + (189*atan(x))/8 - (1119*atan(x/sqrt(2)))/(32*sqrt(2))]
    @test_int [1/x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 6, -(1/(6*x^3)) + 17/(8*x) - (x*(5 + 9*x^2))/(16*(2 + 3*x^2 + x^4)^2) + (x*(951 + 571*x^2))/(64*(2 + 3*x^2 + x^4)) - (113*atan(x))/8 + (1611*atan(x/sqrt(2)))/(64*sqrt(2))]
    @test_int [1/x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(2 + 3*x^2 + x^4)^3, x, 6, -(1/(10*x^5)) + 17/(24*x^3) - 93/(16*x) - (x*(3 - 5*x^2))/(32*(2 + 3*x^2 + x^4)^2) - (x*(1771 + 999*x^2))/(128*(2 + 3*x^2 + x^4)) + (29*atan(x))/8 - (2207*atan(x/sqrt(2)))/(128*sqrt(2))]

    @test_int [x^9*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, 19*x^2 + (19*x^4)/4 - (17*x^6)/6 + (5*x^8)/8 - (25*(15 + 7*x^2))/(8*(3 + 2*x^2 + x^4)) + (201*atan((1 + x^2)/sqrt(2)))/(8*sqrt(2)) - (183/4)*log(3 + 2*x^2 + x^4)]
    @test_int [x^7*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, (19*x^2)/2 - (17*x^4)/4 + (5*x^6)/6 + (25*(3 + 5*x^2))/(8*(3 + 2*x^2 + x^4)) - (455*atan((1 + x^2)/sqrt(2)))/(8*sqrt(2)) + (19/2)*log(3 + 2*x^2 + x^4)]
    @test_int [x^5*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, -((17*x^2)/2) + (5*x^4)/4 + (25*(3 - x^2))/(8*(3 + 2*x^2 + x^4)) + (203*atan((1 + x^2)/sqrt(2)))/(8*sqrt(2)) + (19/4)*log(3 + 2*x^2 + x^4)]
    @test_int [x^3*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, (5*x^2)/2 - (25*(3 + x^2))/(8*(3 + 2*x^2 + x^4)) - (17*atan((1 + x^2)/sqrt(2)))/(8*sqrt(2)) - (17/4)*log(3 + 2*x^2 + x^4)]
    @test_int [x^1*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 6, (25*(1 + x^2))/(8*(3 + 2*x^2 + x^4)) - (23*atan((1 + x^2)/sqrt(2)))/(8*sqrt(2)) + (5/4)*log(3 + 2*x^2 + x^4)]
    @test_int [1/x^1*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, (25*(1 - x^2))/(24*(3 + 2*x^2 + x^4)) + (89*atan((1 + x^2)/sqrt(2)))/(72*sqrt(2)) + (4*log(x))/9 - (1/9)*log(3 + 2*x^2 + x^4)]
    @test_int [1/x^3*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, -(2/(9*x^2)) - (25*(5 + x^2))/(72*(3 + 2*x^2 + x^4)) - (71*atan((1 + x^2)/sqrt(2)))/(216*sqrt(2)) - (13*log(x))/27 + (13/108)*log(3 + 2*x^2 + x^4)]
    @test_int [1/x^5*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, -(1/(9*x^4)) + 13/(54*x^2) + (25*(7 + 5*x^2))/(216*(3 + 2*x^2 + x^4)) + (125*atan((1 + x^2)/sqrt(2)))/(216*sqrt(2)) + (13*log(x))/27 - (13/108)*log(3 + 2*x^2 + x^4)]
    @test_int [1/x^7*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 8, -(2/(27*x^6)) + 13/(108*x^4) - 13/(54*x^2) + (25*(1 - 7*x^2))/(648*(3 + 2*x^2 + x^4)) - (1237*atan((1 + x^2)/sqrt(2)))/(1944*sqrt(2)) + (61*log(x))/243 - (61/972)*log(3 + 2*x^2 + x^4)]

    @test_int [x^8*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, 38*x + (19*x^3)/3 - (17*x^5)/5 + (5*x^7)/7 + (25*x*(3 + 5*x^2))/(8*(3 + 2*x^2 + x^4)) + (1/16)*sqrt((1/2)*(262771 + 618291*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/16)*sqrt((1/2)*(262771 + 618291*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/32)*sqrt((1/2)*(-262771 + 618291*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) + (1/32)*sqrt((1/2)*(-262771 + 618291*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, 19*x - (17*x^3)/3 + x^5 + (25*x*(3 - x^2))/(8*(3 + 2*x^2 + x^4)) + (3/16)*sqrt((3/2)*(-8669 + 5011*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) - (3/16)*sqrt((3/2)*(-8669 + 5011*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) + (3/32)*sqrt((3/2)*(8669 + 5011*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) - (3/32)*sqrt((3/2)*(8669 + 5011*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, -17*x + (5*x^3)/3 - (25*x*(3 + x^2))/(8*(3 + 2*x^2 + x^4)) - (1/16)*sqrt((1/2)*(14395 + 26499*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/16)*sqrt((1/2)*(14395 + 26499*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/32)*sqrt((1/2)*(-14395 + 26499*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) + (1/32)*sqrt((1/2)*(-14395 + 26499*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, 5*x + (25*x*(1 + x^2))/(8*(3 + 2*x^2 + x^4)) + (1/16)*sqrt((1/6)*(19291 + 12899*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/16)*sqrt((1/6)*(19291 + 12899*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/32)*sqrt((1/6)*(-19291 + 12899*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) + (1/32)*sqrt((1/6)*(-19291 + 12899*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^0*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 10, (25*x*(1 - x^2))/(24*(3 + 2*x^2 + x^4)) - (1/48)*sqrt((1/6)*(-11567 + 12897*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/48)*sqrt((1/6)*(-11567 + 12897*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/96)*sqrt((1/6)*(11567 + 12897*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) - (1/96)*sqrt((1/6)*(11567 + 12897*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [1/x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, -(4/(9*x)) - (25*x*(5 + x^2))/(72*(3 + 2*x^2 + x^4)) + (1/48)*sqrt((1/6)*(-965 + 699*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/48)*sqrt((1/6)*(-965 + 699*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/96)*sqrt((1/6)*(965 + 699*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) + (1/96)*sqrt((1/6)*(965 + 699*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [1/x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, -(4/(27*x^3)) + 13/(27*x) + (25*x*(7 + 5*x^2))/(216*(3 + 2*x^2 + x^4)) - (1/432)*sqrt((1/6)*(6073 + 56673*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/432)*sqrt((1/6)*(6073 + 56673*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/864)*sqrt((1/6)*(-6073 + 56673*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) - (1/864)*sqrt((1/6)*(-6073 + 56673*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [1/x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^2, x, 12, -(4/(45*x^5)) + 13/(81*x^3) - 13/(27*x) + (25*x*(1 - 7*x^2))/(648*(3 + 2*x^2 + x^4)) + (sqrt((1/6)*(-1139381 + 688419*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))))/1296 - (sqrt((1/6)*(-1139381 + 688419*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))))/1296 - (sqrt((1/6)*(1139381 + 688419*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2))/2592 + (sqrt((1/6)*(1139381 + 688419*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2))/2592]

    @test_int [x^10*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 13, 58*x - 9*x^3 + x^5 - (25*x*(15 + 7*x^2))/(16*(3 + 2*x^2 + x^4)^2) + (x*(3305 + 252*x^2))/(64*(3 + 2*x^2 + x^4)) + (3/256)*sqrt(-8595619 + 7678611*sqrt(3))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) - (3/256)*sqrt(-8595619 + 7678611*sqrt(3))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) + (3/512)*sqrt(8595619 + 7678611*sqrt(3))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) - (3/512)*sqrt(8595619 + 7678611*sqrt(3))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^8*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 13, -27*x + (5*x^3)/3 + (25*x*(3 + 5*x^2))/(16*(3 + 2*x^2 + x^4)^2) - (x*(1468 + 835*x^2))/(64*(3 + 2*x^2 + x^4)) - (21/256)*sqrt(34271 + 22721*sqrt(3))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (21/256)*sqrt(34271 + 22721*sqrt(3))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (21/512)*sqrt(-34271 + 22721*sqrt(3))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) + (21/512)*sqrt(-34271 + 22721*sqrt(3))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^6*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 13, 5*x + (25*x*(3 - x^2))/(16*(3 + 2*x^2 + x^4)^2) + (7*x*(11 + 58*x^2))/(64*(3 + 2*x^2 + x^4)) + (1/256)*sqrt(827621 + 1176531*sqrt(3))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/256)*sqrt(827621 + 1176531*sqrt(3))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (1/512)*sqrt(-827621 + 1176531*sqrt(3))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) + (1/512)*sqrt(-827621 + 1176531*sqrt(3))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 11, -((25*x*(3 + x^2))/(16*(3 + 2*x^2 + x^4)^2)) + (x*(238 - 59*x^2))/(64*(3 + 2*x^2 + x^4)) - (1/256)*sqrt(3*(-48835 + 32827*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/256)*sqrt(3*(-48835 + 32827*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/512)*sqrt(3*(48835 + 32827*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) - (1/512)*sqrt(3*(48835 + 32827*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 11, (25*x*(1 + x^2))/(16*(3 + 2*x^2 + x^4)^2) - (x*(353 + 88*x^2))/(192*(3 + 2*x^2 + x^4)) - (11/768)*sqrt((1/3)*(-1825 + 1089*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (11/768)*sqrt((1/3)*(-1825 + 1089*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) - (11*sqrt((1/3)*(1825 + 1089*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2))/1536 + (11*sqrt((1/3)*(1825 + 1089*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2))/1536]
    @test_int [x^0*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 11, (25*x*(1 - x^2))/(48*(3 + 2*x^2 + x^4)^2) + (x*(64 + 51*x^2))/(192*(3 + 2*x^2 + x^4)) - (1/256)*sqrt((1/3)*(-1291 + 1019*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/256)*sqrt((1/3)*(-1291 + 1019*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))) + (1/512)*sqrt((1/3)*(1291 + 1019*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2) - (1/512)*sqrt((1/3)*(1291 + 1019*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2)]
    @test_int [1/x^2*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 13, -(4/(27*x)) - (25*x*(5 + x^2))/(144*(3 + 2*x^2 + x^4)^2) - (x*(325 + 242*x^2))/(1728*(3 + 2*x^2 + x^4)) + (sqrt((1/3)*(59711 + 55161*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))))/2304 - (sqrt((1/3)*(59711 + 55161*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))))/2304 - (sqrt((1/3)*(-59711 + 55161*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2))/4608 + (sqrt((1/3)*(-59711 + 55161*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2))/4608]
    @test_int [1/x^4*(4 + x^2 + 3*x^4 + 5*x^6)/(3 + 2*x^2 + x^4)^3, x, 13, -(4/(81*x^3)) + 7/(27*x) + (25*x*(7 + 5*x^2))/(432*(3 + 2*x^2 + x^4)^2) + (x*(1474 + 1025*x^2))/(5184*(3 + 2*x^2 + x^4)) - (sqrt((1/3)*(10004741 + 11240451*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) - 2*x)/sqrt(2*(1 + sqrt(3)))))/20736 + (sqrt((1/3)*(10004741 + 11240451*sqrt(3)))*atan((sqrt(2*(-1 + sqrt(3))) + 2*x)/sqrt(2*(1 + sqrt(3)))))/20736 + (sqrt((1/3)*(-10004741 + 11240451*sqrt(3)))*log(sqrt(3) - sqrt(2*(-1 + sqrt(3)))*x + x^2))/41472 - (sqrt((1/3)*(-10004741 + 11240451*sqrt(3)))*log(sqrt(3) + sqrt(2*(-1 + sqrt(3)))*x + x^2))/41472]

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

    @test_int [x^4*(d + e*x^2 + f*x^4 + g*x^6)/(a + b*x^2 + c*x^4)^2, x, 6, ((c*f - 2*b*g)*x)/c^3 + (g*x^3)/(3*c^2) + (x*(a*(2*c^3*d - c^2*(b*e + 2*a*f) - b^3*g + b*c*(b*f + 3*a*g)) + (b^3*c*f + b*c^2*(c*d - 3*a*f) - b^4*g - b^2*c*(c*e - 4*a*g) + 2*a*c^2*(c*e - a*g))*x^2))/(2*c^3*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((3*b^3*c*f - b*c^2*(c*d + 13*a*f) - 5*b^4*g - b^2*c*(c*e - 24*a*g) + 2*a*c^2*(3*c*e - 7*a*g) - (3*b^4*c*f - 4*a*c^3*(c*d - 5*a*f) - b^2*c^2*(c*d + 19*a*f) - 5*b^5*g - b^3*c*(c*e - 34*a*g) + 4*a*b*c^2*(2*c*e - 13*a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(7/2)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((3*b^3*c*f - b*c^2*(c*d + 13*a*f) - 5*b^4*g - b^2*c*(c*e - 24*a*g) + 2*a*c^2*(3*c*e - 7*a*g) + (3*b^4*c*f - 4*a*c^3*(c*d - 5*a*f) - b^2*c^2*(c*d + 19*a*f) - 5*b^5*g - b^3*c*(c*e - 34*a*g) + 4*a*b*c^2*(2*c*e - 13*a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(7/2)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^2*(d + e*x^2 + f*x^4 + g*x^6)/(a + b*x^2 + c*x^4)^2, x, 6, (g*x)/c^2 - (x*(b*c*(c*d + a*f) - a*b^2*g - 2*a*c*(c*e - a*g) + (2*c^3*d - c^2*(b*e + 2*a*f) - b^3*g + b*c*(b*f + 3*a*g))*x^2))/(2*c^2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((2*c^3*d - c^2*(b*e - 6*a*f) + 3*b^3*g - b*c*(b*f + 13*a*g) + (b^3*c*f - 4*b*c^2*(c*d + 2*a*f) - 3*b^4*g + 4*a*c^2*(c*e - 5*a*g) + b^2*c*(c*e + 19*a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(5/2)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((2*c^3*d - c^2*(b*e - 6*a*f) + 3*b^3*g - b*c*(b*f + 13*a*g) - (b^3*c*f - 4*b*c^2*(c*d + 2*a*f) - 3*b^4*g + 4*a*c^2*(c*e - 5*a*g) + b^2*c*(c*e + 19*a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*c^(5/2)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [x^0*(d + e*x^2 + f*x^4 + g*x^6)/(a + b*x^2 + c*x^4)^2, x, 4, (x*(c*(b^2*d - 2*a*(c*d - a*f) - (a*b*(c*e + a*g))/c) + (b*c*(c*d + a*f) - a*b^2*g - 2*a*c*(c*e - a*g))*x^2))/(2*a*c*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + ((b*(c*d + a*f) + (a*b^2*g)/c - 2*a*(c*e + 3*a*g) + (b^2*c*(c*d - a*f) - 4*a*c^2*(3*c*d + a*f) - a*b^3*g + 4*a*b*c*(c*e + 2*a*g))/(c*sqrt(b^2 - 4*a*c)))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + ((b*(c*d + a*f) + (a*b^2*g)/c - 2*a*(c*e + 3*a*g) - (b^2*c*(c*d - a*f) - 4*a*c^2*(3*c*d + a*f) - a*b^3*g + 4*a*b*c*(c*e + 2*a*g))/(c*sqrt(b^2 - 4*a*c)))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [1/x^2*(d + e*x^2 + f*x^4 + g*x^6)/(a + b*x^2 + c*x^4)^2, x, 6, -(d/(a^2*x)) - (x*(a*((b^3*d)/a - b*(3*c*d + b*e) + a*(2*c*e + b*f) - 2*a^2*g) + (b^2*c*d - 2*a*c*(c*d - a*f) - a*b*(c*e + a*g))*x^2))/(2*a^2*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) - ((3*b^2*c*d - 2*a*c*(5*c*d - a*f) - a*b*(c*e + a*g) + (3*b^3*c*d - 4*a*b*c*(4*c*d + a*f) - a*b^2*(c*e - a*g) + 4*a^2*c*(3*c*e + a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*sqrt(c)*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) - ((3*b^2*c*d - 2*a*c*(5*c*d - a*f) - a*b*(c*e + a*g) - (3*b^3*c*d - 4*a*b*c*(4*c*d + a*f) - a*b^2*(c*e - a*g) + 4*a^2*c*(3*c*e + a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^2*sqrt(c)*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]
    @test_int [1/x^4*(d + e*x^2 + f*x^4 + g*x^6)/(a + b*x^2 + c*x^4)^2, x, 6, -(d/(3*a^2*x^3)) + (2*b*d - a*e)/(a^3*x) + (x*(a^2*((b^4*d)/a^2 + 2*c^2*d + 3*b*c*e - (b^2*(4*c*d + b*e))/a + b^2*f - a*(2*c*f + b*g)) + c*(b^3*d - a*b^2*e - a*b*(3*c*d - a*f) + 2*a^2*(c*e - a*g))*x^2))/(2*a^3*(b^2 - 4*a*c)*(a + b*x^2 + c*x^4)) + (sqrt(c)*(5*b^3*d - 3*a*b^2*e - a*b*(19*c*d - a*f) + 2*a^2*(5*c*e - a*g) + (5*b^4*d - 3*a*b^3*e + 4*a^2*c*(7*c*d - 3*a*f) - a*b^2*(29*c*d - a*f) + 4*a^2*b*(4*c*e + a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b - sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^3*(b^2 - 4*a*c)*sqrt(b - sqrt(b^2 - 4*a*c))) + (sqrt(c)*(5*b^3*d - 3*a*b^2*e - a*b*(19*c*d - a*f) + 2*a^2*(5*c*e - a*g) - (5*b^4*d - 3*a*b^3*e + 4*a^2*c*(7*c*d - 3*a*f) - a*b^2*(29*c*d - a*f) + 4*a^2*b*(4*c*e + a*g))/sqrt(b^2 - 4*a*c))*atan((sqrt(2)*sqrt(c)*x)/sqrt(b + sqrt(b^2 - 4*a*c))))/(2*sqrt(2)*a^3*(b^2 - 4*a*c)*sqrt(b + sqrt(b^2 - 4*a*c)))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P2(x^2)*x^m*(a+b*x^2+c*x^4)^p*with*p*symbolic=#

    @test_int [x^2*(3*a + b*(5 + 2*p)*x^2 + c*(7 + 4*p)*x^4)*(a + b*x^2 + c*x^4)^p, x, 1, x^3*(a + b*x^2 + c*x^4)^(1 + p)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*P(x^2)*(d*x)^m*(a+b*x)^p*(a-b*x)^p=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*P2(x^2)*x^m*(a+b*x)^(p/2)*(a-b*x)^(p/2)=#

    #= ::Subsubsection:: =#
    #=p>0=#

    #= ::Subsubsection::Closed:: =#
    #=p<0=#

    @test_int [x^5*(a + b*x^2 + c*x^4)/(sqrt(d - e*x)*sqrt(d + e*x)), x, 5, -((d^4*(c*d^4 + b*d^2*e^2 + a*e^4)*sqrt(d - e*x)*sqrt(d + e*x))/e^10) + (d^2*(4*c*d^4 + 3*b*d^2*e^2 + 2*a*e^4)*(d - e*x)^(3/2)*(d + e*x)^(3/2))/(3*e^10) - ((6*c*d^4 + 3*b*d^2*e^2 + a*e^4)*(d - e*x)^(5/2)*(d + e*x)^(5/2))/(5*e^10) + ((4*c*d^2 + b*e^2)*(d - e*x)^(7/2)*(d + e*x)^(7/2))/(7*e^10) - (c*(d - e*x)^(9/2)*(d + e*x)^(9/2))/(9*e^10), -((d^4*(c*d^4 + b*d^2*e^2 + a*e^4)*(d^2 - e^2*x^2))/(e^10*sqrt(d - e*x)*sqrt(d + e*x))) + (d^2*(4*c*d^4 + 3*b*d^2*e^2 + 2*a*e^4)*(d^2 - e^2*x^2)^2)/(3*e^10*sqrt(d - e*x)*sqrt(d + e*x)) - ((6*c*d^4 + 3*b*d^2*e^2 + a*e^4)*(d^2 - e^2*x^2)^3)/(5*e^10*sqrt(d - e*x)*sqrt(d + e*x)) + ((4*c*d^2 + b*e^2)*(d^2 - e^2*x^2)^4)/(7*e^10*sqrt(d - e*x)*sqrt(d + e*x)) - (c*(d^2 - e^2*x^2)^5)/(9*e^10*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [x^3*(a + b*x^2 + c*x^4)/(sqrt(d - e*x)*sqrt(d + e*x)), x, 4, -((d^2*(c*d^4 + b*d^2*e^2 + a*e^4)*sqrt(d - e*x)*sqrt(d + e*x))/e^8) + ((3*c*d^4 + 2*b*d^2*e^2 + a*e^4)*(d - e*x)^(3/2)*(d + e*x)^(3/2))/(3*e^8) - ((3*c*d^2 + b*e^2)*(d - e*x)^(5/2)*(d + e*x)^(5/2))/(5*e^8) + (c*(d - e*x)^(7/2)*(d + e*x)^(7/2))/(7*e^8), -((d^2*(c*d^4 + b*d^2*e^2 + a*e^4)*(d^2 - e^2*x^2))/(e^8*sqrt(d - e*x)*sqrt(d + e*x))) + ((3*c*d^4 + 2*b*d^2*e^2 + a*e^4)*(d^2 - e^2*x^2)^2)/(3*e^8*sqrt(d - e*x)*sqrt(d + e*x)) - ((3*c*d^2 + b*e^2)*(d^2 - e^2*x^2)^3)/(5*e^8*sqrt(d - e*x)*sqrt(d + e*x)) + (c*(d^2 - e^2*x^2)^4)/(7*e^8*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [x^1*(a + b*x^2 + c*x^4)/(sqrt(d - e*x)*sqrt(d + e*x)), x, 4, -(((c*d^4 + b*d^2*e^2 + a*e^4)*sqrt(d - e*x)*sqrt(d + e*x))/e^6) + ((2*c*d^2 + b*e^2)*(d - e*x)^(3/2)*(d + e*x)^(3/2))/(3*e^6) - (c*(d - e*x)^(5/2)*(d + e*x)^(5/2))/(5*e^6), -(((c*d^4 + b*d^2*e^2 + a*e^4)*(d^2 - e^2*x^2))/(e^6*sqrt(d - e*x)*sqrt(d + e*x))) + ((2*c*d^2 + b*e^2)*(d^2 - e^2*x^2)^2)/(3*e^6*sqrt(d - e*x)*sqrt(d + e*x)) - (c*(d^2 - e^2*x^2)^3)/(5*e^6*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^1*sqrt(d - e*x)*sqrt(d + e*x)), x, 6, -(((c*d^2 + b*e^2)*sqrt(d - e*x)*sqrt(d + e*x))/e^4) + (c*(d - e*x)^(3/2)*(d + e*x)^(3/2))/(3*e^4) - (a*atanh((sqrt(d - e*x)*sqrt(d + e*x))/d))/d, -(((c*d^2 + b*e^2)*(d^2 - e^2*x^2))/(e^4*sqrt(d - e*x)*sqrt(d + e*x))) + (c*(d^2 - e^2*x^2)^2)/(3*e^4*sqrt(d - e*x)*sqrt(d + e*x)) - (a*sqrt(d^2 - e^2*x^2)*atanh(sqrt(d^2 - e^2*x^2)/d))/(d*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^3*sqrt(d - e*x)*sqrt(d + e*x)), x, 6, -((c*sqrt(d - e*x)*sqrt(d + e*x))/e^2) - (a*sqrt(d - e*x)*sqrt(d + e*x))/(2*d^2*x^2) - ((2*b*d^2 + a*e^2)*atanh((sqrt(d - e*x)*sqrt(d + e*x))/d))/(2*d^3), -((c*(d^2 - e^2*x^2))/(e^2*sqrt(d - e*x)*sqrt(d + e*x))) - (a*(d^2 - e^2*x^2))/(2*d^2*x^2*sqrt(d - e*x)*sqrt(d + e*x)) - ((2*b*d^2 + a*e^2)*sqrt(d^2 - e^2*x^2)*atanh(sqrt(d^2 - e^2*x^2)/d))/(2*d^3*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^5*sqrt(d - e*x)*sqrt(d + e*x)), x, 6, -((a*sqrt(d - e*x)*sqrt(d + e*x))/(4*d^2*x^4)) - ((4*b*d^2 + 3*a*e^2)*sqrt(d - e*x)*sqrt(d + e*x))/(8*d^4*x^2) - ((8*c*d^4 + 4*b*d^2*e^2 + 3*a*e^4)*atanh((sqrt(d - e*x)*sqrt(d + e*x))/d))/(8*d^5), -((a*(d^2 - e^2*x^2))/(4*d^2*x^4*sqrt(d - e*x)*sqrt(d + e*x))) - ((4*b*d^2 + 3*a*e^2)*(d^2 - e^2*x^2))/(8*d^4*x^2*sqrt(d - e*x)*sqrt(d + e*x)) - ((8*c*d^4 + 4*b*d^2*e^2 + 3*a*e^4)*sqrt(d^2 - e^2*x^2)*atanh(sqrt(d^2 - e^2*x^2)/d))/(8*d^5*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^7*sqrt(d - e*x)*sqrt(d + e*x)), x, 7, -(a*sqrt(d - e*x)*sqrt(d + e*x))/(6*d^2*x^6) - ((6*b*d^2 + 5*a*e^2)*sqrt(d - e*x)*sqrt(d + e*x))/(24*d^4*x^4) - ((8*c*d^4 + 6*b*d^2*e^2 + 5*a*e^4)*sqrt(d - e*x)*sqrt(d + e*x))/(16*d^6*x^2) - (e^2*(8*c*d^4 + 6*b*d^2*e^2 + 5*a*e^4)*sqrt(d^2 - e^2*x^2)*atanh(sqrt(d^2 - e^2*x^2)/d))/(16*d^7*sqrt(d - e*x)*sqrt(d + e*x)), -((a*(d^2 - e^2*x^2))/(6*d^2*x^6*sqrt(d - e*x)*sqrt(d + e*x))) - ((6*b*d^2 + 5*a*e^2)*(d^2 - e^2*x^2))/(24*d^4*x^4*sqrt(d - e*x)*sqrt(d + e*x)) - ((8*c*d^4 + 6*b*d^2*e^2 + 5*a*e^4)*(d^2 - e^2*x^2))/(16*d^6*x^2*sqrt(d - e*x)*sqrt(d + e*x)) - (e^2*(8*c*d^4 + 6*b*d^2*e^2 + 5*a*e^4)*sqrt(d^2 - e^2*x^2)*atanh(sqrt(d^2 - e^2*x^2)/d))/(16*d^7*sqrt(d - e*x)*sqrt(d + e*x))]

    @test_int [x^2*(a + b*x^2 + c*x^4)/(sqrt(d - e*x)*sqrt(d + e*x)), x, 6, -((5*c*d^4 + 6*b*d^2*e^2 + 8*a*e^4)*x*sqrt(d - e*x)*sqrt(d + e*x))/(16*e^6) - ((5*c*d^2 + 6*b*e^2)*x^3*sqrt(d - e*x)*sqrt(d + e*x))/(24*e^4) + (c*x^5*(-d + e*x)*sqrt(d + e*x))/(6*e^2*sqrt(d - e*x)) + (d^2*(5*c*d^4 + 6*b*d^2*e^2 + 8*a*e^4)*sqrt(d^2 - e^2*x^2)*atan((e*x)/sqrt(d^2 - e^2*x^2)))/(16*e^7*sqrt(d - e*x)*sqrt(d + e*x)), -(((5*c*d^4 + 6*b*d^2*e^2 + 8*a*e^4)*x*(d^2 - e^2*x^2))/(16*e^6*sqrt(d - e*x)*sqrt(d + e*x))) - ((5*c*d^2 + 6*b*e^2)*x^3*(d^2 - e^2*x^2))/(24*e^4*sqrt(d - e*x)*sqrt(d + e*x)) - (c*x^5*(d^2 - e^2*x^2))/(6*e^2*sqrt(d - e*x)*sqrt(d + e*x)) + (d^2*(5*c*d^4 + 6*b*d^2*e^2 + 8*a*e^4)*sqrt(d^2 - e^2*x^2)*atan((e*x)/sqrt(d^2 - e^2*x^2)))/(16*e^7*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [x^0*(a + b*x^2 + c*x^4)/(sqrt(d - e*x)*sqrt(d + e*x)), x, 5, -(((3*c*d^2 + 4*b*e^2)*x*sqrt(d - e*x)*sqrt(d + e*x))/(8*e^4)) + (c*x^3*(-d + e*x)*sqrt(d + e*x))/(4*e^2*sqrt(d - e*x)) - ((3*c*d^4 + 4*b*d^2*e^2 + 8*a*e^4)*atan(sqrt(d - e*x)/sqrt(d + e*x)))/(4*e^5), -(((3*c*d^2 + 4*b*e^2)*x*(d^2 - e^2*x^2))/(8*e^4*sqrt(d - e*x)*sqrt(d + e*x))) - (c*x^3*(d^2 - e^2*x^2))/(4*e^2*sqrt(d - e*x)*sqrt(d + e*x)) + ((3*c*d^4 + 4*b*d^2*e^2 + 8*a*e^4)*sqrt(d^2 - e^2*x^2)*atan((e*x)/sqrt(d^2 - e^2*x^2)))/(8*e^5*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^2*sqrt(d - e*x)*sqrt(d + e*x)), x, 5 , -((a*sqrt(d - e*x)*sqrt(d + e*x))/(d^2*x)) + (c*x*(-d + e*x)*sqrt(d + e*x))/(2*e^2*sqrt(d - e*x)) - ((c*d^2 + 2*b*e^2)*atan(sqrt(d - e*x)/sqrt(d + e*x)))/e^3, -((a*(d^2 - e^2*x^2))/(d^2*x*sqrt(d - e*x)*sqrt(d + e*x))) - (c*x*(d^2 - e^2*x^2))/(2*e^2*sqrt(d - e*x)*sqrt(d + e*x)) + ((c*d^2 + 2*b*e^2)*sqrt(d^2 - e^2*x^2)*atan((e*x)/sqrt(d^2 - e^2*x^2)))/(2*e^3*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^4*sqrt(d - e*x)*sqrt(d + e*x)), x, 5, -((a*(d^2 - e^2*x^2))/(3*d^2*x^3*sqrt(d - e*x)*sqrt(d + e*x))) - ((3*b*d^2 + 2*a*e^2)*(d^2 - e^2*x^2))/(3*d^4*x*sqrt(d - e*x)*sqrt(d + e*x)) + (c*sqrt(d^2 - e^2*x^2)*atan((e*x)/sqrt(d^2 - e^2*x^2)))/(e*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^6*sqrt(d - e*x)*sqrt(d + e*x)), x, 4, -((a*(d^2 - e^2*x^2))/(5*d^2*x^5*sqrt(d - e*x)*sqrt(d + e*x))) - ((5*b*d^2 + 4*a*e^2)*(d^2 - e^2*x^2))/(15*d^4*x^3*sqrt(d - e*x)*sqrt(d + e*x)) - ((15*c*d^4 + 10*b*d^2*e^2 + 8*a*e^4)*(d^2 - e^2*x^2))/(15*d^6*x*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^8*sqrt(d - e*x)*sqrt(d + e*x)), x, 5, -((a*(d^2 - e^2*x^2))/(7*d^2*x^7*sqrt(d - e*x)*sqrt(d + e*x))) - ((7*b*d^2 + 6*a*e^2)*(d^2 - e^2*x^2))/(35*d^4*x^5*sqrt(d - e*x)*sqrt(d + e*x)) - ((35*c*d^4 + 28*b*d^2*e^2 + 24*a*e^4)*(d^2 - e^2*x^2))/(105*d^6*x^3*sqrt(d - e*x)*sqrt(d + e*x)) - (2*e^2*(35*c*d^4 + 28*b*d^2*e^2 + 24*a*e^4)*(d^2 - e^2*x^2))/(105*d^8*x*sqrt(d - e*x)*sqrt(d + e*x))]
    @test_int [(a + b*x^2 + c*x^4)/(x^10*sqrt(d - e*x)*sqrt(d + e*x)), x, 6, -((a*(d^2 - e^2*x^2))/(9*d^2*x^9*sqrt(d - e*x)*sqrt(d + e*x))) - ((9*b*d^2 + 8*a*e^2)*(d^2 - e^2*x^2))/(63*d^4*x^7*sqrt(d - e*x)*sqrt(d + e*x)) - ((21*c*d^4 + 18*b*d^2*e^2 + 16*a*e^4)*(d^2 - e^2*x^2))/(105*d^6*x^5*sqrt(d - e*x)*sqrt(d + e*x)) - (4*e^2*(21*c*d^4 + 18*b*d^2*e^2 + 16*a*e^4)*(d^2 - e^2*x^2))/(315*d^8*x^3*sqrt(d - e*x)*sqrt(d + e*x)) - (8*e^4*(21*c*d^4 + 18*b*d^2*e^2 + 16*a*e^4)*(d^2 - e^2*x^2))/(315*d^10*x*sqrt(d - e*x)*sqrt(d + e*x))]
    end

max_stars_repo_path: test/1 Algebraic functions/1.2 Trinomial products/1.2.2 Quartic/1.2.2.6 P(x) (d x)^m (a+b x^2+c x^4)^p.jl


text:
using Printf, GMT, JLD2

west = -122
east = -119.5
south = 35
north = 37

basemapregion ="$west/$south/$east/$(north)r"
frame=(axes=:NSEW, annot=1, ticks="30m",grid="15m")
center = [-120.0 36.0]
#proj = (name=:Cassini, center=center)
proj = (name=:Mercator)
Ispace = "0.1m"
color="./GMT_relief.cpt"

figsize = 14

#make large xyz file
#grdlist = ["grdn36w120", "grdn36w121"]
grdlist = ["grdn36w120", "grdn36w121", "grdn36w122", "grdn37w120", "grdn37w121", "grdn37w122"]
#
# for gg = grdlist
#    println(gg)
#    #convert it to grd file
#    fi = "./Arcgrid/xyzfiles/$gg"
#    G1 = xyz2grd(fi, region=basemapregion, proj=proj, I=Ispace)
#
#    #---process grd data---#
#    #remove inf in z
#    replace!(G1.z, -Inf=>NaN)
#    #replace!(G1.z, 0=>-2000) this cause bug
#
#    #======================#
#
#    #save into grd file
#    gmtwrite("./$gg.grd", G1)
# end

#
# for gg = grdlist
#
#    #convert it to grd file
#    fi = "./$gg.grd"
#    G1 = gmtread(fi, grd=true)
#
#    #save into grd file
#    gmtwrite("./$(gg)_lim.grd", G1)
# end

# plot

icount = 0
for gg = grdlist
   global icount += 1
   fi = "./$(gg).grd"
   println(fi)
   if icount == 1
      grdimage(fi, region=basemapregion, proj=proj, frame=frame,figsize=figsize,  color=color, coast=true, shade=(auto=true,), nan_alpha=true)
   elseif icount == length(grdlist)
      grdimage!(fi, region=basemapregion, proj=proj, frame=frame,figsize=figsize,  color=color, coast=true, shade=(auto=true,), nan_alpha=true)
   else
      grdimage!(fi, region=basemapregion, proj=proj, frame=frame,figsize=figsize,  color=color, coast=true, shade=(auto=true,), nan_alpha=true)
   end
end

# plot fault
t = jldopen("sanandreasfault.jld2")
fault = t["fault"]

for i = 1:length(fault)
#for i = 1:10

   f1 = fault[i]

   x = Float64[]
   y = Float64[]
   for j = 1:length(f1)
      push!(x, f1[j][1])
      push!(y, f1[j][2])
   end

   # select faults
   if  all(x -> x >= west, x) && all(x -> x <= east, x) && all(x -> x >= south, y) && all(x -> x <= north, y)
      println(x, y)
      xy = mat2ds(y, x=x)
      lines!(xy, pen=(1.5,:red)) # you can ignore error with this line
   end
end

#colorbar!(pos=(width=10, justify=:TC, outside=true, offset=(-6, 11), horizontal=true),
#   frame=(annot=1000, ticks=500),  truncate=(0, 3000), cmap=color, show=1)

# plot stations
station = jldopen("stationcoords.jld2")

# NC
NC = station["NC"]

for i = 1:length(NC)
   GMT.plot!([NC[i][1] NC[i][2]], marker="d", markersize=0.35, pen=(0.6),
   markeredgecolor=:black, markerfacecolor="135/206/250")
end

# BP
BP = station["BP"]

for i = 1:length(BP)
   GMT.plot!([BP[i][1] BP[i][2]], marker="v", markersize=0.35, pen=(0.8),
   markeredgecolor=:black, markerfacecolor="251/224/0")
end

#OFFICIAL WEB SITE SAYS INCOLECT VARIABLE NOM: scale_lat -> scale_at_lat
mapscale=(map=true, anchor=[-121.5, 35.2], scale_at_lat=36,  length=50, fancy=true, label="[km]")
p = coast!(region=basemapregion, shore=(pen=(0.8,:black)), L=mapscale,
 frame=frame, S="0/141/203", stamp="", show=true)

max_stars_repo_name: kura-okubo/SeisBeamforming

max_issues_repo_name: kura-okubo/SeisBeamforming

max_forks_repo_name: kura-okubo/SeisBeamforming


text:
@testset "Poly: $TPoly" for (TPoly, T) in [(ArbPoly, Arb), (AcbPoly, Acb)]
    @testset "Constructors" begin
        @test TPoly() == TPoly(T(0)) == TPoly(T[0]) == zero(TPoly) == zero(TPoly())
        @test TPoly(T(1)) == TPoly(T[1]) == one(TPoly) == one(TPoly())
        @test Arblib.isx(TPoly(T[0, 1]))
        @test TPoly(T[1, 2, 0]) == TPoly(T[1, 2])
        @test TPoly(5) == TPoly(5.0) == TPoly([5.0]) == TPoly(T(5))

        @test precision(TPoly(prec = 64)) == 64
        @test precision(TPoly(T(0), prec = 64)) == 64
        @test precision(TPoly(T[0], prec = 64)) == 64
        @test precision(zero(TPoly(prec = 64))) == 64
        @test precision(one(TPoly(prec = 64))) == 64
    end

    @testset "Interface" begin
        @test eltype(TPoly()) == T

        for (P, l) in [(zero(TPoly), 0), (one(TPoly), 1), (TPoly(T[0, 0, 1]), 3)]
            @test length(P) == Arblib.degree(P) + 1 == l
        end

        P = TPoly(T[i for i = 0:10])
        @test all(P[i] == i for i = 0:10)
        @test P[11] == 0
        @test P[12] == 0

        P[3] = T(7)
        @test P[3] == 7
        P[4] = 8
        @test P[4] == 8
        P[5] = π
        @test isequal(P[5], T(π))
        if T == Arb
            P[6] = ArbRefVector(T[9])[1]
        else
            P[6] = AcbRefVector(T[9])[1]
        end
        @test P[6] == 9

        @test_throws BoundsError P[-1]
    end
end


text:
@testset "Composition" begin
    encodings = (ProjectiveTransforms((5, 5)), ImagePreprocessing(), OneHot())
    blocks = (Image{2}(), Label(1:10))
    obs = (rand(RGB{N0f8}, 10, 10), 7)
    testencoding(encodings, blocks, obs)
end


text:
"""
    C = cpt4dcw(codes::String, vals::Vector{<:Real}; kwargs...)

Create a categorical CPT to use with the output of `coast(dcw=...)` to make Choropleth maps.
  - `codes` is a comma separated string with two chars country codes (ex: "PT,ES,FR,IT")
  - `vals` a vector with same size as number of country codes, with the values used to colorize the countries
Optionally provide a CPT in the kwarg `cmap=CPT` with a range sufficient to tansform the `vals` in colors.
As an alternative to the above provide a `makecpt` type `range` numeric vector to create a CPT.
If none of these are provided a default `CPT = makecpt(range=(0,255,1))` will be used.
"""
cpt4dcw(codes::String, vals::Vector{<:Real}; kwargs...) = cpt4dcw(split(codes,","), vals; kwargs...)
function cpt4dcw(codes::Vector{<:AbstractString}, vals::Vector{<:Real}; kwargs...)
	d = KW(kwargs)

	if ((val = find_in_dict(d, CPTaliases)[1]) !== nothing && isa(val, GMTcpt))
		C = val
	elseif ((val = find_in_dict(d, [:range])[1]) !== nothing && isvector(val) && length(val) >= 2)
		inc = (length(val) == 2) ? 1 : val[3]
		C = makecpt(T=(val[1], val[2], inc))
	else
		C = makecpt(T=(0,255,1))
	end

	p = sortperm(vals)		# Need to have the 'vals' sorted otherwise if we plot the CPT we get a mess
	_codes, _vals = codes[p], vals[p]

	# And we must also rip off all values that are outside the C.minmax interval otherwise the CPT if plotted is wrong
	n_vals, k = length(_vals), 1
	c = ones(Bool, n_vals)
	while(_vals[k] < C.minmax[1] && k <= n_vals)  c[k] = false;  k += 1  end
	k = n_vals
	while(_vals[k] > C.minmax[2] && k > 0)        c[k] = false;  k -= 1  end
	_codes, _vals = _codes[c], _vals[c]

	P::Ptr{GMT.GMT_PALETTE} = palette_init(API, C);		# A pointer to a GMT CPT

	Ccat::GMTcpt = makecpt(T=join(_codes, ","));
	rgb = [0.0, 0.0, 0.0];

	inc = (C.minmax[2] - C.minmax[1]) / size(Ccat.cpt, 1)
	for k = 1:size(Ccat.cpt, 1)
		gmt_get_rgb_from_z(API, P, _vals[k], rgb)
		[Ccat.colormap[k, n] = rgb[n] for n = 1:3]
		[Ccat.cpt[k, n+1] = rgb[(n % 3) .+ 1] for n = 0:5]		# cpt = [rgb rgb]
		Ccat.range[k,1] = C.minmax[1] + (k-1) * inc
		Ccat.range[k,2] = C.minmax[1] + k * inc
	end
	Ccat.minmax = C.minmax
	return Ccat
end

function cpt4dcw(continent::String, vals=missing; kwargs...)
	if (startswith(lowercase(continent), "eu"))
		codes = euro_codes()
		_vals = (vals === missing) ? rand(52) .* 255 : vals
		cpt4dcw(codes, _vals; kwargs...)
	else
		error("Unknown continent $(continent)")
	end
end

# --------------------------------------------------------------------------------------------------
function euro_codes()
	"AD,AL,AT,AX,BA,BE,BG,BY,CH,CY,CZ,DE,DK,EE,ES,FI,FO,FR,GB,GG,GI,GL,GR,HR,HU,IE,IM,IS,IT,JE,LI,LT,LU,LV,MC,MD,ME,MK,MT,NL,NO,PL,PT,RO,RS,SE,SI,SJ,SK,SM,VA,XK"
end

# --------------------------------------------------------------------------------------------------
function iso3to2_eu()
Dict("AND"=>"AD", "ALB"=>"AL", "AUT"=>"AT", "ALA"=>"AX", "BIH"=>"BA", "BEL"=>"BE", "BGR"=>"BG", "BLR"=>"BY", "CHE"=>"CH",
	"CYP"=>"CY", "CZE"=>"CZ", "DEU"=>"DE", "DNK"=>"DK", "EST"=>"EE", "ESP"=>"ES", "FIN"=>"FI", "FRO"=>"FO", "FRA"=>"FR",
	"GBR"=>"GB", "GGY"=>"GG", "GIB"=>"GI", "GRL"=>"GL", "GRC"=>"GR", "HRV"=>"HR", "HUN"=>"HU", "IRL"=>"IE", "IMN"=>"IM",
	"ISL"=>"IS", "ITA"=>"IT", "JEY"=>"JE", "LIE"=>"LI", "LTU"=>"LT", "LUX"=>"LU", "LVA"=>"LV", "MCO"=>"MC", "MDA"=>"MD", "MNE"=>"ME", "MKD"=>"MK", "MLT"=>"MT", "NLD"=>"NL", "NOR"=>"NO", "POL"=>"PL", "PRT"=>"PT", "ROU"=>"RO", "SRB"=>"RS",
	"SWE"=>"SE", "SVN"=>"SI", "SJM"=>"SJ", "SVK"=>"SK", "SMR"=>"SM", "VAT"=>"VA", "KSV"=>"XK")
end

# --------------------------------------------------------------------------------------------------
function iso3to2_af()
Dict("AGO"=>"AO", "BFA"=>"BF", "BDI"=>"BI", "BEN"=>"BJ", "BVT"=>"BV", "BWA"=>"BW", "COD"=>"CD", "CAF"=>"CF", "COG"=>"CG",
	 "CIV"=>"CI", "CMR"=>"CM", "CPV"=>"CV", "DJI"=>"DJ", "DZA"=>"DZ", "EGY"=>"EG", "ESH"=>"EH", "ERI"=>"ER", "ETH"=>"ET",
	 "GAB"=>"GA", "GHA"=>"GH", "GMB"=>"GM", "GIN"=>"GN", "GNQ"=>"GQ", "GNB"=>"GW", "KEN"=>"KE", "COM"=>"KM", "LBR"=>"LR",
	 "LSO"=>"LS", "LBY"=>"LY", "MAR"=>"MA", "MDG"=>"MG", "MLI"=>"ML", "MRT"=>"MR", "MUS"=>"MU", "MWI"=>"MW", "NAM"=>"NA",
	 "NER"=>"NE", "NGA"=>"NG", "REU"=>"RE", "RWA"=>"RW", "SYC"=>"SC", "SDN"=>"SD", "SHN"=>"SH", "SLE"=>"SL", "SEN"=>"SN",
	 "SOM"=>"SO", "SSD"=>"SS", "STP"=>"ST", "SWZ"=>"SZ", "TCD"=>"TD", "ATF"=>"TF", "TGO"=>"TG", "TUN"=>"TN", "TZA"=>"TZ",
	 "UGA"=>"UG", "MYT"=>"YT", "ZAF"=>"ZA", "ZMB"=>"ZM", "ZWE"=>"ZW")
end

# --------------------------------------------------------------------------------------------------
function iso3to2_na()
	Dict( "CAN"=>"CA", "MEX"=>"MX", "USA"=>"US")
end

"""
d = iso3to2_world()

	Creates a Dictionary that maps WORLD country code names from ISO3166A3 (3 shars) to ISO3166A2 (2 chars)
	It has 250 contry names.
"""
# --------------------------------------------------------------------------------------------------
function iso3to2_world()
Dict("AFG"=>"AF", "ALA"=>"AX", "ALB"=>"AL", "DZA"=>"DZ", "ASM"=>"AS", "AND"=>"AD", "AGO"=>"AO", "AIA"=>"AI", "ATA"=>"AQ",
	"ATG"=>"AG", "ARG"=>"AR", "ARM"=>"AM", "ABW"=>"AW", "AUS"=>"AU", "AUT"=>"AT", "AZE"=>"AZ", "BHS"=>"BS", "BHR"=>"BH",
	"BGD"=>"BD", "BRB"=>"BB", "BLR"=>"BY", "BEL"=>"BE", "BLZ"=>"BZ", "BEN"=>"BJ", "BMU"=>"BM", "BTN"=>"BT", "BOL"=>"BO",
	"BES"=>"BQ", "BIH"=>"BA", "BWA"=>"BW", "BVT"=>"BV", "BRA"=>"BR", "IOT"=>"IO", "BRN"=>"BN", "BGR"=>"BG", "BFA"=>"BF",
	"BDI"=>"BI", "KHM"=>"KH", "CMR"=>"CM", "CAN"=>"CA", "CPV"=>"CV", "CYM"=>"KY", "CAF"=>"CF", "TCD"=>"TD", "CHL"=>"CL",
	"CHN"=>"CN", "CXR"=>"CX", "CCK"=>"CC", "COL"=>"CO", "COM"=>"KM", "COG"=>"CG", "COD"=>"CD", "COK"=>"CK", "CRI"=>"CR",
	"CIV"=>"CI", "HRV"=>"HR", "CUB"=>"CU", "CUW"=>"CW", "CYP"=>"CY", "CZE"=>"CZ", "DNK"=>"DK", "DJI"=>"DJ", "DMA"=>"DM",
	"DOM"=>"DO", "ECU"=>"EC", "EGY"=>"EG", "SLV"=>"SV", "GNQ"=>"GQ", "ERI"=>"ER", "EST"=>"EE", "ETH"=>"ET", "FLK"=>"FK",
	"FRO"=>"FO", "FJI"=>"FJ", "FIN"=>"FI", "FRA"=>"FR", "GUF"=>"GF", "PYF"=>"PF", "ATF"=>"TF", "GAB"=>"GA", "GMB"=>"GM",
	"GEO"=>"GE", "DEU"=>"DE", "GHA"=>"GH", "GIB"=>"GI", "GRC"=>"GR", "GRL"=>"GL", "GRD"=>"GD", "GLP"=>"GP", "GUM"=>"GU",
	"GTM"=>"GT", "GGY"=>"GG", "GIN"=>"GN", "GNB"=>"GW", "GUY"=>"GY", "HTI"=>"HT", "HMD"=>"HM", "VAT"=>"VA", "HND"=>"HN",
	"HKG"=>"HK", "HUN"=>"HU", "ISL"=>"IS", "IND"=>"IN", "IDN"=>"ID", "IRN"=>"IR", "IRQ"=>"IQ", "IRL"=>"IE", "IMN"=>"IM",
	"ISR"=>"IL", "ITA"=>"IT", "JAM"=>"JM", "JPN"=>"JP", "JEY"=>"JE", "JOR"=>"JO", "KAZ"=>"KZ", "KEN"=>"KE", "KIR"=>"KI",
	"PRK"=>"KP", "KOR"=>"KR", "KWT"=>"KW", "KGZ"=>"KG", "LAO"=>"LA", "LVA"=>"LV", "LBN"=>"LB", "LSO"=>"LS", "LBR"=>"LR",
	"LBY"=>"LY", "LIE"=>"LI", "LTU"=>"LT", "LUX"=>"LU", "MAC"=>"MO", "MKD"=>"MK", "MDG"=>"MG", "MWI"=>"MW", "MYS"=>"MY",
	"MDV"=>"MV", "MLI"=>"ML", "MLT"=>"MT", "MHL"=>"MH", "MTQ"=>"MQ", "MRT"=>"MR", "MUS"=>"MU", "MYT"=>"YT", "MEX"=>"MX",
	"FSM"=>"FM", "MDA"=>"MD", "MCO"=>"MC", "MNG"=>"MN", "MNE"=>"ME", "MSR"=>"MS", "MAR"=>"MA", "MOZ"=>"MZ", "MMR"=>"MM",
	"NAM"=>"NA", "NRU"=>"NR", "NPL"=>"NP", "NLD"=>"NL", "NCL"=>"NC", "NZL"=>"NZ", "NIC"=>"NI", "NER"=>"NE", "NGA"=>"NG",
	"NIU"=>"NU", "NFK"=>"NF", "MNP"=>"MP", "NOR"=>"NO", "PSE"=>"PS", "OMN"=>"OM", "PAK"=>"PK", "PLW"=>"PW", "PAN"=>"PA",
	"PNG"=>"PG", "PRY"=>"PY", "PER"=>"PE", "PHL"=>"PH", "PCN"=>"PN", "POL"=>"PL", "PRT"=>"PT", "PRI"=>"PR", "QAT"=>"QA",
	"REU"=>"RE", "ROU"=>"RO", "RUS"=>"RU", "RWA"=>"RW", "BLM"=>"BL", "SHN"=>"SH", "KNA"=>"KN", "LCA"=>"LC", "MAF"=>"MF",
	"SPM"=>"PM", "VCT"=>"VC", "WSM"=>"WS", "SMR"=>"SM", "STP"=>"ST", "SAU"=>"SA", "SEN"=>"SN", "SRB"=>"RS", "SYC"=>"SC",
	"SLE"=>"SL", "SGP"=>"SG", "SXM"=>"SX", "SVK"=>"SK", "SVN"=>"SI", "SLB"=>"SB", "SOM"=>"SO", "ZAF"=>"ZA", "SGS"=>"GS",
	"SSD"=>"SS", "ESP"=>"ES", "LKA"=>"LK", "SDN"=>"SD", "SUR"=>"SR", "SJM"=>"SJ", "SWZ"=>"SZ", "SWE"=>"SE", "CHE"=>"CH",
	"SYR"=>"SY", "TWN"=>"TW", "TJK"=>"TJ", "TZA"=>"TZ", "THA"=>"TH", "TLS"=>"TL", "TGO"=>"TG", "TKL"=>"TK", "TON"=>"TO",
	"TTO"=>"TT", "TUN"=>"TN", "TUR"=>"TR", "TKM"=>"TM", "TCA"=>"TC", "TUV"=>"TV", "UGA"=>"UG", "UKR"=>"UA", "ARE"=>"AE",
	"GBR"=>"GB", "USA"=>"US", "UMI"=>"UM", "URY"=>"UY", "UZB"=>"UZ", "VUT"=>"VU", "VEN"=>"VE", "VNM"=>"VN", "VGB"=>"VG",
	"VIR"=>"VI", "WLF"=>"WF", "ESH"=>"EH", "YEM"=>"YE", "ZMB"=>"ZM", "ZWE"=>"ZW", "KSV"=>"XK")
end

# --------------------------------------------------------------------------------------------------
function mk_codes_values(codes::Vector{String}, vals; region::String="world")
	_region = lowercase(region)
	if     (_region == "world")  d = iso3to2_world()
	elseif (_region == "eu")     d = iso3to2_eu()
	else   error("The region $(region) is invalid or has not been implemented yet.")
	end
	ky, vl = String[], Float64[]
	for k = 1:length(codes)
		r = get(d, codes[k], "")
		if (r != "" && vals[k] !== missing)
			append!(ky, [r])
			append!(vl, vals[k])
		end
	end
	return ky, vl
end

#= --------------------------------------------------------------------------------------------------
function choropleth(polygs::Vector{<:GMTdataset}, colorval::Vector{<:Real}; kwargs...)
	d = KW(kwargs)
	data_ids, ind = get_segment_ids(polygs)
	zvals = make_zvals_vec(polygs, data_ids, colorval)
	C::GMTcpt = makecpt(T=(1,6,1))		# <==================================================== ERRADO
	((val = find_in_dict(d, [:fmt])[1]) !== nothing) && (fmt = arg2str(val))
	fmt::String = ((val = find_in_dict(d, [:fmt])[1]) !== nothing) ? arg2str(val) : "ps"
	see = (find_in_dict(d, [:show])[1] !== nothing) ? true : false
	val, symb = find_in_dict(d, [:savefig :name])
	if (val === nothing)
		plot(polygs, Z=zvals, L=true, G="+z", fmt=fmt, show=see, colorbar=true)
	else
		plot(polygs, Z=zvals, L=true, G="+z", name=string(d[symb]), fmt=fmt, show=see, colorbar=true)
	end
end
=#


text:
function start!(
  mcmc::MCMC{S, M},
  n_chains::Int64;
  attempts::Int64=5000) where {
  S <: DiseaseStateSequence,
  M <: ILM}
  if n_chains == 1
    return start!(mcmc, attempts)
  else
    pmeter = Progress(n_chains * attempts, "Initialization progress")
    pchannel = RemoteChannel(()->Channel{Bool}(10), 1)
    mc_Futures = Future[]
    for i = 1:n_chains
      @logmsg LogLevel(-3000) "Creating Markov chain $i initialization Future"
      push!(mc_Futures, @spawn initialize(MarkovChain, mcmc, pchannel, attempts=attempts))
    end
    @logmsg LogLevel(-2000) "$n_chains Markov chain initialization Futures successfully created"
    while !all(isready.(mc_Futures))
      take!(pchannel) && next!(pmeter)
    end
    close(pchannel)
    finish!(pmeter)
    markov_chains = [fetch(i) for i in mc_Futures]
    append!(mcmc.markov_chains, markov_chains[nothing.!==markov_chains])
    @logmsg LogLevel(-3000) "$(sum(nothing.!==markov_chains)) Markov chains successfully initialized"
    return mcmc
  end
end

function start!(
  mcmc::MCMC{S, M};
  attempts::Int64=5000) where {
  S <: DiseaseStateSequence,
  M <: ILM}
  mc = initialize(MarkovChain, mcmc, attempts=attempts)
  if mc !== nothing
    push!(mcmc.markov_chains, mc)
  else
    @error "Failed to initialize a Markov chain"
  end
  return mcmc
end


text:
tri_s = MYPolygon([0, 1, 1], [0, 0, 1])
tri_m = MYPolygon([0, √2, √2], [0, 0, √2])
tri_l = MYPolygon([0, 2, 2], [0, 0, 2])
square_s = MYPolygon([0, 1, 1, 0], [0, 0, 1, 1])
parallelogram = MYPolygon([0, √2, √(2)*3/2, √(2)/2], [0, 0, √(2)/2, √(2)/2])

# tri_m, square_s
house2 = MYPolygon([0, 1, 1, 1.5, 0.5, -0.5, 0], [0, 0, 1, 1, 2, 1, 1])
p_house2 = ("house2", house2, [tri_m, square_s])

# tri_l, tri_m, tri_s, tri_s
house4 = MYPolygon([-0.5*√2, 0.5*√2, 0.5*√2, √2, 0, -√2, -0.5*√2], [0, 0, √2, √2, 2*√2, √2, √2])
p_house4 = ("house4", house4, [tri_l, tri_m, tri_s, tri_s])

# tri_l, square_s
arrow2 = MYPolygon([0, 3, 1, 1, 0], [0, 0, 2, 1, 1])
p_arrow2 = ("arrow2", arrow2, [tri_l, square_s])

# tri_s, parallelogram
trapezoid2_1 = MYPolygon([-√2, √2, 0.5*√2, -0.5*√2], [0, 0, 0.5*√2, 0.5*√2])
p_trapezoid2_1 = ("trapezoid2_1", trapezoid2_1, [tri_s, parallelogram])

# tri_s, parallelogram
trapezoid2_2 = MYPolygon([0, 0.5*√2, 0, -√2], [0, 0.5*√2, √2, 0])
p_trapezoid2_2 = ("trapezoid2_2", trapezoid2_2, [tri_s, parallelogram])

# tri_s, square_s
tri_above_square = MYPolygon([0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 2, 3, 3, 2, 1])
p_tri_above_square = ("tri_above_square", tri_above_square, [tri_s, square_s])

# tri_s, square_s
fish2 = MYPolygon([0, 0.5*√2, √2, 0.5*√2, 0, -0.5*√2, -0.5*√2], [0, -0.5*√2, 0, 0.5*√2, 0, 0.5*√2, -0.5*√2])
p_fish2 = ("fish2", fish2, [tri_s, square_s])

# tri_m, tri_s
small_stand = MYPolygon([0, 1, 1, √2, 0], [0, 0, 1, √2, √2])
p_small_stand = ("small_stand", small_stand, [tri_m, tri_s])

# tri_m, tri_s, tri_s
triforce3 = MYPolygon([0, -1, -0.5*√2 - 1, 0.5*√2 - 1, -1, 1, 1 - 0.5*√2, 1 + 0.5*√2, 1], [1, 0, -0.5*√2, -0.5*√2, 0, 0, -0.5*√2, -0.5*√2, 0])
p_triforce3 = ("triforce3", triforce3, [tri_m, tri_s, tri_s])

# tri_s, tri_s, parallelogram
# tri_s, tri_s, square_s
rect_s = MYPolygon([0, 2, 2, 0], [0, 0, 1, 1])
p_rect_s = ("rect_s", rect_s, [tri_s, tri_s, parallelogram])

# tri_s, tri_s, parallelogram
hurt3 = MYPolygon([0, 1, 1, 0, -1, -1], [0, 1, 2, 1, 2, 1])
p_hurt3 = ("hurt3", hurt3 , [tri_s, tri_s, parallelogram])

# tri_m, tri_s, tri_s, parallelogram
# tri_m, tri_s, tri_s, square_s
hexagon_m = MYPolygon([0, √2, 2.12132, √2, 0, -0.7071068], [0, 0, 0.7071068, √2, √2, 0.7071068])
p_hexagon_m1 = ("hexagon_m", hexagon_m, [tri_m, tri_s, tri_s, parallelogram])
p_hexagon_m2 = ("hexagon_m", hexagon_m, [tri_m, tri_s, tri_s, square_s])

# tri_m, tri_s, tri_s
square_3 = MYPolygon([0, √2, √2, 0], [0, 0, √2, √2])
p_square_3 = ("square_3", square_3, [tri_m, tri_s, tri_s])

# tri_l, tri_s, tri_s, square_s
# tri_l, tri_m, tri_s, square_s
# tri_l, tri_s, tri_s, parallelogram
square_4 = MYPolygon([0, 2, 2, 0], [0, 0, 2, 2])
p_square_4 = ("square_4", square_4, [tri_l, tri_s, tri_s, square_s])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
square_7 = MYPolygon([0, 2*√2, 2*√2, 0], [0, 0, 2*√2, 2*√2])
p_square_7 = ("square_7", square_7, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_m, tri_s, tri_s
butterfly_s = MYPolygon([0, -1, 1, 0, 1, -1], [0, -1, -1, 0, 1, 1])
p_butterfly_s = ("butterfly_s", butterfly_s, [tri_m, tri_s, tri_s])

# tri_l, tri_l
butterfly = MYPolygon([0, √2, 2*√2, 2*√2, √2, 0], [0, √2, 0, 2*√2, √2, 2*√2])
p_butterfly = ("butterfly", butterfly, [tri_l, tri_l])

# tri_l, tri_l
pesudo_butterfly = MYPolygon([-1.16, -0.25, 1.16, 1.16, 0.25, -1.16], [-1.16, -0.25, -1.67, 1.16, 0.25, 1.67])
p_pesudo_butterfly = ("pesudo_butterfly", pesudo_butterfly, [tri_l, tri_l])

# tri_l, tri_l, tri_s, tri_s
butterfly4 = MYPolygon([-√2, -0.5*√2, -0.5*√2, -√2, √2, 0.5*√2, 0.5*√2, √2], [√2, 0.5*√2, -0.5*√2, -√2, -√2, -0.5*√2, 0.5*√2, √2])
p_butterfly4 = ("butterfly4", butterfly4, [tri_l, tri_l, tri_s, tri_s])

# tri_s, square_s, parallelogram
note = MYPolygon([0, 0.5*√2, 0.5*√2, 1.70, 0, 0, -0.5*√2], [-0.5*√2, 0, 0.413, 0.413, 1.5*√2, 0.5*√2, 0])
p_note = ("note", note, [tri_s, square_s, parallelogram])

# tri_l, tri_s, parallelogram
diamond3 = MYPolygon([0, √2, 0.5*√2, -0.5*√2, -√2], [-√2, 0, 0.5*√2, 0.5*√2, 0])
p_diamond = ("diamond", diamond3, [tri_l, tri_s, parallelogram])

# tri_l, tri_s, tri_s, square_s
antena = MYPolygon([-√2, √2, 0, 0.5*√2, 0.5*√2, -√2, 0], [0, 0, √2, 1.5*√2, 3.53, √2, √2])
p_antena = ("antena", antena, [tri_l, tri_s, tri_s, square_s])

# tri_l, tri_m, tri_s, square_s
pencile4 = MYPolygon([0, √2, √2, 0.5*√2, 0], [0, 0, 2*√2, 2.5*√2, 2*√2])
p_pencile4 = ("pencile4", pencile4, [tri_l, tri_m, tri_s, square_s])

# tri_l, tri_s, tri_s
# tri_m, tri_s, tri_s, square_s
# tri_m, tri_s, tri_s, parallelogram
crown4 = MYPolygon([-√2, √2, √2, 0.5*√2, 0, -0.5*√2, -√2], [0, 0, √2, 0.5*√2, √2, 0.5*√2, √2])
p_crown = ("crown", crown4, [tri_l, tri_s, tri_s])

# tri_l, tri_l, tri_s, tri_s
snake = MYPolygon([-2, -1, -1, 1, 1, 0, 0, -2], [-2, -2, -1, -1, 1, 1, 0, 0])
p_snake = ("snake", snake, [tri_l, tri_l, tri_s, tri_s])

# tri_m, tri_s, tri_s, square_s, parallelogram
hexagon_5 = MYPolygon([-1.5, -0.5, 0.5, 1.5, 0.5, -0.5], [0, -1, -1, 0, 1, 1])
p_hexagon5 = ("hexagon5", hexagon_5, [tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_s, tri_s, tri_s, tri_s, tri_s, tri_s
egu_force = MYPolygon([-1, 0, -1, 0, 0, 1, -1, 0, 0, 1, 1, 2, -1], [-2, -1, -1, 0, -1, 0, 0, 1, 0, 1, 0, 1, 1])
p_egu_force = ("egu_force", egu_force, [tri_s, tri_s, tri_s, tri_s, tri_s, tri_s])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
faucet = MYPolygon([-2, -1, -1, 2, 2, 1, 1, 2, -1, 0, 0, -2], [-2, -2, -1, -1, 0, 0, 1, 2, 2, 1, 0, 0])
p_faucet = ("faucet", faucet, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_l, tri_m, tri_s, square_s, parallelogram
Taiikusuwaring_human = MYPolygon([1, -0.5*√2, -√2, -0.5*√2, -2, -√2, -1.5*√2, -0.5*√2, 1-√2, 1], [0, 1+0.5*√2, 1, 0.291, -1, -1, -1-0.5*√2, -1-0.5*√2, -√2, √2])
p_Taiikusuwari = ("Taiikusuwari", Taiikusuwaring_human, [tri_l, tri_m, tri_s, square_s, parallelogram])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
crab_scissor = MYPolygon([0, √2, √2, 1.5*√2, 0.5*√2, 0.5*√2, 0.5*√2-1, 0.5*√2-1, -1-0.5*√2, -0.5*√2, -0.5*√2, -√2, -0.5*√2], [0, 0, √2, 1.5*√2, 2.5*√2, 1+0.5*√2, 1+0.5*√2, 1+2.5*√2, 1+1.5*√2, 1.5*√2, 0.5*√2, 0, -0.5*√2])
p_crab_scissor = ("crab_scissor", crab_scissor, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
candy7 = MYPolygon([-1.5-√2, -1.5, -0.5, 0.5, 1.5, 1.5+√2, 1.5+√2, 1.5, 0.5, -0.5, -1.5, -1.5-√2], [-√2, 0, -1, -1, 0, -√2, √2, 0, 1, 1, 0, √2])
p_candy7 = ("candy7", candy7, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# ミスアリ tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
flame6 = MYPolygon([0, -0.5, -0.5, -1, 0, -√2, -0.5*√2, -0.5*√2, -√2, √2, 0.5*√2, 0.5*√2, √2, 0, 1, 0.5, 0.5], [2, 2, 1, 1, 0, 0, -0.5*√2, -1.5*√2, -2*√2, -2*√2, -1.5*√2, -0.5*√2, 0, 0, 1, 1, 2])
# p_flame6 = ("flame6", flame6, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
flame7 = MYPolygon([1, 0, 0, -0.5, -0.5, -1, 0, -√2, -0.5*√2, -0.5*√2, -√2, √2, 0.5*√2, 0.5*√2, √2, 0, 1, 0.5, 0.5, 0, 1], [4, 3, 2, 2, 1, 1, 0, 0, -0.5*√2, -1.5*√2, -2*√2, -2*√2, -1.5*√2, -0.5*√2, 0, 0, 1, 1, 2, 2, 3])
p_flame7 = ("flame7", flame7, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
hurt7 = MYPolygon([-2, -1, -1, -0.294, 0, 2, √2, 0.5*√2, 1, 1, 0, 0, -0.5*√2, -√2, -0.5*√2, -√2], [0, -1, -1-√2, -1-0.5*√2, -2, 0, 0, 0.5*√2, 1, 2, 1, √2, 1.5*√2, √2, 0.5*√2, 0])
p_hurt7 = ("hurt7", hurt7, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

# tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram
katana = MYPolygon([-1, 0, 1, 2, 1.22, 5.63, 5.63, 4.62, 4.62, 3.20, 3.20, 1.21, 1.21, 0, 0, -1],
                   [0, 0, 1, 1, 1.79, 6.21, 7.21, 6.22, 5.21, 5.21, 3.79, 3.79, 1.79, 3, 2, 1])
p_katana = ("katana", katana, [tri_l, tri_l, tri_m, tri_s, tri_s, square_s, parallelogram])

max_stars_repo_name: toshiki-kosen/SolvingTangramPuzzle

max_issues_repo_name: toshiki-kosen/SolvingTangramPuzzle

max_forks_repo_name: toshiki-kosen/SolvingTangramPuzzle


text:
@testset "700.search-in-a-binary-search-tree.jl" begin
    @test search_bst(TreeNode{Int}([4, 2, 7, 1, 3]), 2) == TreeNode{Int}([2, 1, 3])
    @test search_bst(TreeNode{Int}([4, 2, 7, 1, 3]), 5) === nothing
end