Integration Techniques in Geometry

Lusine Sukiasyan, Wolfram Research

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

Integration

Area of an arbitrary shape

reg=ImplicitRegion[1<x^2-y^2<4&&x y<1&&x>0&&y>0,{x,y}];

RegionPlot[reg,Frame->None]

(∫_({x,y}∈reg))1.

Area between curves

f[x_]:=3 x^2+4;
g[x_]:=4 x+1;

Plot[{f[x],g[x]},{x,1,5},Sequence[Filling->{1->{2}},PlotLegends->"Expressions"],Axes->None]

(∫_1^5)(f[x]-g[x])\[DifferentialD]x

Length of a curve

reg=ParametricRegion[{t Cos[t], t Sin[t]},{{t,0,7}}];

ParametricPlot[{t Cos[t], t Sin[t]},{t,0,7},Frame->False,Axes->False]

(∫_({x,y}∈reg))1

N[%]

Volume of a solid

Revolve y=(x^2) around the line y=1:

f[x_]:=x^2;

RevolutionPlot3D[f[x]-1,{x,-1,1},RevolutionAxis->{1,0,0},Boxed->False,Axes->False]

(∫_(-1)^1)(π (1-f[x])^2)\[DifferentialD]x

N[%]

Integrate Function in the Wolfram Language

Integrate[f,x] - ∫fdx

Integrate[Cos[x],x]

Integrate[f,{x,(Subscript[x, min]),(Subscript[x, max])}] - (∫_(Subscript[x, min])^(Subscript[x, max ]))fdx

Integrate[x^4+x^2+1,{x,1,3}]

Integrate[f,{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},...] - (∫_(Subscript[x, min])^(Subscript[x, max]))dx(∫_(Subscript[y, min])^(Subscript[y, max]))dy...f

Integrate[x^2 /(x+y),{x,0,3},{y,1,2}]

Integrate[f,{x,y,...}∈reg]

Integrate[x^2+y,{x,y}∈Disk[]]

Integration over Regions

1D

reg=Interval[{1,5}];
(∫_({x}∈reg))(3x^2+6)

2D

reg=Triangle[];
(∫_({x,y}∈reg))(Sin[x]*y)

3D

reg=Tetrahedron[];
(∫_({x,y,z}∈reg))(4x^4+5x*y*z)

nD

reg=Ellipsoid[{0,0,0,0,0},{1,2,9,6,5}];
(∫_(x∈reg))1

Formula regions

reg=ImplicitRegion[x+2 y+3 z<2&&-1<x<y<z<1,{x,y,z}];
(∫_({x,y,z}∈reg))((x^2)+2y z)

reg=ParametricRegion[{t-Sin[t],1-Cos[t]},{{t,0,2 Pi}}];
(∫_({x,y}∈reg))(x+y)

Integration over Regions in Math Terms

Line integrals

circle=Circle[];
line=Line[{{0,0,0},{1,1,1}}];

(∫_({x,y}∈circle))(3x^2+y)

(∫_({x,y,z}∈line))1

Surface integrals

sphere=Sphere[];

(∫_({x,y,z}∈sphere))(x^2+y*z)

Multiple integrals

2 - dimensional regions (double integrals)

Rectangle, Triangle, Polygon, ....

disk=Disk[];

(∫_({x,y}∈disk))(Cos[3 x]^2 Sin[5 y]+1)

3 - dimensional solids (triple integrals)

Cone, Tetrahedron, Ball, ....

tetrahedron=Tetrahedron[];

(∫_({x,y,z}∈tetrahedron))(x^2+y*z)

n - dimensional regions (multiple integrals)

Ball, Simplex, Cuboid, ...

ball=Ball[{0,0,0,0,0},1];

(∫_(x∈ball))(Indexed[x,1]^2*Indexed[x,2])

Improper integrals

halfline=HalfLine[{1,2},{8,8}];

(∫_({x,y}∈halfline))(1/(x+1)^2)

Integration by Substitution

Integrate[x^2+y,{x,y}∈Disk[]]

Integrate[x^3Cos[y]^2+x^2 Sin[y],{x,0,1},{y,0,2Pi}]

Integrate function f((Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),..., (Subscript[x, n])) over a region reg:

({{({{(Subscript[x, 1])=(Subscript[g, 1])((Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),..., (Subscript[u, m]))}})}})

({{({{({{(Subscript[x, 2])=(Subscript[g, 2])((Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),...,  (Subscript[u, m]))}})}})}})

({{({{...}})}})

({{({{({{(Subscript[x, n])=(Subscript[g, n])((Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),...,  (Subscript[u, m]))}})}})}})

where (Subscript[a, 1])≤(Subscript[u, 1])≤(Subscript[b, 1]),(Subscript[a, 2])≤(Subscript[u, 2])≤(Subscript[b, 2]), ... , (Subscript[a, m])≤(Subscript[u, m])≤(Subscript[b, m]) .

({{({{(Subscript[x, 1])->(Subscript[g, 1])((Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),..., (Subscript[u, m]))}})}})

({{({{({{(Subscript[x, 2])->(Subscript[g, 2])((Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),...,  (Subscript[u, m]))}})}})}})

({{({{...}})}})

({{({{({{(Subscript[x, n])->(Subscript[g, n])((Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),...,  (Subscript[u, m]))}})}})}})

({{ (∫_(x∈reg))fdx=(∫_(Subscript[a, 1])^(Subscript[b, 1]))d(Subscript[u, 1])(∫_(Subscript[a, 2])^(Subscript[b, 2]))d(Subscript[u, 2])...(k*f(g(u))), }})

where k is

|Det((Subscript[J, x]))|, when m=n (multiple integral).

(Sqrt[((((Subscript[g, 1])'(u)))^2)+((((Subscript[g, 2])'(u)))^2)+...+((((Subscript[g, n])'(u)))^2)]), when m=1 (line integral).

‖((∂(Subscript[g, i]))/(∂(Subscript[u, 1])))×((∂(Subscript[g, i]))/(∂(Subscript[u, 2])))×...×((∂(Subscript[g, i]))/(∂(Subscript[u, m])))‖, when m<n (surface integrals).

Integration by Substitution Example

Integrate[x^2+y,{x,y}∈Disk[]]

f=x^2+y;
reg=Disk[];

RegionConvert[reg,"Parametric"]

func=f/. Thread[{x,y}->{Cos[s]*t,Sin[s]*t}]

J=ResourceFunction["JacobianMatrix"][{Cos[s]*t,Sin[s]*t},{s,t}]//MatrixForm

ResourceFunction["JacobianDeterminant"][{Cos[s]*t,Sin[s]*t},{s,t}]//FullSimplify

Integrate[Abs[-t]*func,{s,0,2Pi},{t,0,1}]

Polynomial Function

Suppose the integrable function f is a polynomial.

f=10x^4+5x^2y^8+x*y+6y^7;
vars={x,y,z};
p={0,0,0};rad=1;
reg=Ball[p,rad];

cr=CoefficientRules[f/. Thread[vars->(vars+p)],vars]

If[Or@@(OddQ/@#[[1]]),0,((2*#[[2]]*rad^(Total[#[[1]]]+3))/(Total[#[[1]]]+3))*(Product[Gamma[(1+#[[1,i]])/2],{i,3}]/Gamma[Sum[(1+#[[1,i]])/2,{i,3}]])]&/@cr

Plus@@%

Integrate[f,vars ∈reg]

Unique Approach

Integrate[(1/((((x-(Subscript[x, 0])))^2)+(((y-(Subscript[y, 0])))^2)+(((z-(Subscript[z, 0])))^2))),{x,y,z} ∈Ball[]]

NIntegrate[(1/((((x-(Subscript[x, 0])))^2)+(((y-(Subscript[y, 0])))^2)+(((z-(Subscript[z, 0])))^2))),{x,y,z} ∈Ball[]]/.{(Subscript[x, 0])->1,(Subscript[y, 0])->2,(Subscript[z, 0])->2}

Integrating a Function over Disk

Integrate[(1/(Sqrt[(((x-(Subscript[x, 0])))^2)+(((y-(Subscript[y, 0])))^2)])),{x,y} ∈Disk[]]

NIntegrate[(1/(Sqrt[(((x-(Subscript[x, 0])))^2)+(((y-(Subscript[y, 0])))^2)])),{x,y} ∈Disk[]]/.{(Subscript[x, 0])->3,(Subscript[y, 0])->4}

d=(Sqrt[((Subscript[x, 0])^2)+((Subscript[y, 0])^2)]), k =((4*d)/(((d+1))^2))

({{2*(d+1)*E((π/2),k)-2*(d-1)*F((π/2),k)}})

d = 1 ⇒ k = 1

EllipticE[Pi/2,1]

EllipticF[Pi/2,1]

Limit[2*(a+1)*EllipticE[Pi/2,a]-(a-1)EllipticF[Pi/2,a],a->1]

Integrating a Function over Disk

Integrate[(1/(Sqrt[(((x-(Subscript[x, 0])))^2)+(((y-(Subscript[y, 0])))^2)])),{x,y} ∈Disk[{a,b},r]]

d=(Sqrt[(((a-(Subscript[x, 0])))^2)+(b-((Subscript[y, 0])^2))]), k =((4*(d/r))/((((d/r)+1))^2))

({{2*r*((d/r)+1)*E((π/2),k)-2*r*((d/r)-1)*F((π/2),k)}})

d = r ⇒ k = 1

({{4*r}})

Precision and Speed

Precision

Integrate[(1/(Sqrt[(((x-2))^2)+(((y-5))^2)])),{x,y} ∈Disk[{1,3},10]]

N[%]

NIntegrate[(1/(Sqrt[(((x-2))^2)+(((y-5))^2)])),{x,y} ∈Disk[{1,3},10]]

Speed

First@RepeatedTiming@Integrate[(1/(Sqrt[(((x-2))^2)+(((y-5))^2)])),{x,y} ∈Disk[{1,3},10]]

First@RepeatedTiming@NIntegrate[(1/(Sqrt[(((x-2))^2)+(((y-5))^2)])),{x,y} ∈Disk[{1,3},10]]

Integrating a Function over Ball

Integrate[(1/((((x-(Subscript[x, 0])))^2)+(((y-(Subscript[y, 0])))^2)+(((z-(Subscript[z, 0])))^2))),{x,y,z} ∈Ball[{a,b,c},r]]

d=(Sqrt[(((a-(Subscript[x, 0])))^2)+(((b-(Subscript[y, 0])))^2)+(((c-(Subscript[z, 0])))^2)])

({{2*π*r*(1-(((d^2)-(r^2))/(2*d*r)) log (|((d+r)/(d-r))|))}})

d = 0

({{4*π*r}})

d = r

({{2*π*r}})

Precision and Speed

Precision

Integrate[(1/((((x-1))^2)+(((y-3))^2)+(((z+8))^2))),{x,y,z} ∈Ball[{1,1,1},2]]

N[%]

NIntegrate[(1/((((x-1))^2)+(((y-3))^2)+(((z+8))^2))),{x,y,z} ∈Ball[{1,1,1},2]]

Speed

First@RepeatedTiming@Integrate[(1/((((x-1))^2)+(((y-3))^2)+(((z+8))^2))),{x,y,z} ∈Ball[{1,1,1},2]]

First@RepeatedTiming@NIntegrate[(1/((((x-1))^2)+(((y-3))^2)+(((z+8))^2))),{x,y,z} ∈Ball[{1,1,1},2]]