-
Notifications
You must be signed in to change notification settings - Fork 40
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
recommendations on basic usage of package #63
Comments
I suggest that you first use Natural() continuation to get à feeling. I think the problem is from the scaling of k. I would write k = 1e6 * k2 and continue in k2 |
Now my function accept ┌─ Number of points: 2
├─ Curve of EquilibriumCont
├─ Type of vectors: Vector{Float64}
├─ Parameter k starts at 12.565703947692505, ends at 12.566370614359172
├─ Algo: Natural
└─ Special points:
If `br` is the name of the branch,
ind_ev = index of the bifurcating eigenvalue e.g. `br.eig[idx].eigenvals[ind_ev]`
- # 1, endpoint at k ≈ +12.56637061, step = 1 If I use ERROR: AmosException with id 2: overflow.
Stacktrace:
[1] _besseli(nu::Float64, z::ComplexF64, kode::Int32)
@ SpecialFunctions ~/.julia/packages/SpecialFunctions/hefUc/src/bessel.jl:240
[2] besseli(nu::Float64, z::ComplexF64)
@ SpecialFunctions ~/.julia/packages/SpecialFunctions/hefUc/src/bessel.jl:364
[3] besseli
@ ~/.julia/packages/SpecialFunctions/hefUc/src/bessel.jl:454 [inlined]
... I think this is an error related to automatic differentiation. My function Is there a way to pass the Jacobian function |
You can pass the jacobian to a |
I am surprised Natural did not work, it is a basic Newton method |
Oh are using complex numbers? You can only use reals |
My function uses complex numbers internally, but its arguments Providing the externally constructed Jacobian doesn't help unfortunately... I increased the lower bound of ┌─ Number of points: 67
├─ Curve of EquilibriumCont
├─ Type of vectors: Vector{Float64}
├─ Parameter k starts at 12.566370614359172, ends at 2.228729830345902
├─ Algo: PALC
└─ Special points:
If `br` is the name of the branch,
ind_ev = index of the bifurcating eigenvalue e.g. `br.eig[idx].eigenvals[ind_ev]`
- # 1, endpoint at k ≈ +2.09439510, step = 66 The end point value |
You can look at I am surprised natural does not work. You should check the function newton in verbose mode. Once this works try Natural by adjusting the ds. Then try PALC. Do this with verbosity =3 in Newton verbose mode. This will tell you the parameters steps and the Newton iterations. |
Regarding #####################################################
────────── Natural ────────────
───────────────── INITIAL GUESS ────────────────────
--> convergence of initial guess = OK
--> parameter = 12.566370614359172, initial step
───────────────── INITIAL TANGENT ───────────────────
--> convergence of the initial guess = OK
--> parameter = 12.565703947692505, initial step (bis)
──────────────────────────────────────────────────────────────────────
Continuation Step 0
Step size = -1.0000e-01
Parameter k = 1.2566e+01 ⟶ 1.2566e+01 [guess]
--> Step Converged in 0 Nonlinear Iteration(s)
Parameter k = 1.2566e+01 ⟶ 1.2566e+01
--> Computed 1 eigenvalues in 1 iterations, #unstable = 0 In comparison, here is the abbreviated output for #####################################################
────────── PALC ────────────
───────────────── INITIAL GUESS ────────────────────
--> convergence of initial guess = OK
--> parameter = 12.566370614359172, initial step
───────────────── INITIAL TANGENT ───────────────────
--> convergence of the initial guess = OK
--> parameter = 12.565703947692505, initial step (bis)
Predictor: Secant
──────────────────────────────────────────────────────────────────────
Continuation Step 0
Step size = -1.0000e-01
Parameter k = 1.2566e+01 ⟶ 1.2488e+01 [guess]
--> Step Converged in 1 Nonlinear Iteration(s)
Parameter k = 1.2566e+01 ⟶ 1.2488e+01
--> Computed 1 eigenvalues in 1 iterations, #unstable = 0
Predictor: Secant
──────────────────────────────────────────────────────────────────────
Continuation Step 1
Step size = -1.4050e-01
Parameter k = 1.2488e+01 ⟶ 1.2377e+01 [guess]
--> Step Converged in 1 Nonlinear Iteration(s)
Parameter k = 1.2488e+01 ⟶ 1.2377e+01
--> Computed 1 eigenvalues in 1 iterations, #unstable = 0
Predictor: Secant
──────────────────────────────────────────────────────────────────────
...
──────────────────────────────────────────────────────────────────────
Continuation Step 66
Step size = -2.0000e-01
Parameter k = 2.2287e+00 ⟶ 2.0874e+00 [guess]
Newton correction failed
Halving continuation step, ds=-0.1
Predictor: Secant The message for the last continuation step seems to indicate a failure. Any suggestions for preventing this failure? |
Yes I think you should decrease the option |
I am wondering what happens if pmax is a bit higher than your initial guess? I don't get why the continuation ends. Can you show the Newton iterations too? I am sorry about this, being away from my comp makes it hard to help you. Usually this would be resolved quickly |
Could you let me know how to show the Newton iterations? The posted output is all I got with |
That is in NewtonPar |
can you share the function F please so I can help more? |
can we progress on this? |
Sorry for the delay. I think I found a way to solve my equation without using this package. The method modified my function, and I think there is a high chance that the modified function could work better with Even though I have found a solution not using |
Please do! I havent tried examples with large values like you do. Bests |
(Starting an issue as recommended by https://discourse.julialang.org/t/ann-new-version-of-package-bifurcationkit-jl-v0-1-11/75569/8)
I'm new to
BifurcationKit.jl
, or bifurcation analysis in general. Still, from the package description, I feel that the package could solve my problem, but I am having difficulty in making it work.My understanding is that$F(u,p) = 0$ with a varying parameter $p$ . Here, $F$ is a vector-valued function in general, and from the documentation I see that it is usually a discretized version of some differential equation.
BifurcationKit.jl
solvesMy problem is much simpler than this general situation. My function$f(β, k)$ is scalar-valued. The solution $β$ and the parameter $k$ are also scalar. I already have $f(β, k)$ , such that I can evaluate $f(β, k)$ for arbitrary $β$ and $k$ . There could be multiple solutions $β$ for a given $k$ , and the number of solutions can change with $k$ . Suppose we have $n$ solutions $β_1(k_0), ..., β_n(k_0)$ for some $k_0$ . My goal is to track the evolution of each of these solutions while varying $k$ from $k_0$ .
Currently I am solving$f(β, k) = 0$ for each $k$ by
![βk](https://user-images.githubusercontent.com/1783289/182061776-5a02a509-0c23-4052-8703-aad052c31d22.png)
$β$ 's for each value $k$ of the horizontal axis. It is hard to distinguish multiple $β$ 's in this plot, but if we plot $b$ and $V$ , which are normalized versions of $β$ and $k$ , they become distinguishable:
![bV](https://user-images.githubusercontent.com/1783289/182062145-e6541256-ed3e-4549-8cd2-47dea414cb5a.png)
Root.jl
, and here is the result:The plotted numbers indicate the number of the solution
I attempted to generate the top curve out of the three in the above plot with
BifurcationKit.jl
. I followed this example, and the overall structure of the code looks as follows:and running the code generates
The solution was found in one Newton iteration, because I used the solution found by
Roots.jl
as the initial guess.Then, if I continue and run
I get
Here, the endpoint
k
value is slightly moved fromkmax = 12566370.614359174
towardskmin = 897597.9010256552
(becauseds < 0
), but it is much greater thankmin
, whereas the smallestk
value plotted in the top curve of the first figure above is actually quite close tokmin
.What is the right approach to solve this problem with
BifurcationKit.jl
? Any suggestions? If desired, I can share the full script used to generate the above result.The text was updated successfully, but these errors were encountered: