You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm making a bifurcation diagram for my system, following the example document:
using Revise, Plots
using BifurcationKit, Parameters, LinearAlgebra
# Define the function for the state variables
function SB(u, p)
a₁, a₂ = u # unpack the state variables (complex numbers)
δω, U₀ₑ, τ, κ, phi, f = p # unpack parameters
d = im * exp(im * phi / 2) / sqrt(τ)
γ = -1/(2*τ)
# Compute the derivatives
[
(im * (δω + abs2(a₁) / U₀ₑ) - 1) * a₁ + τ * (im * κ + γ) * a₂ + τ * d * f,
(im * (δω + abs2(a₂) / U₀ₑ) - 1) * a₂ + τ * (im * κ + γ) * a₁ + τ * d * f
]
end
function wrap_SB(u, p)
# Convert real and imaginary parts back to complex numbers
a₁ = complex(u[1], u[2])
a₂ = complex(u[3], u[4])
# Apply the original system's function
out = SB([a₁, a₂], p)
# Return the real and imaginary parts separately
return [real(out[1]), imag(out[1]), real(out[2]), imag(out[2])]
end
# Define the parameters
par = (δω = -0.2, U₀ₑ = 1.0, τ = 1.0, κ = 0.8, phi = 0.0, f = sqrt(2.5))
# Define the initial condition for the state variables
u0 = [0.3, 0.0, 0.3, 0.0]
# Define the BifurcationProblem
prob = BifurcationProblem(wrap_SB, u0, par, (@lens _.f);
record_from_solution = (u, p) -> (abs2(complex(u[1], u[2])), complex(u[1], u[2])))
# options for newton
# we reduce a bit the tolerances to ease automatic branching
opt_newton = NewtonPar(tol = 1e-9)
# options for continuation
opts_br = ContinuationPar(dsmin = 0.001, dsmax = 0.005, ds = 0.001,
newton_options = opt_newton,
nev = 1,
# parameter interval
p_min = 1.0, p_max = 2.,
# detect bifurcations with bisection method
# we increase here the precision for the detection of
# bifurcation points
n_inversion = 8)
diagram = bifurcationdiagram(prob, PALC(),
# very important parameter. This specifies the maximum amount of recursion
# when computing the bifurcation diagram. It means we allow computing branches of branches
# at most in the present case.
2,
opts_br,
)
# You can plot the diagram like
plot(diagram; putspecialptlegend=false, markersize=2, plotfold=false, title = "#branches = $(size(diagram))")
However, the output is an error showing: ERROR: MethodError: objects of type ContinuationPar{Float64, DefaultLS, DefaultEig{typeof(real)}} are not callable
Could you help? Thanks!
The text was updated successfully, but these errors were encountered:
Hi, I'm making a bifurcation diagram for my system, following the example document:
However, the output is an error showing:
ERROR: MethodError: objects of type ContinuationPar{Float64, DefaultLS, DefaultEig{typeof(real)}} are not callable
Could you help? Thanks!
The text was updated successfully, but these errors were encountered: