Skip to content

Commit e17b163

Browse files
committed
rename to jacobian_eigenvals
1 parent 2cf2e62 commit e17b163

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# NetworkDynamics Release Notes
22

33
## v0.10.1 Changelog
4+
- [#294](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/294) add linear stability analysis functions: `isfixpoint`, `jacobian_eigenvals`, and `is_linear_stable` with support for both ODE and DAE systems
45
- [#283](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/283) add automatic sparsity detection using `get_jac_prototype` and `set_jac_prototype!`
56
- [#285](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/285) rename `delete_initconstraint!` -> `delete_initconstaints!` and `delete_initformula!` -> `delete_initformulas!`
67

docs/src/API.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ delete_initformulas!
179179
interface_values
180180
```
181181

182+
## Linear Stability Analysis
183+
```@docs
184+
isfixpoint
185+
jacobian_eigenvals
186+
is_linear_stable
187+
```
188+
182189
## Callbacks API
183190
### Define Callbacks
184191
```@docs

docs/src/initialization.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,6 @@ nothing #hide
227227

228228
**Applying Constraints**: Constraints can be either added to the metadata of components ([`set_initconstraint!`](@ref), [`add_initconstraint!`](@ref)) or passed as `additional_initconstraint` to the
229229
[`initialize_component[!]`](@ref NetworkDynamics.initialize_component) functions.
230+
231+
## Analysing Fixpoints
232+
In order to analyse fixpoints NetworkDynamis provides the functions [`isfixpoint`](@ref), [`is_linear_stable`](@ref) and [`jacobian_eigenvals`](@ref).

src/NetworkDynamics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export has_marker, get_marker, set_marker!
103103
export get_defaults_dict, get_guesses_dict, get_bounds_dict, get_inits_dict
104104
include("metadata.jl")
105105

106-
export isfixpoint, is_linear_stable, linear_eigenvals
106+
export isfixpoint, is_linear_stable, jacobian_eigenvals
107107
include("linear_stability.jl")
108108

109109
include("show.jl")

src/linear_stability.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ the eigenvalues of the Jacobian matrix (or reduced Jacobian for constrained syst
2525
A fixpoint is linearly stable if all eigenvalues of the Jacobian have negative
2626
real parts. For systems with algebraic constraints (non-identity mass matrix),
2727
the reduced Jacobian is used following the approach in [1].
28-
See [`linear_eigenvals`](@ref) for more details.
28+
See [`jacobian_eigenvals`](@ref) for more details.
2929
3030
# Arguments
3131
- `nw::Network`: The network dynamics object
3232
- `s0::NWState`: The state to check for linear stability (must be a fixpoint)
33-
- `kwargs...`: Additional keyword arguments passed to `linear_eigenvals`
33+
- `kwargs...`: Additional keyword arguments passed to `jacobian_eigenvals`
3434
3535
# Returns
3636
- `Bool`: `true` if the fixpoint is linearly stable, `false` otherwise
@@ -40,7 +40,7 @@ See [`linear_eigenvals`](@ref) for more details.
4040
"""
4141
function is_linear_stable(nw::Network, s0; kwargs...)
4242
isfixpoint(nw, s0) || error("The state s0 is not a fixpoint of the network nw.")
43-
λ = linear_eigenvals(nw, s0; kwargs...)
43+
λ = jacobian_eigenvals(nw, s0; kwargs...)
4444
if all-> real(λ) < 0.0, λ)
4545
return true
4646
else
@@ -49,7 +49,7 @@ function is_linear_stable(nw::Network, s0; kwargs...)
4949
end
5050

5151
"""
52-
linear_eigenvals(nw::Network, s0::NWState; eigvalf=LinearAlgebra.eigvals)
52+
jacobian_eigenvals(nw::Network, s0::NWState; eigvalf=LinearAlgebra.eigvals)
5353
5454
Compute the eigenvalues of the Jacobian matrix for linear stability analysis of
5555
the network dynamics at state `s0`.
@@ -89,7 +89,7 @@ For constrained systems (M ≠ I, differential-algebraic equations):
8989
# References
9090
[1] "Power System Modelling and Scripting", F. Milano, Chapter 7.2.
9191
"""
92-
function linear_eigenvals(nw::Network, s0; eigvalf=LinearAlgebra.eigvals)
92+
function jacobian_eigenvals(nw::Network, s0; eigvalf=LinearAlgebra.eigvals)
9393
x0, p, t = uflat(s0), pflat(s0), s0.t # unpack state
9494
M = nw.mass_matrix
9595

test/linear_stability_test.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ using Test
2525
s_non_fix.v[1, :s] = 1.0
2626
@test !isfixpoint(nw, s_non_fix)
2727

28-
# Test linear_eigenvals function
29-
λ = linear_eigenvals(nw, s0)
28+
# Test jacobian_eigenvals function
29+
λ = jacobian_eigenvals(nw, s0)
3030
@test length(λ) == 3 # Should have 3 eigenvalues for 3 vertices
3131
@test all(real.(λ) .≤ 0) # All eigenvalues should have non-positive real parts
3232
@test nw.mass_matrix == I # Verify unconstrained system
3333

3434
# Test custom eigenvalue function
35-
λ_custom = linear_eigenvals(nw, s0; eigvalf=eigvals)
35+
λ_custom = jacobian_eigenvals(nw, s0; eigvalf=eigvals)
3636
@test λ λ_custom
3737

3838
# Test is_linear_stable function
@@ -62,7 +62,7 @@ using Test
6262
@test isfixpoint(nw, s0)
6363

6464
# Test eigenvalue computation
65-
λ = linear_eigenvals(nw, s0)
65+
λ = jacobian_eigenvals(nw, s0)
6666
@test length(λ) == 8 # 4 nodes × 2 states each
6767

6868
# Test stability (should be stable for this configuration)
@@ -92,7 +92,7 @@ using Test
9292
@test isfixpoint(nw, s0)
9393

9494
# Test eigenvalue computation for DAE system (should use reduced Jacobian)
95-
λ = linear_eigenvals(nw, s0)
95+
λ = jacobian_eigenvals(nw, s0)
9696
@test length(λ) == 3 # Should have 3 eigenvalues (differential variables only)
9797
@test all(real.(λ) .< 0) # Should be stable
9898

0 commit comments

Comments
 (0)