2
$\begingroup$

A second sort of curve integral:

$\oint_{\Gamma}\left(y^{2}-z^{2}\right) d x+\left(z^{2}-x^{2}\right) d y+\left(x^{2}-y^{2}\right) d z$

The integral path $\Gamma$ is the cut-off line obtained by cutting the surface of the cube($\{(x, y, z) \mid 0 \leqslant x \leqslant 1,0 \leqslant y \leqslant 1,0 \leqslant z \leqslant 1\}$) with a plane ($x+y+z=\frac{3}{2}$). If you look from the forward direction of the ox axis, take the counterclockwise direction.

You can find the integration path in this 3D graph. It is the boundary of the hexagon, and the direction is counterclockwise:

Clear["Global`*"];
ContourPlot3D[{x + y + z == 3/2, x == 0, x == 1, y == 0, z == 0,
    y == 1, z == 1}, {x, #, #2}, {y, #3, #4}, {z, #5, #6}, Mesh -> 1,
   ImageSize -> 500, ViewPoint -> {5, 1, 2},
   RegionFunction ->
    Function[{x, y,
      z}, \!\(TraditionalForm\`\(-0.1\) ⩽
          x ⩽ 1.1 && \(-0.1\) ⩽
          y ⩽ 1.1 && \(-0.1\) ⩽
          z ⩽ 1.1\) && x + y + z <= 1.6],
   ContourStyle -> (Directive @@@ {{Red, [email protected]}, {Green,
        [email protected]}, {Blue, [email protected]}, {Yellow, [email protected]}, {Cyan,
        [email protected]}, {Gray, [email protected]}, {Pink, [email protected]}}),
   Lighting -> "Neutral", Axes -> True, AspectRatio -> 1,
   AxesOrigin -> {0, 0, 0}, AxesLabel -> {"x", "y", "z"},
   PlotPoints -> 50] & @@@ {{-1, 2, -1, 2, -1, 2}}

I tried to write the code of integral path, but RegionBoundary returns the original plane region as the boundary.

Clear["Global`*"];
plane = ImplicitRegion[
  x + y + z == 1.5 && 0 <= x <= 1 && 0 <= y <= 1 && 0 <= z <= 1, {x,
   y, z}];
line = RegionBoundary[plane]
ImplicitRegion[x+y+z\[Equal]1.5&&0<=x<=1&&0<=y<=1&&0<=z<=1,{x,y,z}]
$\endgroup$
1
  • 1
    $\begingroup$ 1. "it doesn't work" and "Failed" are vague, better to replace them with more specific description like "it returns unevaluated", "it returns an incorrect result", "it causes the warning....", etc. 2. I don't think ImplicitRegion is the right way to go, because even if it works, the direction needed for calculating the integral is missing. $\endgroup$
    – xzczd
    Commented Mar 12, 2022 at 3:18

2 Answers 2

3
$\begingroup$

Here's a possible work-around:

poly = Cube[1/2 {1, 1, 1}, 1] // RegionBoundary

lines = Line@poly[[1]][[#]] & /@ poly[[2]]

pts={x, y, z} /. 
    Solve @@ RegionIntersection[#, ImplicitRegion[x + y + z == 3/2, {x, y, z}]] &@
  RegionConvert[#, "Implicit"] & /@ lines // Flatten[#, 1] & // DeleteDuplicates
(* {{1/2, 1, 0}, {1, 1/2, 0}, {1, 0, 1/2}, 
    {1/2, 0, 1}, {0, 1/2, 1}, {0, 1, 1/2}} *)

At this point, the order of pts happens to be desired:

Arrow@Append[pts, pts[[1]]] // Graphics3D

Mathematica graphics

But using FindCurvePath should make the solution a bit more general:

ptsordered = pts[[First@FindCurvePath@pts]];

ListLinePlot3D@ptsordered /. Line -> Arrow

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ That's great! Thank you so much! $\endgroup$
    – lotus2019
    Commented Mar 12, 2022 at 5:23
4
$\begingroup$
poly = RegionIntersection[Hyperplane[{1, 1, 1}, {0, 0, 3/2}], Cuboid[]]

Polygon[{{1, 0, 1/2}, {1/2, 0, 1}, {0, 1/2, 1}, {0, 1, 1/2}, {1/2, 1, 0}, {1, 1/2, 0}}]

or

reg=ImplicitRegion[x+y+z==3/2&&0<=x<=1&&0<=y<=1&&0<=z<=1,{x,y,z}];
poly=MeshPrimitives[Region`Mesh`MergeCells[DiscretizeRegion[reg]],2][[1]]

Polygon[{{1., 0.5, 0.}, {1., 0., 0.5}, {0.49999999999999994, 0., 1.}, {0., 0.49999999999999994, 1.}, {0., 1., 0.5}, {0.49999999999999994, 1., 0.}}]

paraEq={Abs[t-1]+3/2 Abs[t-1/2]+3/2 Abs[t-1/3]-3/2 Abs[t-5/6]-Abs[t]/2,3/2 Abs[t-1]-3/2 Abs[t-1/2]-3/2 Abs[t-2/3]+3/2 Abs[t-1/6],-Abs[t-1]+2 Abs[t]-3/2 Abs[t-1/3]+3/2 Abs[t-2/3]-3/2 Abs[t-1/6]+3/2 Abs[t-5/6]};

paraEq2={Sqrt[3]/2  Cos[θ] Sec[1/6 ArcCos[-Cos[6 θ]]],Sqrt[3]/2  Sec[1/6 ArcCos[-Cos[6 θ]]] Sin[θ],1}.{{0,-(1/2),1/2},{-(1/Sqrt[3]),1/(2 Sqrt[3]),1/(2 Sqrt[3])},{1/2,1/2,1/2}};

Show[Graphics3D[poly],
ParametricPlot3D[paraEq,{t,0,1}],
ParametricPlot3D[paraEq2,{θ,0,2Pi}]]

enter image description here

rule=Thread[{x,y,z}->paraEq];
Integrate[Hold[D[{x,y,z},t].{y^2-z^2,z^2-x^2,x^2-y^2}]/.rule/.Abs->RealAbs//ReleaseHold,{t,1,0}]

$-\frac{9}{2}$

$\endgroup$
1
  • $\begingroup$ Wow, great! Thank you so much! $\endgroup$
    – lotus2019
    Commented Mar 13, 2022 at 1:50

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.