BifurcationKit.jl: Continuation of non-autonomous ODE limit cycle

Hi, I have a non-autonomous periodic ODE system and I want to use BifurcationKit to run continuation on the limit cycle. The system features a periodic discontinuous forcing function I_St. I have followed the steps here to convert the ODE system into an autonomous one but I am having some trouble getting the newton solver to converge.

The default newton solver seems to quickly diverge. The initial conditions for the cos(ฯ‰t) and sin(ฯ‰t) terms quickly go outside of [-1,1] and the period, which should be fixed, diverges.

I have tried implementing a constrained linear solver which keeps the period and the initial conditions for cos(ฯ‰t) and sin(ฯ‰t) fixed. This improves but still struggles to converge.

Iโ€™m not sure if thereโ€™s a way to tell BifurcationKit that the period is fixed (it is still calculating non-zero residuals for the period), or if thereโ€™s some change I can make to help the Newton solver converge.

using Parameters
using BifurcationKit
using DifferentialEquations
const BK = BifurcationKit

function ode!(dz, z, p, t=0)
    @unpack g_x1 = p

    V, x1, cost, sint = z

    ฯ‰ = 2pi/pulse_period
    x2 = cost^2 + sint^2

    IStim = I_st(cost, sint)

    alpha_x1 = 5e-4*exp((V+50.0)/12.1)/(1+exp((V+50)/17.5))
    beta_x1 = 0.0013*exp(-(V+20.0)/16.67)/(1+exp(-(V+20.0)/25))

    i_x1 = x1*g_x1*(exp(0.04*(V+77.0))-1)/exp(0.04*(V+35))

    dz[1] = (IStim-i_x1)/0.01
    dz[2] = (alpha_x1*(1-x1)-beta_x1*x1)
    dz[3] = cost - ฯ‰*sint - cost*x2
    dz[4] = sint + ฯ‰*cost - sint*x2

    dz
end

function I_st(cost, sint)
    # Stimulus current using cos(ฯ‰t) and sin(ฯ‰t)
    ฯ‰ = 2pi/pulse_period
    if cost >= cos(ฯ‰*pulse_width/2)
        return pulse_amplitude
    else
        return 0.0
    end
end

pulse_width = 5.0
pulse_period = 1000.0
pulse_amplitude = 0.1

# parameter values
params = (g_x1=8e-3,)

# initial condition
z0 = [-84.624, 0.0001, cos(-pulse_width*2pi/pulse_period/2), sin(-pulse_width*2pi/pulse_period/2)]
# Initial simulation for 20 pulses
prob_de = ODEProblem(ode!, z0, (0., pulse_period), params, reltol=1e-12, abstol=1e-12)

# Continue simulation for 200 pulses
#sol = DifferentialEquations.solve(prob_de, Rodas5P(), maxiters=1e7, tspan=(0.0, 200*pulse_period), 
#save_everystep=false, save_start=false, 
#tstops=[[i*pulse_period for i in 0:199]; [i*pulse_period+pulse_width for i in 0:199]])
#z0 = sol.u[end]

# Preconverged initial conditions (200 pulses)
z0 =  [-76.8372926804862, 0.016406773506264717, 0.9998766324845715, -0.015707317147109812]

# Try and get continuation to work
lens = @optic _.g_x1
pVal = lens(params)
bp = BifurcationProblem(ode!, z0, params, lens)

# 1 pulse solution
prob_de = remake(prob_de; u0=z0)
sol_pulse = DifferentialEquations.solve(prob_de, Rodas5P(), tstops=[pulse_width])

function mycallback((x, f, J, res, iteration, itlinear, options); kwargs...)
    println("Proposed state vector: ", x)
    println("Residuals: ", f)
    return true
end

struct CustomLS <: BK.AbstractLinearSolver end
function (l::CustomLS)(J, rhs; k...)
    # Constrained linear solver that solves Jx = rhs with the constraint that x[3:5] = 0
    h = [[0,0,1,0,0] [0,0,0,1,0] [0,0,0,0,1]] # Jacobian of the constraints
    A = [J h; h' zeros(3,3)] # Augmented matrix
    b = [rhs; zeros(3)]
    x = A \ b
    return x[1:5], true, 1
end
ls = CustomLS()

opts_br = ContinuationPar(p_min = pVal*0.9, p_max = pVal*1.1, 
newton_options=NewtonPar(verbose=true, max_iterations=100, 
#    linsolver = ls
))

# Shooting method
bpsh, cish = BK.generate_ci_problem(ShootingProblem(M=1),
bp, prob_de, sol_pulse, (0.0, pulse_period); alg = Rodas5P(), abstol=1e-12, reltol=1e-12)
brpo_sh = continuation(bpsh, cish, PALC(), opts_br;
	verbosity = 3, callback_newton = mycallback)

Default solver output

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ PALC โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”  INITIAL GUESS   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Newton step         residual      linear iterations โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚       0     โ”‚       6.9844e-09     โ”‚        0       โ”‚
Proposed state vector: [-76.8372926804862, 0.016406773506264717, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [6.984350875427481e-9, 5.748457265752904e-13, 7.427392034742297e-14, 1.7645260252940886e-12, 0.0]     
โ”‚       1     โ”‚       4.4968e-07     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267386799, 0.016406773507133692, 0.9998764670436066, -0.015717848582867438, 999.999999999719]
Residuals: [4.4880849259243405e-7, 2.793273065973545e-8, -5.552047710466468e-11, 3.336012022181478e-13, 0.0]     
โ”‚       2     โ”‚       1.4228e-04     โ”‚        1       โ”‚
Proposed state vector: [-76.83729227368049, 0.016406800921721938, 0.9998664564627906, -0.016354658933107454, 999.9999999997991]
Residuals: [-0.00014225376621368468, 2.4500561915143104e-6, -2.027867286313878e-7, 3.3173124559804368e-9, 1.4210854715199149e-11]
โ”‚       3     โ”‚       4.7107e+01     โ”‚        1       โ”‚
Proposed state vector: [-76.83743672327556, 0.016409197272704366, 1.0036259963750929, 0.213502819579819, 1000.0000074202533]
Residuals: [47.107221548598986, 0.01677635912452278, -0.02551320853699357, -0.0054274143339339, -1.4210854820650145e-11]
โ”‚       4     โ”‚       9.3936e+01     โ”‚        1       โ”‚
Proposed state vector: [-76.89452071839814, 0.2574967354625477, -18.416658028695526, 91.3782611849628, 1377.1178127804037]
Residuals: [0.3512453458236422, -0.23111424269696995, 17.874324007099702, -92.2184241507142, 1.957002116313907e-11]
โ”‚       5     โ”‚       3.8216e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.83633811304892, 0.016633033440042494, 0.5225671344086784, -1.5275678501546537, 1579.2050232283684]
Residuals: [2.856562186986821, 0.03425427743704695, -1.2586543154123537, 2.204454592499765, 0.0]
โ”‚       6     โ”‚       3.0604e+01     โ”‚        1       โ”‚
Proposed state vector: [-76.83758018078453, 0.03678283138452336, -0.9243305910393251, 0.472179584854183, 1694.6151998659225]
Residuals: [30.558716167060545, 0.03187582260123588, 1.6556607560228906, 0.2098440142870992, -2.408193040346763e-11]
โ”‚       7     โ”‚       9.5937e-01     โ”‚        1       โ”‚
Proposed state vector: [-76.83773383379386, 0.09372152030844333, 0.7229456020691687, 0.6910143197306342, 1841.3593440098573]
Residuals: [0.022000624900627486, -0.0766925367577466, 0.2498128008829511, -0.9228355644139881, 2.616729011620375e-11]
โ”‚       8     โ”‚       1.0377e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.8364354309679, 0.016209667760240895, 0.7002137850600032, -1.375461326809883, 1889.4799936450183]
Residuals: [0.2581251449583277, 0.0081184857829515, -0.9218927983086707, 0.40034163411276713, -2.685112567697016e-11]
โ”‚       9     โ”‚       5.1968e-01     โ”‚        1       โ”‚
Proposed state vector: [-76.83654494983813, 0.017781898610201744, 0.7779012135199183, -1.2023594457338087, 2037.3902425377057]
Residuals: [0.06867582484197499, 0.0010214709686721495, -0.0541808257104367, 0.5122661185167677, 0.0]
โ”‚      10     โ”‚       1.6540e+01     โ”‚        1       โ”‚

...

Proposed state vector: [-76.83722043363512, 0.02522930185119284, -0.9954206731466257, -0.09933329553845816, 12810.593146966814]
Residuals: [4.710556867529277, 0.032695987251635666, 0.5334827654898506, 0.9862455626034633, 0.0]
โ”‚      91     โ”‚       1.8551e+01     โ”‚        1       โ”‚
Proposed state vector: [-76.83796699531663, 0.04392565789800192, -0.10091834867137117, 1.0749450927242332, 12917.578328467673]
Residuals: [18.54359525300538, 0.0287436109660967, 0.5125672913962348, -0.16360259511204833, 0.0]
โ”‚      92     โ”‚       3.6042e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.83818958350508, 0.07007125149695483, -0.7578972965378681, 1.439620805654384, 13030.428589151847]
Residuals: [3.5408871353052405, -0.016172383471610763, 0.13239407534931913, -0.659399221562162, 0.0]
โ”‚      93     โ”‚       1.8591e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.83695305208067, 0.039762726537389985, -2.229245049866085, -0.5054973710272257, 13141.566481118145]
Residuals: [0.332257116928389, -0.013667039895928736, 1.78680154646118, -0.3912990084789577, -1.867528919933384e-10]
โ”‚      94     โ”‚       2.6878e+01     โ”‚        1       โ”‚
Proposed state vector: [-76.83624648414309, 0.01849297322214262, 1.1517134662829611, -1.683289735910104, 13292.449191461183]
Residuals: [26.761594449404683, 0.052656787687240816, -0.504415301515421, 2.4455266320841993, 0.0]
โ”‚      95     โ”‚       2.4814e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.83824019451876, 0.08464121497900073, -0.23560961956199278, 1.5120098226884127, 13425.349058103167]
Residuals: [0.28666251484573024, -0.05965473701750908, -0.07369662181422593, -2.4629723083030806, 1.9078568496557818e-10]
โ”‚      96     โ”‚       3.6413e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.83654792935657, 0.01802894285796075, 0.4323416627484987, -1.192187906178907, 13574.811363169796]
Residuals: [2.8963072146525803, 0.03304121652734811, -1.1620869268534186, 1.8759070367560224, 0.0]
โ”‚      97     โ”‚       3.3999e+01     โ”‚        1       โ”‚
Proposed state vector: [-76.8376156410267, 0.037000497476703254, -0.8757755340443542, 0.5278584953480621, 13689.545121231351]
Residuals: [33.958014054672, 0.028304639448807747, 1.672753681960037, 0.07614964345924458, -1.9454013683502113e-10]
โ”‚      98     โ”‚       9.0134e-01     โ”‚        1       โ”‚
Proposed state vector: [-76.83772128818283, 0.10446034582599326, 0.7464307283564292, 0.6707045724205483, 13852.244048953766]
Residuals: [0.01431640198815387, -0.0875628194129176, 0.23435150402025462, -0.8658102172767154, 0.0]
โ”‚      99     โ”‚       1.3895e+00     โ”‚        1       โ”‚
Proposed state vector: [-76.83619738446846, 0.016447447472734744, 0.6706955866565413, -1.7538892096147405, 13877.30063081221]
Residuals: [0.31357351844646075, 0.009232249972912998, -1.0653541425012754, 0.8350613561518965, -1.9720830310365343e-10]
โ”‚     100     โ”‚       4.3234e-01     โ”‚        1       โ”‚
Proposed state vector: [-76.83648932794365, 0.018310207643670917, 0.45993186273734227, -1.285894893581223, 14027.846226210926]
Residuals: [0.10721691581606763, 0.0017396651794774343, 0.035609852461198965, 0.417310753443619, 1.9934768468787817e-10]
โ”Œ Error: 
โ”‚ โ”€โ”€> Newton algorithm failed to converge, residual = 0.43233646619737703
โ”” @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Newton.jl:111
Proposed state vector: [-76.83648932794365, 0.018310207643670917, 0.45993186273734227, -1.285894893581223, 14027.846226210926]
Residuals: [0.10721691581606763, 0.0017396651794774343, 0.035609852461198965, 0.417310753443619, 1.9934768468787817e-10]
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Newton failed to converge for the initial guess on the branch. Residuals:
101-element Vector{Float64}:
  6.984351122373569e-9
  4.4967688794048215e-7
  0.00014227500803296872
 47.10723175750885
 93.93564817809023
  โ‹ฎ
 33.999285629827945
  0.901343534112679
  1.389503689593276
  0.43233646619737703
ERROR: "Stopping continuation."
Stacktrace:
 [1] iterate(it::ContIterable{โ€ฆ}; _verbosity::UInt8)
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:360
 [2] iterate
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:332 [inlined]
 [3] continuation(it::ContIterable{โ€ฆ})
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:567
 [4] continuation(prob::BifurcationKit.WrapPOSh{โ€ฆ}, alg::PALC{โ€ฆ}, contparams::ContinuationPar{โ€ฆ}; linear_algo::Nothing, bothside::Bool, kwargs::@Kwargs{โ€ฆ})
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:645
 [5] continuation
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:615 [inlined]
 [6] continuation(probPO::ShootingProblem{โ€ฆ}, orbitguess::Vector{โ€ฆ}, alg::PALC{โ€ฆ}, contParams::ContinuationPar{โ€ฆ}, linear_algo::MatrixBLS{โ€ฆ}; ฮด::Float64, eigsolver::FloquetQaD{โ€ฆ}, record_from_solution::Nothing, plot_solution::Nothing, kwargs::@Kwargs{โ€ฆ})
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\periodicorbit\PeriodicOrbits.jl:312  
 [7] continuation
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\periodicorbit\PeriodicOrbits.jl:279 [inlined]       
 [8] #continuation#797
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\periodicorbit\PeriodicOrbits.jl:342 [inlined]       
 [9] top-level scope
   @ c:\Users\pmzmo\OneDrive - The University of Nottingham\Documents\Julia\ContinuationForOptimisation\mre.jl:94
Some type information was truncated. Use `show(err)` to see complete types.

Constrained solver output

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ PALC โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”  INITIAL GUESS   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Newton step         residual      linear iterations โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚       0     โ”‚       6.9844e-09     โ”‚        0       โ”‚
Proposed state vector: [-76.8372926804862, 0.016406773506264717, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [6.984350875427481e-9, 5.748457265752904e-13, 7.427392034742297e-14, 1.7645260252940886e-12, 0.0]     
โ”‚       1     โ”‚       6.9040e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267358223, 0.016406773507142213, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-4.822368282475509e-9, -1.5019235855007196e-14, 2.4424906541753444e-14, 1.640642482980681e-12, 6.903974281158298e-6]
โ”‚       2     โ”‚       2.1365e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.8372926783497, 0.01640677350691087, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-1.196920607071661e-8, -1.1293049828609014e-14, -9.603429163007604e-14, 1.739598048944302e-12, 2.136502530447615e-6]
โ”‚       3     โ”‚       9.6965e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729269018268, 0.016406773506362157, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [1.2972918739251327e-8, 1.4883927423881005e-14, 3.2862601528904634e-14, 1.2670663129821236e-12, -9.696464076114353e-6]
โ”‚       4     โ”‚       3.1288e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267735741, 0.016406773506959477, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-5.135376568432548e-10, 9.041378756791119e-15, 2.886579864025407e-14, 1.2392309400865997e-12, 3.12878967179131e-6]
โ”‚       5     โ”‚       2.6211e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267786512, 0.016406773506945277, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-1.2606051313923672e-8, -1.0061396160665481e-15, -9.492406860545088e-14, 1.5869458525052949e-12, 2.621078465381288e-6]
โ”‚       6     โ”‚       9.8415e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729269032771, 0.016406773506378043, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-3.2092373203340685e-10, -1.5605572389887357e-14, -9.64783808399261e-14, 1.6491842613763907e-12, -9.841500059337704e-6]
โ”‚       7     โ”‚       1.0159e-05     โ”‚        1       โ”‚
Proposed state vector: [-76.83729269064496, 0.016406773506348324, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [3.7749856574009755e-9, -1.0380585280245214e-14, -6.339373470609644e-14, 1.5267336006541399e-12, -1.0158743179999874e-5]
โ”‚       8     โ”‚       6.4267e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729268691292, 0.01640677350650771, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [8.553186603421636e-9, 2.6808416597745577e-14, 7.438494264988549e-15, 1.3420757560833607e-12, -6.426702725548239e-6]
โ”‚       9     โ”‚       2.0291e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.8372926784571, 0.016406773506918198, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [2.5301005734945647e-9, -5.30825383648903e-16, 2.7200464103316335e-14, 1.9304141618547987e-12, 2.029096890510118e-6]
โ”‚      10     โ”‚       4.5304e-06     โ”‚        1       โ”‚

...

Proposed state vector: [-76.8372926790276, 0.016406773506889807, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-2.2934187882128754e-9, 5.100087019371813e-16, -1.8207657603852567e-14, 1.5601825387179247e-12, 1.4586021279683337e-6]
โ”‚      92     โ”‚       8.0874e-07     โ”‚        1       โ”‚
Proposed state vector: [-76.83729268129493, 0.016406773506787292, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [4.336186520959018e-9, -8.819334151866087e-15, 3.197442310920451e-14, 1.821421485859176e-12, -8.087255309874308e-7]
โ”‚      93     โ”‚       3.4782e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267700807, 0.016406773506973418, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-1.3645475860357692e-8, 8.604228440844963e-15, -9.681144774731365e-14, 1.7920560868578406e-12, 3.478135113255121e-6]
โ”‚      94     โ”‚       1.0012e-05     โ”‚        1       โ”‚
Proposed state vector: [-76.83729269049827, 0.016406773506368922, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [1.09403544001907e-8, -3.032643580702654e-14, 1.0103029524088925e-14, 1.316773079462763e-12, -1.0012058737629559e-5]
โ”‚      95     โ”‚       8.0392e-07     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267968236, 0.016406773506830605, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-1.1379157172086707e-8, 1.8370721610594387e-14, -1.0291767438275201e-13, 1.6086784682123323e-12, 8.038369969654013e-7]
โ”‚      96     โ”‚       1.0446e-05     โ”‚        1       โ”‚
Proposed state vector: [-76.83729269093206, 0.016406773506337485, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [8.800782325124601e-11, 1.4377388168895777e-14, -1.084687895058778e-13, 1.194853244124161e-12, -1.04458450778111e-5]
โ”‚      97     โ”‚       1.0359e-05     โ”‚        1       โ”‚
Proposed state vector: [-76.83729269084508, 0.01640677350635554, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [4.033651634927082e-9, -5.582340145693365e-15, -8.115730310009894e-14, 1.870406607373809e-12, -1.0358860436099349e-5]
โ”‚      98     โ”‚       6.3711e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729268685731, 0.01640677350653125, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [1.1214225992262072e-8, 2.327998904760875e-15, 4.674038933671909e-14, 1.596577037243918e-12, -6.3710956510476535e-6]
โ”‚      99     โ”‚       4.7155e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.8372926757707, 0.01640677350703726, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-2.420108557998901e-10, -3.635980405647388e-15, 3.008704396734174e-14, 1.728225201835798e-12, 4.71550265501719e-6]
โ”‚     100     โ”‚       4.4763e-06     โ”‚        1       โ”‚
Proposed state vector: [-76.83729267600995, 0.016406773507022823, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-8.856602562445914e-9, -7.941564073021823e-15, -3.885780586188048e-14, 1.522244136298312e-12, 4.476248705032049e-6]
โ”Œ Error: 
โ”‚ โ”€โ”€> Newton algorithm failed to converge, residual = 4.476257466758628e-6
โ”” @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Newton.jl:111
Proposed state vector: [-76.83729267600995, 0.016406773507022823, 0.9998766324845715, -0.015707317147109812, 1000.0]
Residuals: [-8.856602562445914e-9, -7.941564073021823e-15, -3.885780586188048e-14, 1.522244136298312e-12, 4.476248705032049e-6]
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Newton failed to converge for the initial guess on the branch. Residuals:
101-element Vector{Float64}:
 6.984351122373569e-9
 6.903975965350241e-6
 2.136536057384958e-6
 9.696472754357554e-6
 3.128789713935795e-6
 โ‹ฎ
 1.0358861221434208e-5
 6.371105520525106e-6
 4.715502661227794e-6
 4.476257466758628e-6
ERROR: "Stopping continuation."
Stacktrace:
 [1] iterate(it::ContIterable{โ€ฆ}; _verbosity::UInt8)
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:360
 [2] iterate
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:332 [inlined]
 [3] continuation(it::ContIterable{โ€ฆ})
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:567
 [4] continuation(prob::BifurcationKit.WrapPOSh{โ€ฆ}, alg::PALC{โ€ฆ}, contparams::ContinuationPar{โ€ฆ}; linear_algo::Nothing, bothside::Bool, kwargs::@Kwargs{โ€ฆ})
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:645
 [5] continuation
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\Continuation.jl:615 [inlined]
 [6] continuation(probPO::ShootingProblem{โ€ฆ}, orbitguess::Vector{โ€ฆ}, alg::PALC{โ€ฆ}, contParams::ContinuationPar{โ€ฆ}, linear_algo::MatrixBLS{โ€ฆ}; ฮด::Float64, eigsolver::FloquetQaD{โ€ฆ}, record_from_solution::Nothing, plot_solution::Nothing, kwargs::@Kwargs{โ€ฆ})
   @ BifurcationKit C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\periodicorbit\PeriodicOrbits.jl:312  
 [7] continuation
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\periodicorbit\PeriodicOrbits.jl:279 [inlined]       
 [8] #continuation#797
   @ C:\Users\pmzmo\.julia\packages\BifurcationKit\KwA2l\src\periodicorbit\PeriodicOrbits.jl:342 [inlined]       
 [9] top-level scope
   @ c:\Users\pmzmo\OneDrive - The University of Nottingham\Documents\Julia\ContinuationForOptimisation\mre.jl:94
Some type information was truncated. Use `show(err)` to see complete types.

Versioninfo

Julia Version 1.11.1
Commit 8f5b7ca12a (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 4 ร— Intel(R) Core(TM) i3-8130U CPU @ 2.20GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =
1 Like