Message Boards Message Boards

Plot the Poincare surface of section for the Henon-Heiles System?

GROUPS:

Hi, first to mention I´m an absolute beginner with Mathematica...

My problem is now, that I have to plot the Poincare Surface of Section for the Henon-Heiles System as an exercise in Nonlinear Physics/Chaos. I´m absolutely new to numerics, so I started the Mathematica trial to get into it. Now I´m at this point

abc = {x''[t] + x[t] + 2*x[t]*y[t] == 0,  y''[t] + y[t] + y[t]^2 + x[t]^2 == 0}; 

to define my differential equations

psect[{x0_, y0_, a0_, b0_}] := 
 Reap[NDSolve[{abc, x[0] == x0, y[0] == y0, x '[0] == a0, y'[0] == b0,
      WhenEvent[x[t] == 0, Sow[y[t]]]}, {}, {t, 0, 1000}, 
    MaxSteps -> \[Infinity]]][[-1, 1]]    

here is the critical point ... because if i want to apply the following

abcdata = Map[psect, {
{0, 0.9952906114885919, 1, 1}, {0, 2.1257099470901704, 1, 1}, 
{0, 4.939152797323216, 1, 1}, {0, 4.926744120488727, 1, 1}, 
{0, 1.7074633238173198, 1, 1}, {0, 4.170087631574883, 1, 1}, 
{0, 2.3736566160602277, 1, 1}, {0, 1.4987884558838156, 1, 1}, 
{0, 1.3745418575363608, 1, 1}, {0, 1.3039536044289253, 1, 1}, 
{0, 2.289597511313432, 1, 1}, {0, 4.306922133429981, 1, 1},
 {0, 5.000045498132029, 1, 1}}];

ListPlot[abcdata, ImageSize -> Medium]

i alwas get the Problem that there are only 3 initial conditions, while 4 are needed... but this is something weird, since I can´t find what´s wrong in my system... maybe everything, maybe a small thing. Those are the problems that occur:

NDSolve::ndnco: The number of constraints (3) (initial conditions) is not equal to the total differential order of the system plus the number of discrete variables (4)., Part::partw: Part 1 of {} does not exist., General::stop: Further output of NDSolve::ndnco will be suppressed during this calculation., General::stop: Further output of Part::partw will be suppressed during this calculation.

I´ve almost lost hope... since I´m not able to learn all that general stuff in few days I used http://reference.wolfram.com/language/example/PoincareSections.html as reference and tried to put it into my system... so far it didn´t work. I would be really thankful if anyone has any kind of idea...

Attachments:
POSTED BY: Dominik Vierl
Answer
2 months ago

The NDSolve runs, although some of the initial conditions lead to solutions that seem to go off to infinity. Try quitting the kernel and re-executing your code. Possibly one of your variables has accidentally been defined (e.g., using = instead of == earlier in your session).

POSTED BY: Michael Rogers
Answer
2 months ago

Thank you, the number of problems did significantly reduce ^^

Althought one is remaining... Part::partw: Part 1 of {} does not exist.

POSTED BY: Dominik Vierl
Answer
2 months ago

The problem with the Part error is because for those ICs, the orbit goes off to infinity and does not return. The {} is returned from Reap[...] because no points were Sow-ed (or sown in the English Language as opposed to the Wolfram Language :).

POSTED BY: Michael Rogers
Answer
2 months ago

Thanks a lot. The system finally works now :)

POSTED BY: Dominik Vierl
Answer
2 months ago

It is a courtesy to post your working code, when someone has helped you, so other can make use of it in future.

POSTED BY: Moderation Team
Answer
2 months ago

Group Abstract Group Abstract