champsproject / ldds

Python package for computing and visualizing Lagrangian Descriptors in Dynamical Systems
BSD 3-Clause "New" or "Revised" License
18 stars 2 forks source link

Code extension to high-dimensional systems. #21

Closed broncio123 closed 4 years ago

broncio123 commented 4 years ago

Modified all pylds modules, NOTES, and EXAMPLES notebooks.

vkrajnak commented 4 years ago

I'll need a bit more time with the rest of the code, especially the axes and masks

broncio123 commented 4 years ago

I'll need a bit more time with the rest of the code, especially the axes and masks

That's OK @vkrajnak , take your time :)

vkrajnak commented 4 years ago

There is an issue with the way initial conditions are determined. Henon-Heiles runs for the following parameters in the notebook, even though it shouldn't.

dof_fixed = [0,0,0,1] # Variable ordering (x1 x2 y1 y2) dof_fixed_values = [10000000000000] # This can also be an array of values dof_slice = [1,0,1,0] # Visualisation slice momentum_sign = 1 # Direction of momentum that defines the slice - (1) positive / (-1) negative

Edit: same for the saddle x centre

vkrajnak commented 4 years ago

Negative energy in the saddle x centre doesn't produce any result, even far away from the saddle, where the potential is presumably very low. If the Hamiltonian is correct, one of the following should (and doesn't) return non-nan results:

H0 = -1 # Energy dof_fixed = [0,1,0,0] # Variable ordering (x1 x2 y1 y2) dof_fixed_values = [10000000000000] # This can also be an array of values dof_slice = [1,0,1,0] # Visualisation slice

or

H0 = -1 # Energy dof_fixed = [1,0,0,0] # Variable ordering (x1 x2 y1 y2) dof_fixed_values = [10000000000000] # This can also be an array of values dof_slice = [0,1,0,1] # Visualisation slice

vkrajnak commented 4 years ago

Also momentum_sign gives identical results for +/-1 in the saddle x centre, which cannot be right. It seems to do something in Henon-Heiles.

It is right. Never mind, my fault.

broncio123 commented 4 years ago

I added some more changed to the code that

vkrajnak commented 4 years ago

Looking good! I have no more comments on the code. Once all the above points are addressed, I'm happy to give it a go-ahead.

broncio123 commented 4 years ago

Hi @vkrajnak All good now. Ignore my previous comments, please. And thanks for updating the last sections of the EXAMPLEs notebook.

broncio123 commented 4 years ago

@vkrajnak changes implemented. Have a final look if you think convenient. Otherwise, go ahead with pull request.

vkrajnak commented 4 years ago

Looks very good. There are still some variables called dof_something that are not degrees of freedom.

One last fundamental question: what does momentum_sign do if the slice is defined by a fixed value of a momentum, say p2=0? q1,p1 are the coordinates on the slice and q2 should be determined so that either \dot{p2}>=0 or \dot{p2}<=0. I don't quite see how this works in energy_conservation_condition.

broncio123 commented 4 years ago

Looks very good. There are still some variables called dof_something that are not degrees of freedom.

I'll rename these variables. Thanks!

One last fundamental question: what does momentum_sign do if the slice is defined by a fixed value of a momentum, say p2=0? q1,p1 are the coordinates on the slice and q2 should be determined so that either \dot{p2}>=0 or \dot{p2}<=0. I don't quite see how this works in energy_conservation_condition.

Because it doesn't. Energy conservation is provisionally restricted to determine values of momenta. Since their values are given by solving a quadratic equation. But, if you were to determine position coordinates, the equation is no longer quadratic but depends on the form of the potential. So, a numerical routine would have to be implemented for this.

This seems a fundamental limitation of the code, however, as @VikJGG might tell us, momentum coordinates are left to be determined via energy conservation most of the time in publications. If there are any counter-examples, maybe we can compare how someone did it.

vkrajnak commented 4 years ago

Then it might be worth throwing in an error if a momentum value is fixed. This way it produces something, but as you say, the position coordinate isn't calculated correctly.

Rafa looked at some fixed-momentun slices in the past. They are a bit harder to interpret, but they still have a meaning.

broncio123 commented 4 years ago

Then it might be worth throwing in an error if a momentum value is fixed. This way it produces something, but as you say, the position coordinate isn't calculated correctly.

Rafa looked at some fixed-momentun slices in the past. They are a bit harder to interpret, but they still have a meaning.

I see. This might be worth pursuing later. So, please @vkrajnak open an issue for this. But, yeah, this is a limitation that all of us must be aware of.

broncio123 commented 4 years ago

Looks very good. There are still some variables called dof_something that are not degrees of freedom.

One last fundamental question: what does momentum_sign do if the slice is defined by a fixed value of a momentum, say p2=0? q1,p1 are the coordinates on the slice and q2 should be determined so that either \dot{p2}>=0 or \dot{p2}<=0. I don't quite see how this works in energy_conservation_condition.

Renamed dof_ vars as dims_ - to mean dimensions.

I think we're pretty much done!

vkrajnak commented 4 years ago

Then it might be worth throwing in an error if a momentum value is fixed. This way it produces something, but as you say, the position coordinate isn't calculated correctly. Rafa looked at some fixed-momentun slices in the past. They are a bit harder to interpret, but they still have a meaning.

I see. This might be worth pursuing later. So, please @vkrajnak open an issue for this. But, yeah, this is a limitation that all of us must be aware of.

This is a limitation we need to be open about. Raising an error is a one liner.