Introduction to Julia for Dynamical Systems

Julia is a relatively new programming language which is well-adapted to numerical computing, statistics and machine learning.

# One can define parameters in the function. 
# Unicode characters are allowed (including emoji)
f(x,α=3.7)= α*x*(1-x)
f(.1) #assumes α=3.7, return 0.3330000000000001
f(0.1,3) #assumes α=3, return 0.2700000000000001
0.2700000000000001
# We can define arrays and modify their length with new values
x=[0.1]
for n in range(1,1e2)
push!(x,f(x[end]))
# There is a plotting library with various backends
using Plots

plot(x,label="")
plot!(x,label="x₀=0.1",seriestype=:scatter,)
plot!(title = "Logistic map", xlabel = "n", ylabel = "iterate")

# We can now see the sensitivity wrt initial conditions
plot(x,label="")
plot!(x,label="x₀=0.1",seriestype=:scatter,)
plot!(title = "Logistic map", xlabel = "n", ylabel = "iterate")
# We compute the second orbit
y=[0.1+1e-5]
for n in range(1,1e2)
push!(y,f(y[end]))

!(y,label="y₀=0.1+1e-5",seriestype=:scatter)