# How can I do integration with the Green theorem?

I have an integral $$\int_C xy^2dx-4x\sin y\,dy$$ where $C$ bounded with some constrains, for instance inside $x^2+y^2=1$ and below $y=x^2$.

I can integrate of one variable and also with some calculations do above integral, but I want to know how can Mathematica do it. Is it something of the form

Integrate[f[x]-g[y], {x, 0, 2 π}, {y, 0, 2 π}]


but it doesn't work, or can software do that!

How can I do this type of integrals? Thanks.

• I would rewrite it in polar coordinates... – MsTais Nov 3 '17 at 0:33
• Thanks. but I want just this form! – Nosrati Nov 3 '17 at 0:34
• From the documentation of Integrate, you can specify a region. Example from the doc: Integrate[1, {x, y, z} \[Element] Sphere[]]. – anderstood Nov 3 '17 at 0:36
• Thanks. I think this is triple integral but the question is about some weird with $x$ and $y$ variable! – Nosrati Nov 3 '17 at 0:38
• Integrate[x y^2 - 4 x Sin[y], {x, y} [Element] Circle[]]... "..weird x and y.." gives you a circle... – MsTais Nov 3 '17 at 0:40

Using Green's theorem is simplest. Here is L, M and the region:

L[x_, y_] := x y^2
M[x_, y_] := -4 x Sin[y]
region = ImplicitRegion[x^2 + y^2 < 1 && y < x^2, {x, y}];


Visualize region:

Region @ region


Perform integral:

    NIntegrate[D[M[x, y], x] - D[L[x, y], y], {x, y} ∈ region]


2.09163

Answers using the line integral approach can be compared to this answer.

Update for M9 users

In M9, one can use Boole:

NIntegrate[
(D[M[x, y], x]-D[L[x, y], y]) Boole[x^2+y^2<1 && y<x^2],
{x,-1,1},
{y,-1,1}
]


2.09163

• Thanks. I restart my software but it doesn't work (version 9.0). Is it need to execute a package (like ancient versions) for your codes? – Nosrati Nov 3 '17 at 1:47

Sorry the code line gets screwed up in comments...

Integrate[x y^2 - 4 x Sin[y], {x, y} \[Element] Circle[]]


with zero output.

Reference is here ,and here for how to define the unit circle...

Another way to express it is

Integrate[x y^2 - 4 x Sin[y], {x, y} \[Element] Circle[{0, 0}, 1]]

• How do I add the condition $y\geq x^2$.? – Nosrati Nov 3 '17 at 0:59
• condition is there. See edits, pls. – MsTais Nov 3 '17 at 1:14