Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument error for BifurcationProblem #175

Closed
RpfR2000 opened this issue Sep 10, 2024 · 4 comments
Closed

Argument error for BifurcationProblem #175

RpfR2000 opened this issue Sep 10, 2024 · 4 comments

Comments

@RpfR2000
Copy link

This is a problem I've been encountering with more or less every BifurcationKit example online. Here's an example. I try to run the following code:

using Revise, Plots
using BifurcationKit
using Accessors
const BK = BifurcationKit

function Pop!(du, X, p, t = 0)
	(;r,K,a,ϵ,b0,e,d) = p
	x, y, u, v = X
	p = a * x / (b0 * (1 + ϵ * u) + x)
	du[1] = r * (1 - x/K) * x - p * y
	du[2] = e * p * y - d * y
	s = u^2 + v^2
	du[3] = u-2pi * v - s * u
	du[4] = 2pi * u + v - s * v
	du
end

par_pop = ( K = 1., r = 6.28, a = 12.56, b0 = 0.25, e = 1., d = 6.28, ϵ = 0.2, )

z0 = [0.1,0.1,1,0]

prob = BifurcationProblem(Pop!, z0, par_pop, (@optic _.b0);
	record_from_solution = (x, p; k...) -> (x = x[1], y = x[2], u = x[3]))

opts_br = ContinuationPar(p_min = 0., p_max = 20.0, ds = 0.002, dsmax = 0.01, n_inversion = 6, nev = 4)

and I get the following error:

ERROR: LoadError: MethodError: no method matching BifurcationProblem(::BifFunction{…}, ::Vector{…}, ::@NamedTuple{…}, ::PropertyLens{…}, ::typeof(BifurcationKit.plot_default), ::var"#10#12")

Closest candidates are:
  BifurcationProblem(::Tvf, ::Tu, ::Tp, ::Tl, ::Tplot, ::Trec) where {Tvf, Tu, Tp, Tl<:Lens, Tplot, Trec}
   @ BifurcationKit ~/.julia/packages/BifurcationKit/5kgAI/src/Problems.jl:133
  BifurcationProblem(::Any, ::Any, ::Any, ::Any; jvp, vjp, J, Jᵗ, d2F, d3F, issymmetric, record_from_solution, plot_solution, delta, inplace)
   @ BifurcationKit ~/.julia/packages/BifurcationKit/5kgAI/src/Problems.jl:178
  BifurcationProblem(::Any, ::Any, ::Any; ...)
   @ BifurcationKit ~/.julia/packages/BifurcationKit/5kgAI/src/Problems.jl:178

Stacktrace:
 [1] BifurcationProblem(_F::typeof(Pop!), u0::Vector{…}, parms::@NamedTuple{…}, lens::PropertyLens{…}; jvp::Nothing, vjp::Nothing, J::Nothing, Jᵗ::Nothing, d2F::Nothing, d3F::Nothing, issymmetric::Bool, record_from_solution::Function, plot_solution::typeof(BifurcationKit.plot_default), delta::Float64, inplace::Bool)
   @ BifurcationKit ~/.julia/packages/BifurcationKit/5kgAI/src/Problems.jl:215

By the way, I think Accessors.jl is a necessary dependency to get the optic macro now (maybe this was not the case previously).

@rveltz
Copy link
Member

rveltz commented Sep 10, 2024

What is your version of BK?

@RpfR2000
Copy link
Author

v0.3.3

@rveltz
Copy link
Member

rveltz commented Sep 10, 2024

You hsve to usr 0.4

@RpfR2000
Copy link
Author

I see, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants