[go: up one dir, main page]

Menu

#53 required function not found' with '-var' option in ode_isol2po

---
open
None
2023-11-24
2023-11-23
Jacob Ngaha
No

Hello!

I'm trying to recreate the E-to-P connection results from section 10.2.2 of Recipes for Continuation using the po, coll, and ep toolboxes. In order to calculate the Floquet vectors, I'm trying to solve for the monodromy matrix by setting up a variational problem. According to the documentation on the po toolbox, I can do this by adding the -var option with a matrix to the ode_isol2po constructor,

prob = ode_isol2po(prob, '', func_list{:}, t0, x0, pnames, p0, '-var', eye(3)).

However, running this line brings up the error (also attached screenshot)

coco_add_func: required function 'po.orb.coll.test' not found.

I'm not sure if I'm constructing the problem correctly, but I haven't found any issues with the linode example in the coll toolbox which also uses this option, but with the ode_isol2coll constructor.

I have also attached a single-file MWE, which I am running with MATLAB v2023b. I unfortunately can't attach a coco_log.txt file as the code stops at the ode_isol2po line. The functions, and the initial guess solution, have been taken out of the section in Recipes for Continuation.

Thanks!

2 Attachments

Discussion

  • Harry Dankowicz

    Harry Dankowicz - 2023-11-23

    Thank you, Jacob, for this question.

    I am very happy to see that you are exploring COCO and attempting to reproduce existing results using independently developed code.

    There are several parts to this that I will address below.
    1. Even if the error you encountered hadn't been thrown, your code would not have executed, since the introduction of the variational problem added 9 to the dimensional deficit. To prevent this from happening, you would need to also introduce 9 constraints, e.g., using the following code:

    [data, uidx] = coco_get_func_data(prob, 'po.orb.coll.var', 'data', 'uidx');
    prob = coco_add_pars(prob, 'pars2', uidx(data.coll_var.v0_idx,:), ...
     {'s1' 's2' 's3' 's4' 's5' 's6' 's7' 's8' 's9'});
    

    as is done in the coll/exampes/linode demo. This holds the initial values of the solution to the variational problem fixed and ensures a unique solution to the variational problem given the corresponding periodic orbit.

    1. The error is thrown because the encoding of the ode_isol2coll constructor assumes that if you are embedding a linearization of the dynamical system with the continuation problem, then you will not want the toolbox to also define a monitor function that computes the solution to the variational problem and stores this for potential use during bifurcation analysis. This assumption was made to reduce redundant computations but is perhaps a flawed assumption in practice.

    2. Two options come to mind: you either override this assumption by replacing

      [prob, data] = coll_add(prob, data, sol, '-no-var', '-cache-jac');
    

    with

      [prob, data] = coll_add(prob, data, sol, '-cache-jac');
    

    in ode_isol2coll.

    Alternatively, you turn off the default bifurcation detection for the 'po' toolbox by invoking the command

    prob = coco_set(prob, 'po', 'bifus', off);
    

    before calling ode_isol2po. If you still want to perform bifurcation detection, you could now use the solution to the variational problem to define test functions that check for saddle-node, period-doubling, and Hopf bifurcations.

    I ran your code with the second option (and with the fix described in 1.) but without implementing any further test functions, and everything seems to execute fine.

    I hope that helps.

    Harry

     
    • Jacob Ngaha

      Jacob Ngaha - 2023-11-23

      Kia ora Harry,

      Thank you so much for the response. The second option has worked perfectly.

      On an unrelated note, Bernd and Hinke say hi!

      Cheers,
      Jacob

       
  • Jacob Ngaha

    Jacob Ngaha - 2023-11-23

    In case anyone from the future sees this, I've attached the example code with the fixes implemented.

     

    Last edit: Jacob Ngaha 2023-11-23
  • Harry Dankowicz

    Harry Dankowicz - 2023-11-24

    Thank you, Jacob, also for the greetings!

    Although option #2 provides a fix, the behavior you have identified should count as a bug, since a construction error is thrown for a syntactically correct construction. I will aim to encode a transparent and well-documented solution to this in a future COCO update.

    Kind regards,

    Harry

     
  • Harry Dankowicz

    Harry Dankowicz - 2023-11-24
    • assigned_to: Harry Dankowicz
     

Log in to post a comment.