# Double integral over a parallelogram

Problem: Evaluate the following double integral

$$\int \!\!\! \int_D (14 x^2+61 xy+42 y^2)^{3} \, dxdy$$

where $D$ is a parallelogram between these four lines: $2x+7y=6$, $2x+7 y=-6$, $7x+6 y=6$ and $7x+6y=-6$.

I have defined the lines as graphs of functions $a, b, c, d$ and plotted them in Mathematica. Lines $a$ and $c$ intersect at $x=-\frac{78}{37}$ while $b$ and $d$ intersect at $x=\frac{12}{5}$ according to my calculations. Then I try to integrate the function as follows, getting the answer $-4400.1$, but it is not correct.

NIntegrate[
Boole[-(78/37) <= x <= 12/5 && Max[a[x], b[x]] <= y <= Min[c[x], d[x]]]
((14 x^2 + 61 x*y + 42 y^2)^3),
{x, -4, 4}, {y, -2, 2}]


What am I doing wrong?

-

Instead of numerical integration I recommend a symbolic approach. Since no definitions of $a, b, c, d$ functions are given it can't be resonably answered what you are doing wrong.

Factor[(14 x^2 + 61 x*y + 42 y^2)^3] /. {7 x + 6 y -> w, 2 x + 7 y -> z}

w^3 z^3


alternatively

Eliminate[{(14 x^2 + 61 x*y + 42 y^2)^3 == int, 7 x + 6 y == w, 2 x + 7 y == z}, {x, y}]

w^3 z^3 == int


Obviously the jacobian of the transformation $(x,y)$ to $(w,z)$ is not singular. Moreover we need to observe that we integrate with respect to $w$ from $-6$ to $6$ as well as with respect to $z$ from $-6$ to $6$. Integrating an antisymmetric integrand $w^3 z^3$ over a symmetric region yields neccesarily $0$. We don't need to calculate the jacobian (this trivial excercise yields $\frac{1}{37}$).

Integrate[(w z)^3, {w, -6, 6}, {z, -6, 6}]

 0


This plot illustrates the linear transformation of the variables and contours of the function.

GraphicsRow[
RegionPlot[ ##2, PlotPoints -> 60, Mesh -> 11, MeshFunctions -> #1,
ColorFunction -> "StarryNightColors"]& @@@ {
{{2 #1 + 7 #2 &, 7 #1 + 6 #2 &}, -6 < 2 x + 7 y < 6 && -6 < 7 x + 6 y < 6,
{x, -2.5, 2.5}, {y, -2.5, 2.5}},
{{#1 &, #2 &}, -6 < z < 6 && -6 < w < 6, {w, -10, 10}, {z, -10, 10}}}]


In order to ensure that our approach is correct let's calculate integral over the region where the both varables are positive i.e. {w, 0, 6}, {z, 0, 6}:

Integrate[ w^3 z^3, {w, 0, 6}, {z, 0, 6}]/37

104976/37

% == Integrate[(14 x^2 + 61 x*y + 42 y^2)^3 Boole[ 0 <= 2 x + 7 y <= 6 && 0 <= 7 x + 6 y <= 6],
{x, -6, 6}, {y, -6, 6}]

True


Alternatively we could find the integral with

Integrate[ (14 x^2 + 61 x*y + 42 y^2)^3 HeavisideTheta[2 x + 7 y, 6 - 2 x - 7 y,
7 x + 6 y, 6 - 7 x - 6 y],
{x, -∞, ∞}, {y, -∞, ∞}]


However the latter method is considerably slower.

-
Thank you! I'd vote you up if I had the reputation for it. –  Martin Svanberg Jan 27 '14 at 5:05

Update for V10

The region is handled by Integrate without user having to do any sort of special preparation.

Integrate[(14 x^2 + 61 x*y + 42 y^2)^3,
{x, y} ∈ ImplicitRegion[-6 <= 2 x + 7 y <= 6 && -6 <= 7 x + 6 y <= 6, {x, y}]]
(*  0  *)


Bounding the region by giving appropriate integration limits for x and y allows Integrate to find the integral:

Integrate[
((14 x^2 + 61 x*y + 42 y^2)^3) Boole[-6 <= 2 x + 7 y <= 6 && -6 <= 7 x + 6 y <= 6],
{x, -4, 4}, {y, -2, 2}]
(*
0
*)


Or if you can't figure out the bounding box, let Mathematica do it for you:

region = -6 <= 2 x + 7 y <= 6 && -6 <= 7 x + 6 y <= 6;
Integrate[
((14 x^2 + 61 x*y + 42 y^2)^3) Boole[region],
{x, MinValue[{x, region}, {x, y}], MaxValue[{x, region}, {x, y}]},
{y, MinValue[{y, region}, {x, y}], MaxValue[{y, region}, {x, y}]}]
(*  0  *)

-