2
$\begingroup$

A question asks me to calculate the following integral using NIntegrate:

Calculate the double integral of (30x^2+37xy+10y^2)^2 over the area D bounded by the four lines 6x+5y=9, 6x+5y=-9, 5x+2y=1 and 5x+2y=-1

Calculate the double integral ... where D is the area bounded by the four lines ...

With the following code I only manage to get zero as an answer, which is wrong:

f[x_, y_] := (30*x^2 + 37*x*y + 10*y^2)^2

NIntegrate[f[x, y] Boole[6*x + 5*y == 9 && 6*x + 5*y == -9 && 5*x + 2*y == 1 && 
5*x + 2*y == -1], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]

image of code

What should I do instead?

$\endgroup$
1

1 Answer 1

3
$\begingroup$

You want the region of integration to be defined by inequalities, rather than equalities. Your region can be described as follows:

region = ImplicitRegion[Abs[6*x + 5*y] < 9 && Abs[5 x + 2 y] < 1, {x, y}]];
RegionPlot[region, AspectRatio -> Automatic]

representation of the parallelogram bounded by those four lines

With that definition, you can then write:

ClearAll[f]
f[x_, y_] := (30*x^2 + 37*x*y + 10*y^2)^2

NIntegrate[
  f[x, y],
  {x, y} ∈ region
]

(* Out: 24.9231 *)

In this case, you can also obtain a symbolic answer, just by replacing Integrate for NIntegrate above (it returns 324/13).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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