Skip to content

Commit

Permalink
Merge pull request #2 from JuliaDynamics/master
Browse files Browse the repository at this point in the history
Update to the latest version
  • Loading branch information
SebastianM-C committed Oct 4, 2017
2 parents 3b5c375 + 0ec82a4 commit a6e34f7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# v.4.0:
# v0.5.0:
* Added a new supertype `ContinuousDynamicalSystem`.
* **BREAKING** : `ContinuousDS` is now a subtype of `ContinuousDynamicalSystem`.

# v0.4.0:
* Increased speed of Standard Map system (by using `while` instead of `mod`).
* Added a huuuge method due to Schmelcher & Diakonos which finds stable and
unstable fixed points of any order for discrete maps!
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lyapunovs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Similarly, for a continuous system, e.g. the Lorenz system, you would do:
using DynamicalSystems

lor = Systems.lorenz= 32.0) #this is not the original parameter!
issubtype(typeof(ds), ContinuousDS) # true
issubtype(typeof(ds), ContinuousDynamicalSystem) # true

λλ = lyapunovs(lor, 10000,
dt = 0.1, diff_eq_kwargs = Dict(:abstol => 1e-9, :reltol => 1e-9))
Expand Down
5 changes: 1 addition & 4 deletions src/DynamicalSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ and discrete dynamical systems.
module DynamicalSystems

"""
Abstract type representing a dynamical system. Has the following concrete sub-types:
* `DiscreteDS1D`
* `DiscreteDS`
* `ContinuousDS`
Abstract type representing a dynamical system.
"""
abstract type DynamicalSystem end

Expand Down
12 changes: 6 additions & 6 deletions src/lyapunovs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ lyapunov(ds::DiscreteDS1D, N::Int=10000; Ttr::Int = 100) = lyapunovs(ds, N, Ttr=
#####################################################################################
# Lyapunov Helpers #
#####################################################################################
function tangentbundle_setup_integrator(ds::ContinuousDS, t_final;
function tangentbundle_setup_integrator(ds::ContinuousDynamicalSystem, t_final;
diff_eq_kwargs=Dict())

D = dimension(ds)
Expand Down Expand Up @@ -238,7 +238,7 @@ end
#####################################################################################
# Continuous Lyapunovs #
#####################################################################################
function lyapunov(ds::ContinuousDS, T = 10000.0; Ttr = 0.0,
function lyapunov(ds::ContinuousDynamicalSystem, T = 10000.0; Ttr = 0.0,
d0=1e-9, threshold=10^3*d0, dt = 0.1,
diff_eq_kwargs = Dict(:abstol=>d0, :reltol=>d0))

Expand Down Expand Up @@ -288,7 +288,7 @@ function lyapunov(integ1::ODEIntegrator, integ2::ODEIntegrator, T::Real;
warnstr*= "Please decrease `dt`, increase `threshold` or decrease `d0`."
warn(warnstr)
errorstr = "Parameters choosen for `lyapunov` with "
errorstr*= "`ContinuousDS` are not fitted for the algorithm."
errorstr*= "`ContinuousDynamicalSystem` are not fitted for the algorithm."
throw(ArgumentError(errorstr))
end
λ += log(a)
Expand All @@ -306,7 +306,7 @@ end
Compute the timeseries of the maximum Lyapunov exponent. This function
should be used to check the convergence of the series.
"""
function lyapunov_full(ds::ContinuousDS, T = 10000.0; Ttr = 0.0,
function lyapunov_full(ds::ContinuousDynamicalSystem, T = 10000.0; Ttr = 0.0,
d0=1e-9, threshold=10^3*d0, dt = 0.1,
diff_eq_kwargs = Dict(:abstol=>d0, :reltol=>d0))

Expand Down Expand Up @@ -358,7 +358,7 @@ function lyapunov_full(integ1::ODEIntegrator, integ2::ODEIntegrator, T::Real;
warnstr*= "Please decrease `dt`, increase `threshold` or decrease `d0`."
warn(warnstr)
errorstr = "Parameters choosen for `lyapunov` with "
errorstr*= "`ContinuousDS` are not fitted for the algorithm."
errorstr*= "`ContinuousDynamicalSystem` are not fitted for the algorithm."
throw(ArgumentError(errorstr))
end
λ += log(a)
Expand All @@ -375,7 +375,7 @@ function lyapunov_full(integ1::ODEIntegrator, integ2::ODEIntegrator, T::Real;
end


function lyapunovs(ds::ContinuousDS, N::Real=1000;
function lyapunovs(ds::ContinuousDynamicalSystem, N::Real=1000;
Ttr::Real = 0.0, diff_eq_kwargs::Dict = Dict(), dt::Real = 0.1)

tstops = dt:dt:N*dt
Expand Down
7 changes: 5 additions & 2 deletions src/systems/continuous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ export ContinuousDS, ODEProblem, ODEIntegrator
#######################################################################################
# Constructors #
#######################################################################################
"Abstract type representing continuous systems."
abstract type ContinuousDynamicalSystem <: DynamicalSystem end

"""
ContinuousDS(state, eom! [, jacob]) <: DynamicalSystem
ContinuousDS(state, eom! [, jacob]) <: ContinuousDynamicalSystem
`D`-dimensional continuous dynamical system.
## Fields:
* `state::Vector{T}` : Current state-vector of the system
Expand All @@ -24,7 +27,7 @@ Because the `jacob` function is only necessary for a small subset of algorithms,
do not have to provide it necessarily to the constructor (but then you can't use these
functions).
"""
mutable struct ContinuousDS{T<:AbstractVector, F, J} <: DynamicalSystem
mutable struct ContinuousDS{T<:AbstractVector, F, J} <: ContinuousDynamicalSystem
state::T
eom!::F
jacob::J
Expand Down
3 changes: 2 additions & 1 deletion src/systems/discrete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ using StaticArrays, ForwardDiff, Requires

export DiscreteDS, DiscreteDS1D, evolve, evolve!, timeseries, dimension

abstract type DiscreteDynamicalSystem <: DynamicalSystem end
#####################################################################################
# Constructors #
#####################################################################################
"Abstract type representing discrete systems."
abstract type DiscreteDynamicalSystem <: DynamicalSystem end
"""
DiscreteDS(state, eom [, jacob]) <: DynamicalSystem
`D`-dimensional discrete dynamical system (used for `D ≤ 10`).
Expand Down

0 comments on commit a6e34f7

Please sign in to comment.