5

Using Mathematica, I am trying to evaluate the integral $$I=\iint_A xy\,\mathrm{d}x\,\mathrm{d}y$$ over the region $A=\{(x,y): ax^2+2hxy+by^2\le r^2\}$ where $a>0, ab-h^2>0$.

While trying to do this by hand, I changed variables $(x,y)\to(u,v)$ to get $$I=\iint_{u^2+v^2\le r^2}\left(\frac{uv}{\sqrt{ab-h^2}}-\frac{hv^2}{ab-h^2}\right)\frac{1}{\sqrt{ab-h^2}}\,\mathrm{d}u\,\mathrm{d}v$$

Now I used this code but it doesn't work:

f[u_, v_] = (u v)/Sqrt[a b - h^2]-(h v^2)/(ab-h^2);
Integrate[f[u, v]*Boole[ u^2 + v^2 <= r^2],
{u, -r, r}, {v, -r, r}, Assumptions -> {a > 0 , ab-h^2 > 0}]

By hand, I got $\displaystyle I=-\frac{\pi r^4h}{4(ab-h^2)^{3/2}}$ and I need to check my answer.

I am aware that several of these questions have been asked here before like this one, to which I reffered. I am a novice as a user of Mathematica and I would like to know how to evaluate the likes of these integrals. I changed variables to $(u,v)$ so that I can apply a polar transformation at the end while doing this by hand. But is there a way to directly evaluate general integrals like this in Mathematica without changing variables in the first place? If you guide me to a link where this has been answered before then that would be helpful too.

Here are some other links I found but I am not sure which code to use here:

Evaluation of $ \iint x^2\ dy \ dz$ with ImplicitRegion, Evaluating a surface integral

I am using Mathematica 7.0.

user64494
  • 26,149
  • 4
  • 27
  • 56
StubbornAtom
  • 155
  • 8

2 Answers2

5

You've inconsistently put in/left out spaces, a b vs. ab. Also you need the assumption r > 0.

Integrate[((u v)/Sqrt[a b - h^2] - (h v^2)/(a b - h^2)) Boole[u^2 + v^2 <= r^2],
 {u, -r, r}, {v, -r, r}, 
 Assumptions -> {a > 0, a b - h^2 > 0, r > 0}]
(*  (h π r^4)/(4 (-a b + h^2))  *)

Using regions, which gives the answer the OP derived by hand:

Integrate[
 x y,
 {x, y} ∈ ImplicitRegion[a x^2 + 2 h x y + b y^2 <= r^2, {x, y}], 
 Assumptions -> {a > 0, a b - h^2 > 0, r > 0}]
(*  -((h π r^4)/(4 (a b - h^2)^(3/2)))  *)

Here's a way that might work in V7, but I cannot check. I relied on the form of cylindrical decomposition that Reduce returned, which in this case (of an ellipse) has a simple logical structure. (There is a way to deal with more complicated cylindrical decompositions that I've used elsewhere, but this was simpler and more easily understood.)

dom = Sequence @@ Cases[
   Reduce[
    a > 0 && a b - h^2 > 0 && r > 0 && a x^2 + 2 h x y + b y^2 < r^2,
    {x, y}, Reals],
   _[a_, ___, v : x | y, ___, b_] :> {v, a, b}, (* inequality to iterator *)
 Infinity]
(*
  Sequence[
   {x, -Sqrt[((b r^2)/(a b - h^2))], Sqrt[(b r^2)/(a b - h^2)]},
   {y, -((h x)/b) - Sqrt[(b r^2 - a b x^2 + h^2 x^2)/b^2],
     -((h x)/b) + Sqrt[(b r^2 - a b x^2 + h^2 x^2)/b^2]}
   ]
*)

Integrate[x y, dom, Assumptions -> {a > 0, a b - h^2 > 0, r > 0}]
(*  -((h π r^4)/(4 (a b - h^2)^(3/2)))  *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747
3

Another substitution-free method:

Simplify[Integrate[x y, {x, y} ∈ Ellipsoid[{0, 0}, Inverse[{{a, h}, {h, b}}/r^2]]],
         a > 0 && b > 0 && r > 0 && a b > h^2]
   -((h π r^4)/(4 (a b - h^2)^(3/2)))
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574