Skip to content

Instantly share code, notes, and snippets.

@moustachio-belvedere
Last active February 17, 2020 12:08
Show Gist options
  • Save moustachio-belvedere/a8eca69b24b3b75e9b2c2f25b9daf91b to your computer and use it in GitHub Desktop.
Save moustachio-belvedere/a8eca69b24b3b75e9b2c2f25b9daf91b to your computer and use it in GitHub Desktop.
using MittagLeffler
using SpecialFunctions
using FunctionWrappers: FunctionWrapper
using QuadGK
timevec = collect(0.0:0.01:10.0);
cₐ, a, cᵦ, β = (1.0, 1.0, 1.0, 0.0);
# G(t) = cᵦ*t.^(-β).*mittleff.((a - β,), (1 - β,), -cᵦ*t.^(a - β)/cₐ);
# Gfw = FunctionWrapper{Vector{Float64}, Tuple{Vector{Float64}}}((t) -> G(t))
# # always works
# valsG = G(timevec)
# # doesn't work first time, works on subsequent runs?
# valsGfw = Gfw(timevec)
# G2(t) = t*(cₐ + a + cᵦ + β);
# G2fw = FunctionWrapper{Vector{Float64}, Tuple{Vector{Float64}}}((t) -> G2(t))
# # always works
# valsG2 = G2(timevec)
# # always works
# valsG2fw = G2fw(timevec)
# function sepfunk(p1, p2)
# p1 + p2
# end
# G3(t) = t*(sepfunk(cₐ + a, cᵦ + β));
# G3fw = FunctionWrapper{Vector{Float64}, Tuple{Vector{Float64}}}((t) -> G3(t))
# # always works
# valsG3 = G3(timevec)
# # always works
# valsG3fw = G3fw(timevec)
# G4(t) = t*(gamma(cₐ + a + cᵦ + β));
# G4fw = FunctionWrapper{Vector{Float64}, Tuple{Vector{Float64}}}((t) -> G4(t))
# # always works
# valsG4 = G4(timevec)
# # always works
# valsG4fw = G4fw(timevec)
# G5(t) = t*(erfc(cₐ + a + cᵦ + β));
# G5fw = FunctionWrapper{Vector{Float64}, Tuple{Vector{Float64}}}((t) -> G5(t))
# # always works
# valsG5 = G5(timevec)
# # always works
# valsG5fw = G5fw(timevec)
G6(t) = t*quadgk(x -> exp(-(cₐ + a + cᵦ + β)*x^2), 0, 1, rtol=1e-8)[1];
G6fw = FunctionWrapper{Vector{Float64}, Tuple{Vector{Float64}}}((t) -> G6(t))
# always works
valsG6 = G6(timevec)
# doesn't work first time, works on subsequent runs?
valsG6fw = G6fw(timevec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment