Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
I am a panda.

George Datseris Datseris

🐼
I am a panda.
View GitHub Profile
View comparing_SMatrix_inplace.jl
using OrdinaryDiffEq, StaticArrays, BenchmarkTools
const σ, ρ, β = 10.0, 28.0, 8/3
mutable struct system1{T, F, J}
state::T
eom!::F
jacob::J
end
@Datseris
Datseris / double_pendulum_pyplot.py
Created Oct 3, 2017
DynamicalSystems.jl logo animation using Python
View double_pendulum_pyplot.py
# -*- coding: utf-8 -*-
"""
===========================
The double pendulum problem
===========================
This animation illustrates the double pendulum problem.
"""
View compare_branching.jl
function f1(N::Int)
s = 0
for n = 1:N
n % 2 == 0 && (s += 2; continue)
s += 1
end
s
end
function f2(N::Int)
@Datseris
Datseris / pendulums.jl
Created May 7, 2018 — forked from cormullion/pendulums.jl
George's double pendulums
View pendulums.jl
using DynamicalSystems, Luxor
function double_pendulum(u0=rand(4);
G=10.0, L1 = 1.0, L2 = 1.0, M1 = 1.0, M2 = 1.0)
@inline @inbounds function eom_dp!(du, state)
du[1] = state[2]
gm = 0.01
del_ = state[3] - state[1]
den1 = (M1 + M2)*L1 - M2*L1*cos(del_)*cos(del_)
du[2] = (M2*L1*state[2]*state[2]*sin(del_)*cos(del_) +
@Datseris
Datseris / windows_endline.jl
Created Jun 24, 2018
Change the end-line of all files from the "windows" one to the standard one.
View windows_endline.jl
cd(Pkg.dir("DynamicalBilliards"))
function rn(filename)
str = read(filename, String)
str = replace(str, "\r\n" => "\n")
write(filename, str)
end
function totalrn(path = pwd())
for f in readdir(path)
@Datseris
Datseris / axb_native.jl
Created Jul 7, 2018
code native for A*B with static arrays
View axb_native.jl
Julia 0.7:
julia> @code_native A*B
.text
; Function * {
; Location: matrix_multiply.jl:9
pushq %rbp
movq %rsp, %rbp
; Function _mul; {
; Location: matrix_multiply.jl:75
View integrator_with_callback.jl
function dist(ds::CDS, d0, Ttr, T; diff_eq_kwargs=Dict(:abstol=>1e-14,
:reltol=>1e-14, :solver=>Vern9(), :maxiters=>1e9),
inittest=ChaosTools.inittest_default(dimension(ds)))
pinteg = parallel_integrator(ds,
@Datseris
Datseris / juno_color.jl
Last active Jul 25, 2018
Give default Juno color in types.
View juno_color.jl
import TreeViews
struct DiffEqMock end
typecolor(x) = "<span class=\"syntax--support syntax--type syntax--julia\">$(x)</span>"
TreeViews.hastreeview(::DiffEqMock) = true
@Datseris
Datseris / old_vs_new_psos.jl
Created Jul 26, 2018
New poincare section using Roots and integrator stepping
View old_vs_new_psos.jl
const PSOS_ERROR =
"the Poincaré surface of section did not have any points!"
function poincaresos2(ds::CDS{IIP, S, D}, plane, tfinal = 1000.0;
direction = +1, Ttr::Real = 0.0, warning = true,
diffeq...) where {IIP, S, D}
integ = integrator(ds; diffeq...)
planecrossing = PlaneCrossing{D}(plane, direction > 0 )
@Datseris
Datseris / tuple32.jl
Created Sep 7, 2018
Julia tuples have performance hinderances for sizes > 32
View tuple32.jl
f(t) = +(t...,)
@code_typed f(ntuple(identity, 5)) # what you expect
@code_typed f(ntuple(identity, 18)) # something is going on
@code_typed f(ntuple(identity, 33)) # _apply