Here I implemented basic functions which are well known such as chaotic
In examples directory contains comprehensive example scripts demonstrating the analysis capabilities of DynamicalModels.jl.
Each example can be run independently:
julia --project=.. examples/lorenz_analysis.jl
julia --project=.. examples/rossler_analysis.jl
julia --project=.. examples/vanderpol_analysis.jl
julia --project=.. examples/hodgkin_huxley_analysis.jlOr from within Julia:
using Pkg
Pkg.activate("..") # Activate the DynamicalModels environment
include("examples/lorenz_analysis.jl")Comprehensive analysis of the Lorenz attractor including:
- Lyapunov Exponents: Calculation of largest exponent and full spectrum
- Poincaré Sections: Visualization of the strange attractor
- Fractal Dimensions: Kaplan-Yorke dimension estimation
- Butterfly Effect: Sensitivity to initial conditions
Key Concepts:
- Chaotic dynamics
- Strange attractors
- Dissipative systems
Analysis of the Rössler attractor focusing on:
- Poincaré Sections: Classic bun-shaped attractor
- Return Maps: One-dimensional maps from continuous flow
- Period-Doubling: Route to chaos as parameters vary
- Comparison with Lorenz: Simpler chaos example
Key Concepts:
- Period-doubling bifurcations
- Return maps
- Routes to chaos
Analysis of self-sustained oscillations:
- Limit Cycles: Stable periodic orbits
- Damping Effects: How ϵ parameter affects oscillations
- Forced Oscillations: Response to periodic driving
- Applications: Electronic and biological oscillators
Key Concepts:
- Limit cycles
- Self-sustained oscillations
- Relaxation oscillations
Neural excitability and action potentials:
- Resting State: Equilibrium analysis
- Excitability: Threshold behavior
- Action Potentials: Spike generation mechanism
- F-I Curves: Firing rate vs current
- Phase Space: 4D dynamical system
Key Concepts:
- Excitable systems
- All-or-none response
- Neural computation
- Nobel Prize winning model
All examples demonstrate the following analysis techniques:
λ_max = lyapunov_exponent(model, x0, time_step)
λs = lyapunov_spectrum(model, x0, time_step)section = poincare_section(model, x0, plane_normal, plane_point, t_max)
x_coords, y_coords = poincare_map_2d(model, x0, (1, 2),
plane_normal, plane_point, t_max)D_KY = kaplan_yorke_dimension(lyapunov_exponents)
radii, C, dim = correlation_dimension(trajectory_points)- Largest Lyapunov exponent: ~0.9
- Kaplan-Yorke dimension: ~2.06
- Behavior: Chaotic
- Largest Lyapunov exponent: ~0.07
- Behavior: Chaotic
- Clear period-doubling route
- Largest Lyapunov exponent: ~0 (periodic)
- Behavior: Stable limit cycle
- Behavior: Excitable (all-or-none)
- Action potential duration: ~2-3 ms
- Refractory period: ~2-5 ms
- Vary Parameters: Try different parameter values to see how behavior changes
- Initial Conditions: Experiment with different starting points
- Integration Time: Longer integration reveals more structure
- Convergence: Increase iterations for more accurate Lyapunov exponents
While these examples don't generate plots (to avoid dependencies), you can visualize results using:
using Plots
# Poincaré section
scatter(x_coords, y_coords, label="Poincaré Section")
# Return map
scatter(x_n, x_n1, label="Return Map")
# Lyapunov spectrum
bar(1:length(λs), λs, label="Lyapunov Exponents")- See the documentation for detailed model descriptions
- Check the analysis tools documentation for method details
- Refer to test files in
../test/analysis/for more examples
Feel free to add more example scripts demonstrating:
- Other models in the package
- Advanced analysis techniques
- Comparison studies
- Real-world applications