text:
using Statistics
using Test
using DelimitedFiles
import MLJBase
const Mlj = MLJBase
using StableRNGs
using BetaML

#TESTRNG = FIXEDRNG # This could change...
TESTRNG = StableRNG(123)

println("*** Testing Perceptron algorithms...")

# ==================================
# TEST 1: Normal perceptron
println("Going through Test1 (normal Perceptron)...")

perceptronData     = readdlm(joinpath(@__DIR__,"data/binary2DData.csv"),'\t')
x = copy(perceptronData[:,[2,3]])
y = convert(Array{Int64,1},copy(perceptronData[:,1]))
ntrain = Int64(round(length(y)*0.8))
xtrain = x[1:ntrain,:]
ytrain = y[1:ntrain]
xtest = x[ntrain+1:end,:]
ytest = y[ntrain+1:end]
classes = unique(y)
out      = perceptron(xtrain, ytrain, shuffle=false,nMsgs=0)
ŷtrain    = predict(xtrain,out.θ,out.θ₀,out.classes)
ϵtrain    = error(ytrain, mode(ŷtrain))
ŷtest    = predict(xtest,out.θ,out.θ₀,classes)
outTest  = perceptron(xtrain, ytrain, shuffle=false,nMsgs=0,returnMeanHyperplane=true)
ŷavgtest = predict(xtest,outTest.θ,outTest.θ₀,outTest.classes)
ϵ        = error(ytest, mode(ŷtest))
ϵavg     = error(ytest, mode(ŷavgtest))
@test ϵ    < 0.03
@test ϵavg < 0.2

println("Testing multiple classes...")

#xtrain = [3 4 5; 5 3 5; 3 7 2; 8 5 3; 4 2 3; 3 2 1; 8 3 4; 3 5 1; 1 9 3; 4 2 1]
xtrain = rand(TESTRNG,100,3)
ytt    = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtrain))]
ytrain = [i > median(ytt)*1.1 ? "big" :  i > median(ytt)*0.9 ? "avg" : "small" for i in ytt]
#xtest  = [2 2 3; 3 2 2; 4 1 2; 4 3 2; 3 7 2]
xtest = rand(TESTRNG,20,3)
ytt2   = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtest))]
ytest  = [i > median(ytt2)*1.1 ? "big" :  i > median(ytt2)*0.9 ? "avg" : "small" for i in ytt2]

out    = perceptron(xtrain,  ytrain, shuffle=false,nMsgs=0)
ŷtrain = predict(xtrain,out.θ,out.θ₀,out.classes)
ŷtest  = predict(xtest,out.θ,out.θ₀,out.classes)
ϵtrain = error(ytrain, mode(ŷtrain))
ϵtest  = error(ytest, mode(ŷtest))

@test ϵtrain  < 0.4
@test ϵavg    < 0.4

# ==================================
# Test 2: Kernel Perceptron
# ==================================
println("Going through Test2 (Kernel Perceptron)...")

xtrain = [3 4 5; 5 3 5; 3 7 2; 8 5 3; 4 2 3; 3 2 1; 8 3 4; 3 5 1; 1 9 3; 4 2 1]
ytt    = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtrain))]
ytrain = [i > median(ytt) ? 1 : -1 for i in ytt]
xtest  = [ 3 7 2; 2 2 3; 3 2 2; 4 1 2; 4 3 2;]
#xtest = xtrain
ytt2    = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtest))]
ytest = [i > median(ytt2) ? 1 : -1 for i in ytt2]
#out   = kernelPerceptron(xtrain, ytrain, K=polynomialKernel,rShuffle=true,nMsgs=100)
#ŷtest = predict(xtest,out[1][1],out[1][2],out[1][3], K=polynomialKernel)
out   = kernelPerceptronBinary(xtrain, ytrain, K=radialKernel,shuffle=false,nMsgs=0,α=ones(Int64,length(ytrain)))
# the same: out   = kernelPerceptronBinary(xtrain, ytrain, K=radialKernel,shuffle=false,nMsgs=0)
ŷtest = predict(xtest,out.x,out.y,out.α, K=out.K)
ϵ = error(ytest, ŷtest)
ŷtestExpected = [1,-1,-1,-1,-1]
@test ϵ ≈ 0.2
#@test any(isapprox(ŷtestExpected,ŷtest))
@test any(ŷtestExpected == ŷtest )

# Multiclass..
outMultiClass   = kernelPerceptron(xtrain, ytrain, K=radialKernel,shuffle=false,nMsgs=0)
ŷtest = predict(xtest,outMultiClass.x,outMultiClass.y,outMultiClass.α, outMultiClass.classes,K=outMultiClass.K)
ϵ = error(ytest, mode(ŷtest))
ŷtestExpected = [1,-1,-1,-1,-1]
@test ϵ ≈ 0.2
#@test any(isapprox(ŷtestExpected,ŷtest))
@test any(ŷtestExpected == mode(ŷtest) )

xtrain = rand(TESTRNG,100,3)
ytt    = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtrain))]
ytrain = [i > median(ytt)*1.1 ? "big" :  i > median(ytt)*0.9 ? "avg" : "small" for i in ytt]
#xtest  = [2 2 3; 3 2 2; 4 1 2; 4 3 2; 3 7 2]
xtest = rand(TESTRNG,20,3)
ytt2   = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtest))]
ytest  = [i > median(ytt2)*1.1 ? "big" :  i > median(ytt2)*0.9 ? "avg" : "small" for i in ytt2]

out    = kernelPerceptron(xtrain,  ytrain, shuffle=false,nMsgs=0,T=1000)
ŷtrain = predict(xtrain,out.x,out.y,out.α, out.classes,K=out.K)
ŷtest  = predict(xtest,out.x,out.y,out.α, out.classes,K=out.K)
ϵtrain = error(ytrain, mode(ŷtrain))
ϵtest  = error(ytest, mode(ŷtest))

@test ϵtrain  < 0.1
@test ϵtest   < 0.8

# ==================================
# Test 3: Pegasos
# ==================================
println("Going through Test3 (Pegasos)...")

perceptronData     = readdlm(joinpath(@__DIR__,"data/binary2DData.csv"),'\t')
x = copy(perceptronData[:,[2,3]])
y = convert(Array{Int64,1},copy(perceptronData[:,1]))
xtrain = x[1:160,:]
ytrain = y[1:160]
xtest  = x[161:end,:]
ytest  = y[161:end]

out   = pegasos(xtrain, ytrain, shuffle=false, nMsgs=0)
ŷtest = predict(xtest,out.θ,out.θ₀,out.classes)
outAvg   = pegasos(xtrain, ytrain, shuffle=false, nMsgs=0, returnMeanHyperplane=true)
ŷavgtest = predict(xtest,outAvg.θ,outAvg.θ₀,outAvg.classes)
ϵ = error(ytest, mode(ŷtest))
ϵavg = error(ytest, mode(ŷavgtest))
@test ϵ ≈ 0.025
@test ϵavg ≈ 0.1

println("Testing pegasos with multiple classes...")

#xtrain = [3 4 5; 5 3 5; 3 7 2; 8 5 3; 4 2 3; 3 2 1; 8 3 4; 3 5 1; 1 9 3; 4 2 1]
xtrain = rand(TESTRNG,100,3)
ytt    = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtrain))]
ytrain = [i > median(ytt)*1.1 ? "big" :  i > median(ytt)*0.9 ? "avg" : "small" for i in ytt]
#xtest  = [2 2 3; 3 2 2; 4 1 2; 4 3 2; 3 7 2]
xtest = rand(TESTRNG,20,3)
ytt2   = [(0.5*x[1]+0.2*x[2]^2+0.3*x[3]+1) for (i,x) in enumerate(eachrow(xtest))]
ytest  =  [i > median(ytt2)*1.1 ? "big" :  i > median(ytt)*0.9 ? "avg" : "small" for i in ytt2]

out    = pegasos(xtrain,  ytrain, shuffle=false,nMsgs=0)
ŷtrain = predict(xtrain,out.θ,out.θ₀,out.classes)
ŷtest  = predict(xtest,out.θ,out.θ₀,out.classes)
ϵtrain = error(ytrain, mode(ŷtrain))
ϵtest  = error(ytest, mode(ŷtest))

@test ϵtrain  <= 0.8 # this relation is not linear, normal error is big
@test ϵtest   <= 0.8

# ==================================
# NEW TEST
println("Testing classification of the sepal database using perceptron algorithms...")
iris = readdlm(joinpath(@__DIR__,"data","iris_shuffled.csv"),',',skipstart=1)
x = convert(Array{Float64,2}, iris[:,1:4])
y = convert(Array{String,1}, iris[:,5])

ntrain = Int64(round(size(x,1)*0.8))
xtrain = x[1:ntrain,:]
ytrain = y[1:ntrain]
xtest = x[ntrain+1:end,:]
ytest = y[ntrain+1:end]

model = perceptron(xtrain,ytrain)
ŷtrain = predict(xtrain,model.θ,model.θ₀,model.classes)
@test accuracy(mode(ŷtrain),ytrain) >= 0.79
ŷtest = predict(xtest,model.θ,model.θ₀,model.classes)
@test accuracy(mode(ŷtest),ytest)  >= 0.9

model = kernelPerceptron(xtrain,ytrain)
ŷtrain = predict(xtrain,model.x,model.y,model.α,model.classes)
@test accuracy(mode(ŷtrain),ytrain) >= 0.9
ŷtest = predict(xtest,model.x,model.y,model.α,model.classes)
@test accuracy(mode(ŷtest),ytest)  >= 0.9

model = pegasos(xtrain,ytrain)
ŷtrain = predict(xtrain,model.θ,model.θ₀,model.classes)
@test accuracy(mode(ŷtrain),ytrain) >= 0.64
ŷtest = predict(xtest,model.θ,model.θ₀,model.classes)
@test accuracy(mode(ŷtest),ytest)  >= 0.76

# ==================================
# NEW TEST
println("Testing MLJ interface for Perceptron models....")

X, y                           = Mlj.@load_iris

model                          = PerceptronClassifier(rng=copy(TESTRNG))
regressor                      = Mlj.machine(model, X, y)
(fitresult, cache, report)     = Mlj.fit(model, 0, X, y)
yhat                           = Mlj.predict(model, fitresult, X)
@test Mlj.mean(Mlj.LogLoss(tol=1e-4)(yhat, y)) < 3.1

model                          = KernelPerceptronClassifier(rng=copy(TESTRNG))
regressor                      = Mlj.machine(model, X, y)
(fitresult, cache, report)     = Mlj.fit(model, 0, X, y)
yhat                           = Mlj.predict(model, fitresult, X)
@test Mlj.mean(Mlj.LogLoss(tol=1e-4)(yhat, y)) < 0.5

model                          = PegasosClassifier(rng=copy(TESTRNG))
regressor                      = Mlj.machine(model, X, y)
(fitresult, cache, report)     = Mlj.fit(model, 0, X, y)
yhat                           = Mlj.predict(model, fitresult, X)
@test Mlj.mean(Mlj.LogLoss(tol=1e-4)(yhat, y)) < 1.3


text:
using BasicBSplineExporter
using Test
using Random
using BasicBSpline
using Colors
using StaticArrays
import BasicBSplineExporter._arrayofvector2array
import BasicBSplineExporter._array2arrayofvector

@testset "BasicBSplineExporter.jl" begin
    Random.seed!(42)
    include("test_BSplineManifold.jl")
end

ext: jl


text:
#!/usr/bin/env julia
# =======================================================================================
#
#      Author:   Thomas Gruber (tg), thomas.gruber@fau.de
#      Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
#
#      Permission is hereby granted, free of charge, to any person obtaining a copy
#      of this software and associated documentation files (the "Software"), to deal
#      in the Software without restriction, including without limitation the rights
#      to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#      copies of the Software, and to permit persons to whom the Software is
#      furnished to do so, subject to the following conditions:
#
#      The above copyright notice and this permission notice shall be included in all
#      copies or substantial portions of the Software.
#
#      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#      SOFTWARE.
#
# =======================================================================================

using Printf

const NTIMES = Int64(10)

function striad_seq(A::Array{Float64,1}, B::Array{Float64,1}, C::Array{Float64,1}, D::Array{Float64,1}, vsize::Int64, iters::Int64)
    for i in 1:iters
        @inbounds for j in 1:vsize
            A[j] = B[j] + C[j] * D[j]
        end
    end
    return nothing
end

function striad_ws(A::Array{Float64,1}, B::Array{Float64,1}, C::Array{Float64,1}, D::Array{Float64,1}, vsize::Int64, iters::Int64)
    for i in 1:iters
        Threads.@threads for j in 1:vsize
            @inbounds A[j]= B[j] + C[j] * D[j]
        end
    end
    return nothing
end

function striad_tp(A::Array{Float64,1}, B::Array{Float64,1}, C::Array{Float64,1}, D::Array{Float64,1}, vsize::Int64, iters::Int64)
    tasks = Vector{Task}(undef, Threads.nthreads())
    for t in 1:Threads.nthreads()
        AL = zeros(Float64, vsize)
        tasks[t] = Threads.@spawn striad_seq(AL, B, C, D, vsize, iters)
    end
    for t in 1:Threads.nthreads()
        wait(tasks[t])
    end
end

function usage()
    @printf("Usage: %s <test type>  <N>\n", PROGRAM_FILE)
    println("Test types: 0 - sequential, 1 - throughput, 2 - worksharing")
end

function main()
    typ = 0
    VECTORSIZE:Int64 = 1
    iters::Int64 = 5
    func = striad_seq

    if size(ARGS, 1) != 2
        usage()
        exit(0)
    else
        if ARGS[1] == "0"
            func = striad_seq
            typ = 0
        elseif ARGS[1] == "1"
            func = striad_tp
            scale = Threads.nthreads()
            typ = 1
        elseif ARGS[1] == "2"
            func = striad_ws
            typ = 2
        else
            @printf("Unknown test type: %s\n", ARGS[1])
            exit(1)
        end
        VECTORSIZE = parse(Int64, ARGS[2])
    end

    A = zeros(Float64, VECTORSIZE)
    B = zeros(Float64, VECTORSIZE)
    C = zeros(Float64, VECTORSIZE)
    D = zeros(Float64, VECTORSIZE)

    avgtime = 0
    mintime = 10000000
    maxtime = 0

    for j in 1:VECTORSIZE
        A[j] = 2.0
        B[j] = 1.0
        C[j] = 0.8
        D[j] = 1.01
    end

    times = zeros(Float64, NTIMES)

    while times[1] < 0.3
        times[1] = @elapsed func(A, B, C, D, VECTORSIZE, iters)
        if times[1] > 0.1 break end
        factor = 0.3 / (times[1] - times[2])
        iters = iters * floor(factor)
        times[2] = times[1]
    end

    for k in 1:NTIMES
        times[k] = @elapsed func(A, B, C, D, VECTORSIZE, iters)
    end

    for k in 2:NTIMES
        avgtime = avgtime + times[k]
        mintime = min(mintime, times[k])
        maxtime = max(maxtime, times[k])
    end

    kB = 4.0 * VECTORSIZE * sizeof(Float64)
    flops = 2.0 * VECTORSIZE * iters

    @printf("%.2f %.2f\n", 1.0E-03 * kB, 1.0E-06 * flops/mintime)
end

main()

max_stars_repo_name: RRZE-HPC/TheBandwidthBenchmarkGame

max_issues_repo_name: RRZE-HPC/TheBandwidthBenchmarkGame

max_forks_repo_name: RRZE-HPC/TheBandwidthBenchmarkGame


text:
import GZip
"""
    function gt600()
---
1. Phase the genotypes with beagle
2. Convert results to array
3.
"""
function gt600()
    rst = joinpath(dat_dir, "run")
    fra = joinpath(dat_dir, "real/nofima/for_CMSEdit")
    Nₑ  = 100

    @info join(["",
                "Remove SNP of duplicates and unknown postions",
                "  - See data/real/nofima/plink.sh"], "\n")

    @info "Phasing with beagle.jar"

    # make alleles to C/T, and replace positions, so that beagle can phase them
    GZip.open("$rst/b.vcf.gz", "w") do io
        i = 0
        for line in eachline(GZip.open("$rst/a.vcf.gz", "r"))
            if line[1] == '#'
                write(io, line, "\n")
            else
                i += 1
                t  = split(line)
                t[4] = "T"
                t[5] = "C"
                write(io, join(t, "\t"), "\n")
            end
        end
    end

    # phasing
    run(`java -jar $beagle gt=$rst/b.vcf.gz ne=$Nₑ out=$rst/c`)
end

"""
    function vcf2dic(vcf)
---
Read chromosome and haplotypes from a `vcf` file of **gzip** format.
Returns a Dictionary: pos=>[chr, bp], hap=>hap of chr8[][].
Each column of hap is a haplotype across genome.
"""
function vcf2dic(vcf)
    GZip.open(vcf, "r") do io
        # skip vcf header and determine N_ID
        nid = 0
        for line in eachline(io)
            if line[2] != '#'
                nid = length(split(line)) - 9
                break
            end
        end
        pos = Int[]
        hap = Int8[]
        for line in eachline(io)
            f = split(line)
            append!(pos, parse.(Int, f[1:2]))
            append!(hap, parse.(Int8, collect(join(f[10:end], ' ')[1:2:end])))
        end
        pos = reshape(pos, (2, :))'
        r   = haldane(pos)
        hap = reshape(hap, (nid*2, :))'
        Dict(:pos => pos,
             :r => r,
             :hap => Bool.(hap))
    end
end


text:
using SimilaritySearch
using Test

@testset "Result set" begin
    k=4
    V = rand(Float32, k*k)
    Vsorted = sort(V)[1:k]

    bigres = KnnResult(BigInt, k)
    res = KnnResult(k)
    sres = KnnResult(k)
    nn = NnResult()

    for i=1:length(V)
        push!(res, i, V[i])
        push!(sres, i, V[i])
        push!(nn, i, V[i])
        push!(bigres, BigInt(i), V[i])
    end
    @test [x.objID for x in res] == [x.objID for x in sres]
    @test [x.dist for x in res] == [x.dist for x in sres] == Vsorted
    @test first(nn).dist == Vsorted[1]
end


text:
using Genie.Router, Genie.Renderer
using MyLib
using BooksController
using BooksController.API

route("/") do
  serve_static_file("/welcome.html")
end

route("/hello") do
  "Welcome to Genie!"
end

route("/friday") do
  MyLib.isitfriday() ? "Yes, it's Friday!" : "No, not yet :("
end

route("/bgbooks", BooksController.billgatesbooks)
route("/bgbooks/list", BooksController.index, named = :list_books)
route("/bgbooks/flaxlist", BooksController.flaxtest)
route("/bgbooks/new", BooksController.new)
route("/bgbooks/create", BooksController.create, method = POST, named = :create_book)
route("/bgbooks/:id::Int/edit", BooksController.edit, named = :edit_book)
route("/bgbooks/:id::Int/update", BooksController.update, method = POST, named = :update_book)

route("/api/v1/bgbooks", BooksController.API.billgatesbooks)
route("/api/v1/jsontest", BooksController.API.jsontest)

max_stars_repo_name: tetsugps/julia

max_issues_repo_name: tetsugps/julia

max_forks_repo_name: tetsugps/julia


text:
using CSV

df = CSV.File(joinpath(@__DIR__, "benchmarks.csv"))

# Display formatted table

function pretty_print(io, x::Number)
    d, r = fldmod(x, 1)
    r ≈ 0 ? print(io, Int(d)) : print(io, x)
end

function print_benchmarks(io, df)
    print(io, raw"""
    \begin{tabular}{llllll}
        \hline
        \textbf{machine} & \textbf{size} & \textbf{device} & \textbf{forward (\si{\milli\second})} & \textbf{backward (\si{\milli\second})} & \textbf{ratio} \\ \hline
    """)
    for row in df
        print(io, "    ")
        print(io, row.machine)
        print(io, " & ")
        print(io, row.problemsize)
        print(io, " & ")
        print(io, row.device)
        print(io, " & ")
        pretty_print(io, round(row.forward / 1000, sigdigits=5))
        print(io, " & ")
        pretty_print(io, round(row.backward / 1000, sigdigits=5))
        print(io, " & ")
        pretty_print(io, round(row.backward / row.forward, digits=3))
        print(io, raw" \\ ")
        print(io, '\n')
    end
    print(io, raw"""
        \hline
    \end{tabular}
    """)
end

print_benchmarks(stdout, df)

# Display figure

using AlgebraOfGraphics, CairoMakie
set_aog_theme!()

passes = [:forward, :backward]

plt = data(df) * mapping(
    :machine => sorter("dense", "convolution", "recurrent"),
    passes .=> (t -> (t / 1000)) .=> "runtime (μs)",
    color = dims(1) => renamer(passes) => "pass",
    dodge = dims(1) => renamer(passes) => "pass",
    col = :device,
    row = :problemsize => renamer("small" => "small size", "medium" => "medium size")
)

fig = Figure(resolution=(600, 800))

ag = draw!(
    fig, plt * visual(BarPlot, fillto = 1, dodge_gap = 0.),
    axis=(xticklabelrotation=π/6, yscale=log10, yticks= LogTicks(LinearTicks(6)))
)
legend!(fig[0, 1:2], ag, orientation=:horizontal)

display(fig)


text:
# Julia wrapper for header: /usr/include/libavcodec/qsv.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0

export
    av_qsv_alloc_context

function av_qsv_alloc_context()
    ccall((:av_qsv_alloc_context, libavcodec), Ptr{AVQSVContext}, ())
end


text:
# Use baremodule to shave off a few KB from the serialized `.ji` file
baremodule primecount_jll
using Base
using Base: UUID
using LazyArtifacts
Base.include(@__MODULE__, joinpath("..", ".pkg", "platform_augmentation.jl"))
import JLLWrappers

JLLWrappers.@generate_main_file_header("primecount")
JLLWrappers.@generate_main_file("primecount", UUID("ba3b429d-c409-5a27-9e45-21aab9233266"))
end  # module primecount_jll


text:
include("run_mms.jl")

let
    N0 = 48
    αs = (1, 4, 16, 64, 128)
    @show cfls = 2.0 .^ (0:-1:-5)

    for sbp_order in (2, 4, 6)
        for characteristic_method in (true, false)
            for α in αs
                @show (sbp_order, characteristic_method, α)
                for cfl in cfls
                    ϵ = main(
                        sbp_order,
                        1,
                        N0;
                        characteristic_method = characteristic_method,
                        cfl = cfl,
                        friction = (V) -> α * asinh(V),
                        tspan = (0.0, 0.1),
                        do_output = false,
                    )[1]
                    @show (cfl, ϵ)
                end
                println()
            end
        end
    end
end


text:
using Random
using Images, CoordinateTransformations
using ImageView
using Base.Iterators: partition
path="/home/terasaki/dataSSD120GB/food-101/images/escargots/3547563.jpg"
img = load(path)

function preprocess(im)
  im = channelview(imresize(im, (224, 224))) .* 255
  im .-= [123.68, 116.779, 103.939]
  #im = permutedims(im, (3, 2, 1))
end

@show size(channelview(img))
img1 = preprocess(img)
img2 = preprocess(img)
img3 = preprocess(img)

@show size(img1)
imageset=[preprocess(img) for _ in 1:20]
concatenated = cat(imageset..., dims=4)
@show size(concatenated[:,:,:,1:3])
a = [concatenated[:,:,:,b] for b in partition(1:20,4)]
@show size(a[1])

max_stars_repo_name: terasakisatoshi/juliaExer

max_issues_repo_name: terasakisatoshi/juliaExer

max_forks_repo_name: terasakisatoshi/juliaExer


text:
"""
    SparseCat(values, probabilities)

Create a sparse categorical distribution.

`values` is an iterable object containing the possible values (can be of any type) in the distribution that have nonzero probability. `probabilities` is an iterable object that contains the associated probabilities.

This is optimized for value iteration with a fast implementation of `weighted_iterator`. Both `pdf` and `rand` are order n.
"""
struct SparseCat{V, P}
    vals::V
    probs::P
end

# handle cases where probs is an array of something other than numbers (issue #35)
function SparseCat(v, p::AbstractArray)
    cp = try
        convert(AbstractArray{Float64}, p)
    catch
        @error("Couldn't convert all probabilities to Float64 when creating a SparseCat distribution. Did you get the arguments in the right order?", values=v, probabilities=p)
        rethrow()
    end
    SparseCat(v, cp)
end
# the method above gets all arrays *except* ones that have a numeric eltype, which are handled below
SparseCat(v, p::AbstractArray{<:Number}) = SparseCat{typeof(v), typeof(p)}(v, p)

function rand(rng::AbstractRNG, s::Random.SamplerTrivial{<:SparseCat})
    d = s[]
    r = sum(d.probs)*rand(rng)
    tot = zero(eltype(d.probs))
    for (v, p) in d
        tot += p
        if r < tot
            return v
        end
    end
    if sum(d.probs) <= 0.0
        error("""
              Tried to sample from a SparseCat distribution with probabilities that sum to $(sum(d.probs)).

              vals = $(d.vals)

              probs = $(d.probs)
              """)
    end
    error("Error sampling from SparseCat distribution with vals $(d.vals) and probs $(d.probs)") # try to help with type stability
end

# slow linear search :(
function pdf(d::SparseCat, s)
    for (v, p) in d
        if v == s
            return p
        end
    end
    return zero(eltype(d.probs))
end

function pdf(d::SparseCat{V,P}, s) where {V<:AbstractArray, P<:AbstractArray}
    for (i,v) in enumerate(d.vals)
        if v == s
            return d.probs[i]
        end
    end
    return zero(eltype(d.probs))
end

support(d::SparseCat) = d.vals

weighted_iterator(d::SparseCat) = d

# iterator for general SparseCat
# this has some type stability problems
function Base.iterate(d::SparseCat)
    val, vstate = iterate(d.vals)
    prob, pstate = iterate(d.probs)
    return ((val=>prob), (vstate, pstate))
end
function Base.iterate(d::SparseCat, dstate::Tuple)
    vstate, pstate = dstate
    vnext = iterate(d.vals, vstate)
    pnext = iterate(d.probs, pstate)
    if vnext == nothing || pnext == nothing
        return nothing
    end
    val, vstate_next = vnext
    prob, pstate_next = pnext
    return ((val=>prob), (vstate_next, pstate_next))
end

# iterator for SparseCat with indexed members
const Indexed = Union{AbstractArray, Tuple, NamedTuple}

function Base.iterate(d::SparseCat{V,P}, state::Integer=1) where {V<:Indexed, P<:Indexed}
    if state > length(d)
        return nothing
    end
    return (d.vals[state]=>d.probs[state], state+1)
end

Base.length(d::SparseCat) = min(length(d.vals), length(d.probs))
Base.eltype(D::Type{SparseCat{V,P}}) where {V, P} = Pair{eltype(V), eltype(P)}
sampletype(D::Type{SparseCat{V,P}}) where {V, P} = eltype(V)
Random.gentype(D::Type{SparseCat{V,P}}) where {V, P} = eltype(V)

function mean(d::SparseCat)
    vsum = zero(eltype(d.vals))
    for (v, p) in d
        vsum += v*p
    end
    return vsum/sum(d.probs)
end

function mode(d::SparseCat)
    bestp = zero(eltype(d.probs))
    bestv = first(d.vals)
    for (v, p) in d
        if p >= bestp
            bestp = p
            bestv = v
        end
    end
    return bestv
end

Base.show(io::IO, m::MIME"text/plain", d::SparseCat) = showdistribution(io, m, d, title="SparseCat distribution")


text:
using Test
using InteractiveUtils
using FastBroadcast
using MuladdMacro

function foo9(a, b, c, d, e, f, g, h, i)
    @muladd @.. a = b + 0.1 * (0.2c + 0.3d + 0.4e + 0.5f + 0.6g + 0.6h + 0.6i)
    nothing
end

function foo26(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
    @muladd @.. a = b + 0.1 * (0.2c + 0.3d + 0.4e + 0.5f + 0.6g + 0.6h + 0.6i + 0.6j + 0.6k + 0.6l + 0.6m + 0.6n + 0.6o + 0.6p + 0.6q + 0.6r + 0.6s + 0.6t + 0.6u + 0.6v + 0.6w + 0.6x + 0.6y + 0.6z)
    nothing
end

a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z = [rand(100, 100, 2) for i in 1:26]
foo9(a, b, c, d, e, f, g, h, i)
foo26(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)

if Base.JLOptions().check_bounds != 1
    @test @allocated(foo9(a, b, c, d, e, f, g, h, i)) == 0
    @allocated(foo26(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)) == 0
    io = IOBuffer()
    InteractiveUtils.code_llvm(io, foo9, Base.typesof(a, b, c, d, e, f, g, h, i))
    str = String(take!(io))
    @test occursin("vector.body", str)
end


text:
# Container for a DataFrame row
struct DataFrameRow{T <: AbstractDataFrame}
    df::T
    row::Int
end

"""
    parent(r::DataFrameRow)

Return the parent data frame of `r`.
"""
Base.parent(r::DataFrameRow) = getfield(r, :df)
row(r::DataFrameRow) = getfield(r, :row)

function Base.getindex(r::DataFrameRow, idx::AbstractArray)
    return DataFrameRow(parent(r)[idx], row(r))
end

function Base.getindex(r::DataFrameRow, idx::ColumnIndex)
    return parent(r)[row(r), idx]
end

Base.getindex(r::DataFrameRow, ::Colon) = r

function Base.setindex!(r::DataFrameRow, value::Any, idx::Any)
    return setindex!(parent(r), value, row(r), idx)
end

Base.names(r::DataFrameRow) = names(parent(r))
_names(r::DataFrameRow) = _names(parent(r))

Base.haskey(r::DataFrameRow, key::Any) = haskey(parent(r), key)

Base.getproperty(r::DataFrameRow, idx::Symbol) = getindex(r, idx)
Base.setproperty!(r::DataFrameRow, idx::Symbol, x::Any) = setindex!(r, x, idx)
# Private fields are never exposed since they can conflict with column names
Base.propertynames(r::DataFrameRow, private::Bool=false) = names(r)

Base.view(r::DataFrameRow, c) = DataFrameRow(parent(r)[[c]], row(r))

index(r::DataFrameRow) = index(parent(r))

Base.length(r::DataFrameRow) = size(parent(r), 2)

Compat.lastindex(r::DataFrameRow) = size(parent(r), 2)

function Base.iterate(r::DataFrameRow)
    Base.depwarn("iteration over DataFrameRow will return values in the future:" *
                 "use pairs(r::DataFrameRow) to get the current behavior",
                 :start)
    iterate(r, 1)
end

function Base.iterate(r::DataFrameRow, st)
    st > length(r) && return nothing
    return ((_names(r)[st], r[st]), st + 1)
end

Base.convert(::Type{Array}, r::DataFrameRow) = convert(Array, parent(r)[row(r),:])

Base.keys(r::DataFrameRow) = names(parent(r))
Base.values(r::DataFrameRow) = ntuple(col -> parent(r)[col][row(r)], length(r))

# hash column element
Base.@propagate_inbounds hash_colel(v::AbstractArray, i, h::UInt = zero(UInt)) = hash(v[i], h)
Base.@propagate_inbounds function hash_colel(v::AbstractCategoricalArray, i, h::UInt = zero(UInt))
    ref = v.refs[i]
    if eltype(v) >: Missing && ref == 0
        hash(missing, h)
    else
        hash(CategoricalArrays.index(v.pool)[ref], h)
    end
end

# hash of DataFrame rows based on its values
# so that duplicate rows would have the same hash
# table columns are passed as a tuple of vectors to ensure type specialization
rowhash(cols::Tuple{AbstractVector}, r::Int, h::UInt = zero(UInt))::UInt =
    hash_colel(cols[1], r, h)
function rowhash(cols::Tuple{Vararg{AbstractVector}}, r::Int, h::UInt = zero(UInt))::UInt
    h = hash_colel(cols[1], r, h)
    rowhash(Base.tail(cols), r, h)
end

Base.hash(r::DataFrameRow, h::UInt = zero(UInt)) =
    rowhash(ntuple(i -> parent(r)[i], ncol(parent(r))), row(r), h)

# comparison of DataFrame rows
# only the rows of the same DataFrame could be compared
# rows are equal if they have the same values (while the row indices could differ)
# if all non-missing values are equal, but there are missings, returns missing
Base.:(==)(r1::DataFrameRow, r2::DataFrameRow) = isequal(r1, r2)

function Base.isequal(r1::DataFrameRow, r2::DataFrameRow)
    isequal_row(parent(r1), row(r1), parent(r2), row(r2))
end

# internal method for comparing the elements of the same data table column
isequal_colel(col::AbstractArray, r1::Int, r2::Int) =
    (r1 == r2) || isequal(Base.unsafe_getindex(col, r1), Base.unsafe_getindex(col, r2))

# table columns are passed as a tuple of vectors to ensure type specialization
isequal_row(cols::Tuple{AbstractVector}, r1::Int, r2::Int) =
    isequal(cols[1][r1], cols[1][r2])
isequal_row(cols::Tuple{Vararg{AbstractVector}}, r1::Int, r2::Int) =
    isequal(cols[1][r1], cols[1][r2]) && isequal_row(Base.tail(cols), r1, r2)

isequal_row(cols1::Tuple{AbstractVector}, r1::Int, cols2::Tuple{AbstractVector}, r2::Int) =
    isequal(cols1[1][r1], cols2[1][r2])
isequal_row(cols1::Tuple{Vararg{AbstractVector}}, r1::Int,
            cols2::Tuple{Vararg{AbstractVector}}, r2::Int) =
    isequal(cols1[1][r1], cols2[1][r2]) &&
        isequal_row(Base.tail(cols1), r1, Base.tail(cols2), r2)

function isequal_row(df1::AbstractDataFrame, r1::Int, df2::AbstractDataFrame, r2::Int)
    if df1 === df2
        if r1 == r2
            return true
        end
    elseif !(ncol(df1) == ncol(df2))
        throw(ArgumentError("Rows of the tables that have different number of columns cannot be compared. Got $(ncol(df1)) and $(ncol(df2)) columns"))
    end
    @inbounds for (col1, col2) in zip(columns(df1), columns(df2))
        isequal(col1[r1], col2[r2]) || return false
    end
    return true
end

# lexicographic ordering on DataFrame rows, missing > !missing
function Base.isless(r1::DataFrameRow, r2::DataFrameRow)
    (ncol(parent(r1)) == ncol(parent(r2))) ||
        throw(ArgumentError("Rows of the data tables that have different number of columns cannot be compared ($(ncol(df1)) and $(ncol(df2)))"))
    @inbounds for i in 1:ncol(parent(r1))
        if !isequal(parent(r1)[i][row(r1)], parent(r2)[i][row(r2)])
            return isless(parent(r1)[i][row(r1)], parent(r2)[i][row(r2)])
        end
    end
    return false
end


text:
using Plots
using Printf

O3d = [0,0,0]
A3d = [8,2,7]
B3d = [-2,-8,6]
C3d = [-3,6,-9]

A3dstr = @sprintf("A = (%3.1f m, %3.1f m, %3.1f m)", A3d[1], A3d[2], A3d[3])
B3dstr = @sprintf("B = (%3.1f m, %3.1f m, %3.1f m)", B3d[1], B3d[2], B3d[3])
C3dstr = @sprintf("C = (%3.1f m, %3.1f m, %3.1f m)", C3d[1], C3d[2], C3d[3])

#ann_pts = [(A3d[1],A3d[2],A3d[3], text(A3dstr, color = :darkorange, fontsize = 10))]

scatter3d([O3d[1]],[O3d[2]],[O3d[3]], xaxis = ("posição x (m)", (-10,10), -10:1:10, font(10)),
    yaxis = ("posição y (m)", (-10,10), -10:1:10, font(10)),
    zaxis = ("posição z (m)", (-10,10), -10:1:10, font(10)), marker = :circle, color = :dodgerblue,
    markerstrokecolor = :blue, alpha = 0.7, markersize = 8, camera = (45,45), legend = true,
    label = "Referência")

scatter3d!([A3d[1]],[A3d[2]],[A3d[3]], marker = :diamond, color = :orange, markerstrokecolor = :darkorange,
    alpha = 0.7, markersize = 8, label = A3dstr)
plot!([0,A3d[1],A3d[1],A3d[1]],[0,0,A3d[2],A3d[2]],[0,0,0,A3d[3]], lw = 3, color = :orange, alpha = 0.3, label = :none)
plot!([0,A3d[1]],[0,A3d[2]],[0,A3d[3]], lw = 5, color = :darkorange, alpha = 0.5, label = :none)

scatter3d!([B3d[1]],[B3d[2]],[B3d[3]], marker = :pentagon, color = :red, markerstrokecolor = :darkred,
    alpha = 0.7, markersize = 8, label = B3dstr)
plot!([0,B3d[1],B3d[1],B3d[1]],[0,0,B3d[2],B3d[2]],[0,0,0,B3d[3]], lw = 3, color = :red, alpha = 0.3,
    line = arrow(4,4), label = :none)
plot!([0,B3d[1]],[0,B3d[2]],[0,B3d[3]], lw = 5, color = :darkred, alpha = 0.5, label = :none)

scatter3d!([C3d[1]],[C3d[2]],[C3d[3]], marker = :utriangle, color = :limegreen, markerstrokecolor = :forestgreen,
    alpha = 0.7, markersize = 8, label = C3dstr)
plot!([0,0,C3d[1],C3d[1]],[0,C3d[2],C3d[2],C3d[2]],[0,0,0,C3d[3]], lw = 3, color = :limegreen, alpha = 0.3,
    label = :none)
plot!([0,C3d[1]],[0,C3d[2]],[0,C3d[3]], lw = 5, color = :forestgreen, alpha = 0.5, label = :none)

max_stars_repo_name: ghralima/mecanica

max_issues_repo_name: ghralima/mecanica

max_forks_repo_name: ghralima/mecanica


text:
import GPLinearODEMaker.powers_of_negative_one

"""
m52_m52_kernel function created by kernel_coder(). Requires 3 hyperparameters. Likely created using m52_m52_kernel_base() as an input.
Use with include("src/kernels/m52_m52_kernel.jl").
hyperparameters == ["λ1", "λ2", "sratio"]
"""
function m52_m52_kernel(
    hyperparameters::Vector{<:Real},
    δ::Real,
    dorder::Vector{<:Integer};
    shift_ind::Integer=0)

    include_shift = shift_ind!=0
    @assert length(hyperparameters)==3+Int(include_shift) "hyperparameters is the wrong length"
    dorder_len = 5 + Int(include_shift)
    @assert length(dorder)==dorder_len "dorder is the wrong length"
    @assert maximum(dorder) < 3 "No more than two derivatives for each time or hyperparameter can be calculated"

    dorder2 = dorder[2]
    dorder[2] += dorder[1]

    if include_shift
        dorder[2] += dorder[shift_ind+2]
        δ += hyperparameters[shift_ind]
        hyperparameters_view = view(hyperparameters, 1:4 .!= shift_ind)
        dorder_view = view(dorder, 2:dorder_len)
        dorder_view = view(dorder_view, 1:(dorder_len-1) .!= (shift_ind+1))
    else
        hyperparameters_view = hyperparameters
        dorder_view = view(dorder, 2:dorder_len)
    end

    λ1 = hyperparameters_view[1]
    λ2 = hyperparameters_view[2]
    sratio = hyperparameters_view[3]

    dabs_δ = powers_of_negative_one(δ < 0)  # store derivative of abs()
    abs_δ = abs(δ)

    if dorder_view==[6, 0, 0, 2]
        func = 2500.0*exp(-2.23606797749979*abs_δ/λ2)/λ2^6 + 250.0*exp(-2.23606797749979*abs_δ/λ2)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 670.820393249937*exp(-2.23606797749979*abs_δ/λ2)*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5
    end

    if dorder_view==[5, 0, 0, 2]
        func = -745.35599249993*exp(-2.23606797749979*abs_δ/λ2)/λ2^5 - 111.80339887499*exp(-2.23606797749979*abs_δ/λ2)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 250.0*exp(-2.23606797749979*abs_δ/λ2)*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4
    end

    if dorder_view==[4, 0, 0, 2]
        func = 200.0*exp(-2.23606797749979*abs_δ/λ2)/λ2^4 + 50.0*exp(-2.23606797749979*abs_δ/λ2)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 89.4427190999916*exp(-2.23606797749979*abs_δ/λ2)*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[3, 0, 0, 2]
        func = -44.7213595499958*exp(-2.23606797749979*abs_δ/λ2)/λ2^3 - 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 30.0*exp(-2.23606797749979*abs_δ/λ2)*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2
    end

    if dorder_view==[2, 0, 0, 2]
        func = 6.66666666666667*exp(-2.23606797749979*abs_δ/λ2)/λ2^2 + 10.0*exp(-2.23606797749979*abs_δ/λ2)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 8.94427190999916*exp(-2.23606797749979*abs_δ/λ2)*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2
    end

    if dorder_view==[1, 0, 0, 2]
        func = 2*exp(-2.23606797749979*abs_δ/λ2)*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2) - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2
    end

    if dorder_view==[0, 0, 0, 2]
        func = 2*exp(-2.23606797749979*abs_δ/λ2)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)
    end

    if dorder_view==[6, 0, 1, 1]
        func = -15000.0*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^7 + 5590.16994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio/λ2^8 - 1500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 250.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^6 + 3354.10196624969*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 670.820393249937*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 - 1500.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7
    end

    if dorder_view==[5, 0, 1, 1]
        func = 3726.77996249965*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^6 - 1666.66666666667*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio/λ2^7 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 111.80339887499*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 - 1000.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 250.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 - 250.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6
    end

    if dorder_view==[4, 0, 1, 1]
        func = -800.0*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^5 + 447.213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio/λ2^6 - 200.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 50.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 + 268.328157299975*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 89.4427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3 + 111.80339887499*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 200.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5
    end

    if dorder_view==[3, 0, 1, 1]
        func = 134.164078649987*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^4 - 100.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio/λ2^5 + 67.0820393249937*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3 - 60.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 30.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 - 50.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 67.0820393249937*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4
    end

    if dorder_view==[2, 0, 1, 1]
        func = -13.3333333333333*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^3 + 14.9071198499986*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio/λ2^4 - 20.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 10.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 + 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 + 8.94427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 8.94427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio*dabs_δ*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2 - 20.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[1, 0, 1, 1]
        func = 2*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2) + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio*dabs_δ*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2 - 10.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[0, 0, 1, 1]
        func = 2*exp(-2.23606797749979*abs_δ/λ2)*sratio*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2) + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2
    end

    if dorder_view==[6, 1, 0, 1]
        func = 0
    end

    if dorder_view==[5, 1, 0, 1]
        func = 0
    end

    if dorder_view==[4, 1, 0, 1]
        func = 0
    end

    if dorder_view==[3, 1, 0, 1]
        func = 0
    end

    if dorder_view==[2, 1, 0, 1]
        func = 0
    end

    if dorder_view==[1, 1, 0, 1]
        func = 0
    end

    if dorder_view==[0, 1, 0, 1]
        func = 0
    end

    if dorder_view==[6, 0, 0, 1]
        func = 2500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^6 + 250.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 670.820393249937*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5
    end

    if dorder_view==[5, 0, 0, 1]
        func = -745.35599249993*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^5 - 111.80339887499*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 250.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4
    end

    if dorder_view==[4, 0, 0, 1]
        func = 200.0*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^4 + 50.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 89.4427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[3, 0, 0, 1]
        func = -44.7213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^3 - 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 30.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2
    end

    if dorder_view==[2, 0, 0, 1]
        func = 6.66666666666667*exp(-2.23606797749979*abs_δ/λ2)*sratio/λ2^2 + 10.0*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 8.94427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2
    end

    if dorder_view==[1, 0, 0, 1]
        func = 2*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2) - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2
    end

    if dorder_view==[0, 0, 0, 1]
        func = 2*exp(-2.23606797749979*abs_δ/λ2)*sratio*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)
    end

    if dorder_view==[6, 0, 2, 0]
        func = 52500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^8 + 6250.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2/λ2^10 - 39131.1896062463*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^9 + 5250.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 - 1500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^7 - 10062.3058987491*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^6 + 3354.10196624969*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^6 - 335.410196624969*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(16.6666666666667*abs_δ*dabs_δ/λ2^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^5 + 625.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^10 - 3913.11896062463*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^9 - 1677.05098312484*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^9 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^8 + 9000.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 - 1500.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^7
    end

    if dorder_view==[5, 0, 2, 0]
        func = -11180.339887499*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^7 - 1863.38998124983*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2/λ2^9 + 10000.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^8 - 1677.05098312484*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^6 + 2500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^5 - 1000.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(16.6666666666667*abs_δ*dabs_δ/λ2^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^4 - 279.508497187474*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^9 + 1500.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 + 625.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 - 250.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^7 - 2795.08497187474*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^6
    end

    if dorder_view==[4, 0, 2, 0]
        func = 2000.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^6 + 500.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2/λ2^8 - 2236.06797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^7 + 500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 200.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 - 536.65631459995*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 25.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^4 + 268.328157299975*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(16.6666666666667*abs_δ*dabs_δ/λ2^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^3 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 - 559.016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 - 223.606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 111.80339887499*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^6 + 800.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 200.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5
    end

    if dorder_view==[3, 0, 2, 0]
        func = -268.328157299975*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^5 - 111.80339887499*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2/λ2^7 + 400.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^6 - 134.164078649987*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 67.0820393249937*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 + 90.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^3 - 60.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3 + 15.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(16.6666666666667*abs_δ*dabs_δ/λ2^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^2 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 200.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 + 75.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 50.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 - 201.246117974981*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 67.0820393249937*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4
    end

    if dorder_view==[2, 0, 2, 0]
        func = 20.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^4 + 16.6666666666667*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2/λ2^6 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^5 + 30.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 20.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3 + 5.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2^2 + 25.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 67.0820393249937*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 - 8.94427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 8.94427190999916*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(16.6666666666667*abs_δ*dabs_δ/λ2^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2 - 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 40.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 20.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*dabs_δ*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3
    end

    if dorder_view==[1, 0, 2, 0]
        func = exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(16.6666666666667*abs_δ*dabs_δ/λ2^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3) + 5.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 - 2.23606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3)/λ2 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 20.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 10.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*dabs_δ*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3
    end

    if dorder_view==[0, 0, 2, 0]
        func = exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(6.66666666666667*abs_δ^2/λ2^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^3) + 5.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ^2*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2
    end

    if dorder_view==[6, 1, 1, 0]
        func = 0
    end

    if dorder_view==[5, 1, 1, 0]
        func = 0
    end

    if dorder_view==[4, 1, 1, 0]
        func = 0
    end

    if dorder_view==[3, 1, 1, 0]
        func = 0
    end

    if dorder_view==[2, 1, 1, 0]
        func = 0
    end

    if dorder_view==[1, 1, 1, 0]
        func = 0
    end

    if dorder_view==[0, 1, 1, 0]
        func = 0
    end

    if dorder_view==[6, 0, 1, 0]
        func = -7500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^7 + 2795.08497187474*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^8 - 750.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^6 + 1677.05098312484*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 335.410196624969*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 + 279.508497187474*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^8 - 750.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7
    end

    if dorder_view==[5, 0, 1, 0]
        func = 1863.38998124983*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^6 - 833.333333333334*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^7 + 279.508497187474*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^5 - 500.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 - 125.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^7 + 279.508497187474*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6
    end

    if dorder_view==[4, 0, 1, 0]
        func = -400.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^5 + 223.606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^6 - 100.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 25.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^4 + 134.164078649987*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3 + 55.9016994374948*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 100.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5
    end

    if dorder_view==[3, 0, 1, 0]
        func = 67.0820393249937*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^4 - 50.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^5 + 33.5410196624969*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^3 - 30.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 15.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 - 25.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 33.5410196624969*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4
    end

    if dorder_view==[2, 0, 1, 0]
        func = -6.66666666666667*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^3 + 7.4535599249993*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2/λ2^4 - 10.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 5.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2^2 + 11.180339887499*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2 - 10.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[1, 0, 1, 0]
        func = exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-5.0*abs_δ*dabs_δ/λ2^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2) + 2.23606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 + 2.23606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 2.23606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2)/λ2 - 5.0*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[0, 0, 1, 0]
        func = exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(-1.66666666666667*abs_δ^2/λ2^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2^2) + 2.23606797749979*exp(-2.23606797749979*abs_δ/λ2)*abs_δ*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2
    end

    if dorder_view==[6, 2, 0, 0]
        func = 52500.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^8 + 6250.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2/λ1^10 - 39131.1896062463*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^9 + 5250.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^8 - 1500.0*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^7 - 10062.3058987491*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^6 + 3354.10196624969*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^6 - 335.410196624969*exp(-2.23606797749979*abs_δ/λ1)*(16.6666666666667*abs_δ*dabs_δ/λ1^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^5 + 625.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^10 - 3913.11896062463*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^9 - 1677.05098312484*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^9 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^8 + 9000.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^8 - 1500.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^7
    end

    if dorder_view==[5, 2, 0, 0]
        func = -11180.339887499*exp(-2.23606797749979*abs_δ/λ1)/λ1^7 - 1863.38998124983*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2/λ1^9 + 10000.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^8 - 1677.05098312484*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^6 + 2500.0*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ1)*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^5 - 1000.0*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^5 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*(16.6666666666667*abs_δ*dabs_δ/λ1^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^4 - 279.508497187474*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^9 + 1500.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^8 + 625.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^8 - 250.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^7 - 2795.08497187474*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 559.016994374948*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^6
    end

    if dorder_view==[4, 2, 0, 0]
        func = 2000.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^6 + 500.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2/λ1^8 - 2236.06797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^7 + 500.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 200.0*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^5 - 536.65631459995*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 25.0*exp(-2.23606797749979*abs_δ/λ1)*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^4 + 268.328157299975*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^4 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ1)*(16.6666666666667*abs_δ*dabs_δ/λ1^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^3 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^8 - 559.016994374948*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 - 223.606797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 111.80339887499*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^6 + 800.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 200.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^5
    end

    if dorder_view==[3, 2, 0, 0]
        func = -268.328157299975*exp(-2.23606797749979*abs_δ/λ1)/λ1^5 - 111.80339887499*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2/λ1^7 + 400.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^6 - 134.164078649987*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 67.0820393249937*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^4 + 90.0*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ1)*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^3 - 60.0*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^3 + 15.0*exp(-2.23606797749979*abs_δ/λ1)*(16.6666666666667*abs_δ*dabs_δ/λ1^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^2 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 200.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 + 75.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 50.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^5 - 201.246117974981*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 67.0820393249937*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^4
    end

    if dorder_view==[2, 2, 0, 0]
        func = 20.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^4 + 16.6666666666667*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2/λ1^6 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^5 + 30.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 20.0*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^3 + 5.0*exp(-2.23606797749979*abs_δ/λ1)*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1^2 + 25.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 67.0820393249937*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 22.3606797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^4 - 8.94427190999916*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 8.94427190999916*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(16.6666666666667*abs_δ*dabs_δ/λ1^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1 - 22.3606797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 40.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 20.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*dabs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^3
    end

    if dorder_view==[1, 2, 0, 0]
        func = exp(-2.23606797749979*abs_δ/λ1)*(16.6666666666667*abs_δ*dabs_δ/λ1^4 + 4.47213595499958*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3) + 5.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^2 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^2 - 2.23606797749979*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3)/λ1 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 20.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 10.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*dabs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^3
    end

    if dorder_view==[0, 2, 0, 0]
        func = exp(-2.23606797749979*abs_δ/λ1)*(6.66666666666667*abs_δ^2/λ1^4 + 4.47213595499958*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^3) + 5.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^2
    end

    if dorder_view==[6, 1, 0, 0]
        func = -7500.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^7 + 2795.08497187474*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^8 - 750.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^6 + 1677.05098312484*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 335.410196624969*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^5 + 279.508497187474*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^8 - 750.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7
    end

    if dorder_view==[5, 1, 0, 0]
        func = 1863.38998124983*exp(-2.23606797749979*abs_δ/λ1)/λ1^6 - 833.333333333334*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^7 + 279.508497187474*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^5 - 500.0*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^4 - 125.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^7 + 279.508497187474*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6
    end

    if dorder_view==[4, 1, 0, 0]
        func = -400.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^5 + 223.606797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^6 - 100.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 25.0*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^4 + 134.164078649987*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^3 + 55.9016994374948*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 100.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5
    end

    if dorder_view==[3, 1, 0, 0]
        func = 67.0820393249937*exp(-2.23606797749979*abs_δ/λ1)/λ1^4 - 50.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^5 + 33.5410196624969*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^3 - 30.0*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 15.0*exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^2 - 25.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 33.5410196624969*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4
    end

    if dorder_view==[2, 1, 0, 0]
        func = -6.66666666666667*exp(-2.23606797749979*abs_δ/λ1)/λ1^3 + 7.4535599249993*exp(-2.23606797749979*abs_δ/λ1)*abs_δ/λ1^4 - 10.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 5.0*exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1^2 + 11.180339887499*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 + 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1 - 10.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3
    end

    if dorder_view==[1, 1, 0, 0]
        func = exp(-2.23606797749979*abs_δ/λ1)*(-5.0*abs_δ*dabs_δ/λ1^3 - 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2) + 2.23606797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^2 + 2.23606797749979*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^2 - 2.23606797749979*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2)/λ1 - 5.0*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3
    end

    if dorder_view==[0, 1, 0, 0]
        func = exp(-2.23606797749979*abs_δ/λ1)*(-1.66666666666667*abs_δ^2/λ1^3 - 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1^2) + 2.23606797749979*exp(-2.23606797749979*abs_δ/λ1)*abs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^2
    end

    if dorder_view==[6, 0, 0, 0]
        func = 1250.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^6 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^6 - 335.410196624969*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 1250.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^6 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^6 - 335.410196624969*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5
    end

    if dorder_view==[5, 0, 0, 0]
        func = -372.677996249965*exp(-2.23606797749979*abs_δ/λ1)/λ1^5 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^5 + 125.0*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 372.677996249965*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^5 - 55.9016994374948*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^5 + 125.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4
    end

    if dorder_view==[4, 0, 0, 0]
        func = 100.0*exp(-2.23606797749979*abs_δ/λ1)/λ1^4 + 25.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^4 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 100.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^4 + 25.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^4 - 44.7213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3
    end

    if dorder_view==[3, 0, 0, 0]
        func = -22.3606797749979*exp(-2.23606797749979*abs_δ/λ1)/λ1^3 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^3 + 15.0*exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^2 - 22.3606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^3 - 11.180339887499*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^3 + 15.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2
    end

    if dorder_view==[2, 0, 0, 0]
        func = 3.33333333333333*exp(-2.23606797749979*abs_δ/λ1)/λ1^2 + 5.0*exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1^2 + 3.33333333333333*exp(-2.23606797749979*abs_δ/λ2)*sratio^2/λ2^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1 + 5.0*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2^2 - 4.47213595499958*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2
    end

    if dorder_view==[1, 0, 0, 0]
        func = exp(-2.23606797749979*abs_δ/λ1)*(1.66666666666667*abs_δ*dabs_δ/λ1^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1) + exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1.66666666666667*abs_δ*dabs_δ/λ2^2 + 2.23606797749979*dabs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2) - 2.23606797749979*exp(-2.23606797749979*abs_δ/λ1)*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1)/λ1 - 2.23606797749979*exp(-2.23606797749979*abs_δ/λ2)*sratio^2*dabs_δ*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)/λ2
    end

    if dorder_view==[0, 0, 0, 0]
        func = exp(-2.23606797749979*abs_δ/λ1)*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ1)/λ1) + exp(-2.23606797749979*abs_δ/λ2)*sratio^2*(1 + 2.23606797749979*abs_δ*(1 + 0.74535599249993*abs_δ/λ2)/λ2)
    end

    dorder[2] = dorder2  # resetting dorder[2]
    return powers_of_negative_one(dorder2) * float(func)  # correcting for amount of t2 derivatives

end

return m52_m52_kernel, 3  # the function handle and the number of kernel hyperparameters