0
$\begingroup$

I define a region as follows:

In[259]:= \[ScriptCapitalR] = 
  Polygon[{{0, 0}, {Re[gam2], Im[gam2]}, {gam1 + Re[gam2], 
     Im[gam2]}, {gam1, 0}}] ;
Graphics[\[ScriptCapitalR]]

According to http://reference.wolfram.com/language/ref/NIntegrate.html, I should be able to integrate over this region simply as follows:

NIntegrate[x^2 *y^2, {x, y} \[Element] \[ScriptCapitalR]]

But I keep getting this error:

NIntegrate::vars: Integration range specification {x,y}\[Element]\[ScriptCapitalR] is not of the form {x, xmin, ..., xmax}. >>

Why is that?

$\endgroup$
2
  • $\begingroup$ Using regions in NIntegrate was introduced in V10. I suspect you're using an earlier version of Mathematica. $\endgroup$
    – Michael E2
    Commented Feb 19, 2015 at 22:12
  • $\begingroup$ Oh my good, you are right! I have V9. $\endgroup$
    – ap21
    Commented Feb 20, 2015 at 8:38

1 Answer 1

1
$\begingroup$

Works for me:

gam1 = 2; gam2 = 1 - 2 I;
ℛ = Polygon[{{0, 0}, {Re[gam2], Im[gam2]}, {gam1 + Re[gam2], 
    Im[gam2]}, {gam1, 0}}];

NIntegrate[x^2*y^2, {x, y} ∈ ℛ]
(*
  18.3111
*)
$\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.