In version 10, Mathematica introduces some Region functions, which allow us to do integrals very visually. We can do this even if we don't know any Mathematica syntax and it can help me show others that don't use this software. I can do any integral use these two steps:
Plot the function, show the region to integral
ContourPlot[{E^x == y, y == 2, x == 0}, {x, -3, 3}, {y, -3, 3}, PlotLegends -> "Expressions"]
Make an
ImplicitRegionto integral and do calculationregion = ImplicitRegion[Reduce[{y > E^x, x > 0, y < 2}], {x, y}]; NIntegrate[E^(x y)/(y^y - 1), Element[{x, y}, region]]
Additionally, we can do it in textbook form directly like:
This is very intuitive to show.
Question
How can we use this region feature do line integrals? Such as the vector field is {y, x}. The region is RegionUnion[Circle[{0,0},1,{0,45°}],Line[{{0,0},{1,0}}]] The move direction is from $O\to A\to B$ as follows:
Show[VectorPlot[{y, x}, {x, -1, 1}, {y, -1, 1}], Graphics[{Thick, Circle[{0, 0}, 1, {0, 45°}], Arrow[{{0, 0}, {1, 0}}], Style[Text["A", {.9, -.1}], 20, Red], Style[Text["B", {Sqrt[2]/2, .8}], 20, Red]}], AxesOrigin -> {0, 0}, Axes -> True, Frame -> False, Ticks -> None]
As I know, the result is $\frac{1}{2}$.
Or caculate the line integral in a close path, region is RegionUnion[Circle[{0,0},1,{0,45°}],Line[{{0,0},{1,0}}],Line[{{Sqrt[2]/2,Sqrt[2]/2},{0,0}}]],its direction is from $O\to A\to B\to O$:
Show[VectorPlot[{y, x}, {x, -1, 1}, {y, -1, 1}], Graphics[{Thick, Circle[{0, 0}, 1, {0, 45 °}], Arrow[{{0, 0}, {1, 0}}], Arrow[{{Sqrt[2]/2, Sqrt[2]/2}, {0, 0}}], Style[Text["A", {.9, -.1}], 20, Red], Style[Text["B", {Sqrt[2]/2, .8}], 20, Red]}], AxesOrigin -> {0, 0}, Axes -> True, Frame -> False, Ticks -> None]
As I know, the result is $0$. Of course, this vector field {y,x} is very simple so that you can see the result just by a glance, but this is just an example. I want know the general method.


*Region*functions mean different things to me, but one obstacle to the latter is that regions are not oriented. E.g., the mesh elements inDiscretizeRegion[RegionUnion[Circle[{0, 0}, 1, {0, Pi/4}], Line[{{1, 0}, {2, 0}}]]]do not have a consistent orientation. A solution will have to address orientation, as well as calculating tangents for the variety of possible regions and, if desired, recursive refinement of the mesh for whatever integration rules one wants. Not to mention singularity handling or other features ofNIntegrate. A very big project. $\endgroup$