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 :

alt text

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

  • $\begingroup$ Calculate the area or plot the graph? $\endgroup$
    – kennytm
    Nov 3, 2010 at 6:35
  • $\begingroup$ I did the plot, from the plot, or from the function I want to calculate the area. $\endgroup$
    – Cedric H.
    Nov 3, 2010 at 7:01
  • 2
    $\begingroup$ 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? $\endgroup$
    – David Z
    Nov 3, 2010 at 7:41
  • $\begingroup$ Asking here, maybe I'll find someone using Mathematica for physics, I don't think asking in SO is a better idea. $\endgroup$
    – Cedric H.
    Nov 3, 2010 at 8:02
  • 6
    $\begingroup$ 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. $\endgroup$ Nov 3, 2010 at 10:29

1 Answer 1


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$,

alt text

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
  • $\begingroup$ 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"). $\endgroup$ Nov 12, 2010 at 2:20
  • $\begingroup$ 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. $\endgroup$
    – Cedric H.
    Nov 12, 2010 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.