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

BifurcationKit not working with ArrayPartitions ? #112

Open
isoponde3 opened this issue Aug 17, 2023 · 1 comment
Open

BifurcationKit not working with ArrayPartitions ? #112

isoponde3 opened this issue Aug 17, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@isoponde3
Copy link

Hello,

I tried to use BifurcationKit on a problem whose variables are in an ArrayPartition but could not get it to work. Here is an example (copied from the BifurcationKit's branch switching documentation and minimally modified to operate on an ArrayPartition):

using BifurcationKit, Setfield, Plots
using RecursiveArrayTools

# vector field of transcritical bifurcation
F(x, p) = [x[1] * (p.μ - x[1])]
# vector field of transcritical bifurcation using an ArrayPartition
F(x, p) = x .* (p.μ .- x)

# parameters of the vector field
par == -0.2, )

# problem (automatic differentiation)
#prob = BifurcationProblem(F, [0.1], par, (@lens _.μ); recordFromSolution = (x, p) -> x[1])
u0 = ArrayPartition([0.1])
prob = BifurcationProblem(F, u0, par, (@lens _.μ); recordFromSolution = (x, p) -> x.x[1][1])

# compute branch of trivial equilibria (=0) and detect a bifurcation point
opts_br = ContinuationPar(dsmax = 0.05, ds = 0.01, detectBifurcation = 3, nev = 2)
br = continuation(prob, PALC(), opts_br, plot=true)

# perform branch switching on one side of the bifurcation point fails
br1Top = continuation(br, 1, setproperties(opts_br; maxSteps = 14) )

Thank you,

Stephane

@rveltz
Copy link
Member

rveltz commented Aug 18, 2023

Thank you for posting this. The branching method should work if the type of the eigenvectors matches ArrayPartition. This is clearly a requirement that should be highlighted in the docs.

You seem to use DefaultEig for the eigensolver which default to eigen.

As you can see eigen(BK.jacobian(prob,u0,par) returns Array for the eigenvectors and the partition is lost. I should perhaps enforce the command geteigenvector to match the type of prob.

@rveltz rveltz added the enhancement New feature or request label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants