# Mathematica to help for an Hamiltonian problem

I have an Hamiltonian problem whose 2D phase space exhibit islands of stability (elliptic fixed points).

I can calculate the area of these islands in some cases, but for other cases I would like to use Mathematica (or anything else) to compute it numerically.

The phase space looks like that :

This is a contour plot make with Mathematica. Could anyone with some knowledge of Mathematica provide a way to achieve this ?

• Calculate the area or plot the graph? – kennytm Nov 3 '10 at 6:35
• I did the plot, from the plot, or from the function I want to calculate the area. – Cedric H. Nov 3 '10 at 7:01
• This actually seems like a computing question that happens to arise in a physical application, not really a physics question. Or is it just me? – David Z Nov 3 '10 at 7:41
• Asking here, maybe I'll find someone using Mathematica for physics, I don't think asking in SO is a better idea. – Cedric H. Nov 3 '10 at 8:02
• I think this one is grey area, leaning towards computing rather than physics. But not voting to close because you attached a nice graph. Always like a good graph. – Alasdair Allan Nov 3 '10 at 10:29

There is rather nice function in Mathematica 7, which allows one to integrate over an arbitrary complicated region. It is Boole:[True,False]$\to${1,0}. Below is just an example taken from Mathematica Documentation Center. If you have a 2D area defined by the inequality $4 x^4-4 x^2+y^2\leq 0$,

you can integrate any function $f(x,y)$ over this domain as follows:

Integrate[f[x,y] Boole[y^2 - 4 x^2 + 4 x^4 <= 0], {x, -Infinity,Infinity},
{y, -Infinity,Infinity}]

For example, if $f(x,y)$ is unity then it gives you the total volume of the integration domain:

In[1]:= Integrate[Boole[y^2 - 4 x^2 + 4 x^4 <= 0], {x, -Infinity,Infinity},
{y, -Infinity,Infinity}]
Out[1]= 8/3

In fact, you can use any condition you want, including that is determining your islands of stability. Numerical integration is also possible:

In[1]:= NIntegrate[Boole[y^2 - 4 x^2 + 4 x^4 <= 0], {x, -Infinity,Infinity},
{y, -Infinity,Infinity}]
Out[1]= 2.66667
• By the way, Mathematica is a grate tool widely used by physicists in various areas. I think it is worth to collect questions about it here (by using the new tag "Wolfram Mathematica", not just "Mathematica"). – Grisha Kirilin Nov 12 '10 at 2:20
• Thanks, it is not exactly what I was looking for but it might do the trick. About the tags: these two can be made synonyms. – Cedric H. Nov 12 '10 at 11:37