Who am I? Truthfully, I have no idea.
Maybe this blog can help me answer this question by reflecting on my thoughts and experiences in the realms of science and technology. The writing of a complex idea can help clarify it in my mind, and distill it down to its essence.
Maybe I will finally succeed in understanding the world around me. By researching and playing with numbers I could maybe discover some new insights.
But in the plausible case I will just end up with a bunch of half-baked ideas and a blog that no one reads. Either way, I hope you enjoy the ride. 🎢
Julia Code
using Plots
# define the Lorenz attractor
Base.@kwdef mutable struct Lorenz
dt::Float64 = 0.01
σ::Float64 = 10
ρ::Float64 = 28
β::Float64 = 8 / 3
x::Float64 = 1
y::Float64 = 1
z::Float64 = 1
end
function step!(l::Lorenz)
dx = l.σ * (l.y - l.x)
dy = l.x * (l.ρ - l.z) - l.y
dz = l.x * l.y - l.β * l.z
l.x += l.dt * dx
l.y += l.dt * dy
l.z += l.dt * dz
end
attractor = Lorenz()
# initialize a 3D plot with 1 empty series
plt = plot3d(
1,
xlim = (-30, 30), ylim = (-30, 50), zlim = (0, 60),
legend = false, marker = 2, dpi = 100,
grid=false, xaxis = false, yaxis = false, zaxis = false
)
anim = @animate for i = 1:3000
step!(attractor)
push!(plt, attractor.x, attractor.y, attractor.z)
end every 20
outfile = "../../static/images/about/lorenz.gif"
gif(anim, outfile; show_msg=false)
run(`convert $outfile -coalesce -trim -layers trim-bounds $outfile`); # use imagemagick to crop the gif