Skip to content

Instantly share code, notes, and snippets.

View moustachio-belvedere's full-sized avatar

Jonathan Louis Kaplan moustachio-belvedere

View GitHub Profile
using FunctionWrappers: FunctionWrapper
using BenchmarkTools
timevec = collect(0.0:1.0:1000);
params = [1.0, 1.0]
paramstupled = ([1.0, 1.0],)
paramsNT = (a = 1.0, b = 1.0,)
function G_Unpack_Single(tsing, params)
a, b, = params
using MittagLeffler
using SpecialFunctions
using FunctionWrappers: FunctionWrapper
using QuadGK
using BenchmarkTools
timesingle = 0.5
cₐ, a, cᵦ, β = (1.0, 1.0, 1.0, 0.0)
G(t) = cᵦ*t^(-β)*mittleff((a - β), (1 - β), -cᵦ*t^(a - β)/cₐ)
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))
using RHEOS
dt = 0.01;
t = collect(0.0:dt:10.0);
# fm_model = Fract_Maxwell.Ga(t, [1.0, 1.0, 1.0, 0.0]);
# maxwell = Maxwell.Ga(t, [1.0, 1.0]);
# all(i -> isapprox(fm_model[i], maxwell[i]), eachindex(t))
#include <stdio.h>
#include <float.h>
int main(void)
{
printf("%d\n", FLT_EVAL_METHOD);
return 0;
}
@moustachio-belvedere
moustachio-belvedere / begin.c
Created August 18, 2019 18:47
Corrected Floating Point machine epsilon calculation
#include <stdio.h>
int main(void)
{
float foo;
double bar;
foo = (float)((float)(7.0f/3.0f) - (float)(4.0f/3.0f) - 1.0f);
bar = (double)((double)(7.0/3.0) - (double)(4.0/3.0) - 1.0);
@moustachio-belvedere
moustachio-belvedere / begin.s
Created August 18, 2019 18:33
Stack overflow requested assembly code (GNU11 standard)
.file "begin.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC2:
.ascii "\12M.E. for float: %e \12\12\0"
LC3:
.ascii "M.E. for double: %e \12\12\0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
@moustachio-belvedere
moustachio-belvedere / begin.s
Last active August 18, 2019 18:31
Stack Overflow requested assembly code (C11 standard)
.file "begin.c"
.text
.def _printf; .scl 3; .type 32; .endef
_printf:
LFB1:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
import datapoint as met
# api key
apikey = "Insert your api key here!"
# set lattitude and longitude of Cambridge UK
latitude, longitude = 52.2053, 0.1218
# initialise connection and get forecast with hour time-steps
conn = met.connection(api_key = apikey)
# using RHEOS; using PyPlot; using PyCall; @pyimport seaborn as sns;
# initialise seaborn package with correct parameters
pgf_with_latex = Dict("figure.figsize" => (10.5, 9.5), "mathtext.default" => "regular");
sns.set(rc=pgf_with_latex)
sns.set_style("ticks")
# initialise time data
step_size = 1e-3
t_len = 1.0