Compare {xy-x^2} dx+x^2ydy over the triangle bounded lines y=0,x=1,y=x and verify by Green’s theorem.
How to solve this? Can’t find any solution.
Our vector field is
Clear[vf, x, y, reg, bnd];
vf = {x y - x^2, x^2 y};
Our region and its boundary are:
reg = Polygon[{{0, 0}, {1, 0}, {1, 1}}];
bnd = RegionBoundary[r]
(*Line[{{0, 0}, {1, 0}, {1, 1}, {0, 0}}]*)
Left hand side of Green theorem is line integral over boundary.
We need to break boundary in separate Lines, find integrals and Total:
Total[Table[
Integrate[
vf . (#2 - #1) & @@seg
, {x, y} \[Element] Line@seg]
, {seg, Partition[First@bnd, 2, 1]}]]
(*-(1/12)*)
Right hand side of Green theorem is 2D integral of Curl over region:
Integrate[Curl[vf, {x, y}], {x, y} \[Element] reg]
(*-(1/12)*)
I am confused. I tried the new SurfaceIntegrate, and found that these inputs
SurfaceIntegrate[Curl[vf, {x, y}], Element[{x, y}, reg]]
Integrate[Curl[vf, {x, y}], Element[{x, y}, reg]]
give different outputs. So what does SurfaceIntegrate do in dimension 2?
Trace shows the Integrate it computes:
Trace[
SurfaceIntegrate[Curl[vf, {x, y}], {x, y} \[Element] reg],
_Integrate
]
(* Integrate[-x + 2 x y,
{x, y} \[Element] Line[{{0, 0}, {1, 0}, {1, 1}, {0, 0}}],
GenerateConditions -> Automatic] *)
The docs say (in dimension n):
For solid (of dimension n) and bounded
RegionQobjectsR, take the surface to be the region boundary (RegionBoundary[R]) and the normal orientation to be pointed outward.
So it’s integrating the scalar field Curl[vf, {x, y}] around the boundary of the “solid” (dimension 2 region in {\Bbb R}^2)/
Embed the problem in 3D and it works fine:
SurfaceIntegrate[
Curl[vf, {x, y}] {0, 0, 1},
{x, y, z} \[Element] Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}}]]
(* -1/12 *)