Integrals over a Curve, Multidimensional Integrals

<< Calculus`VectorAnalysis`
VectorFunction  = {x y z,  x y z ,  
        y x z}
CurlVectorFunction  =  
      Simplify[Curl[VectorFunction, Cartesian[x, y, z]]]

Let's evaluate the vector potential for any  curve that wraps around a cylinder of radius R with an axis that coincides with the z-axis

Any curve that wraps around the cylinder can be parameritized as (x(t), y(t), z(t)) = (R cos(t), R sin(t), A (Subscript[P, 2  π])(t)) where (Subscript[P, 2  π])(t) = (Subscript[P, 2  π])(t + 2π) and in particular (Subscript[P, 2  π])(0) = (Subscript[P, 2  π])(2π).
Therefore d(Overscript[r,  ->]) = (-R sin(t), R cos(t), (Subscript[(P'), 2  π])(t)) dt = (-y(t), x(t), A (Subscript[(P'), 2  π])(t)) dt
The integrand for an integral of "VectorFunction" around such a curve is:

vf  = 
      VectorFunction . {-y, x,  Amp D[P[t], t]} /. {x -> 
              Radius Cos[t], y -> Radius Sin[t], z -> Amp P[t]} // 
        Simplify

The integral depends on the choice of P(t)

PathDepInt  = Integrate[vf, {t, 0,  2 Pi}]

PathDepInt /. P -> Sin

PathDepInt /. P -> Cos

PathDepInt /. {P[t] -> t (t - 2 Pi) ,  P'[t] -> 
          D[t (t - 2 Pi), t]}

However, here is  curious result: let z(t) = cos(n t),

pdigen  =  
      PathDepInt /. {P[t] -> Cos[n t],  P'[t] ->  
            D[Cos[n t], t]}

Simplify[pdigen, n ∈  Integers]

ParametricPlot3D[{{Cos[t], Sin[t],  Cos[3 t]}, {Cos[t], Sin[t],  
          Cos[ t]}}, {t, 0, 2 Pi}]

Apparently, the symmetry of the vector function causes cancelation (note results for P = Sin and P=Cos, differ by a minus sign)
But, why doesn't n=1 give us the correct result above? Note that the denominator goes to zero as n->1

Limit[pdigen, n -> 1]

Try the same thing with a conservative (curl free, or exact) Vector Function:

temp  =  Grad[Exp[x y z], Cartesian[x, y, z]]

AnotherVFunction  =  {(E^(x y z)) y z, (E^(x y z)) x z, (E^(x y z)) x y}
Simplify[Curl[AnotherVFunction, Cartesian[x, y, z]]]

anothervf  = 
      AnotherVFunction . {-y, x,  D[P[t], t]} /. {x -> 
              Radius Cos[t], y -> Radius Sin[t], z -> P[t]} // 
        Simplify

The integral depends doesn't on the choice of P(t)

PathDepInt  = Integrate[anothervf, t]

(PathDepInt /. t -> 2 Pi) -  (PathDepInt /. 
          t -> 0)

Multidimensional Integral over Irregular Domains

We will attempt to model the energy of ion just above one half of a triangular capacitor.  Suppose there is a uniformly charged surface  (σ≡charge/area=1) occupying an equilaterial triangle in the z=0 plane:
    
    what is the energy (voltage) of a unit positive charge located at (x,y,z)

The electrical potential goes like  (1/r), therefore the potential of a unit charge located at (x,y,z) from a small surface patch at (ξ,η,0) is ((σ dξ dη)/r)= \(TraditionalForm\`\(dξ\ dη\)\/\@\(\((x - ξ)\)\^\(\(2\)\(\ \)\) + \((y - η)\)\^\(\(2\)\(\ \)\) + z\^\(\(2\)\(\ \)\)\)\)

Therefore it remains to integrate this function over the domain η∈(0,((Sqrt[3])/2)) and ξ∈ ((η/(Sqrt[3])) -  (1/2)) , ((1/2) - (η/(Sqrt[3]))))  
\(TraditionalForm\`\(∫\_0\%\(\@3\/2\)\) \(∫\_\(η\/\@3 - \ 1\/2\)\%\(1\/2 - η\/\@3\)\(\(dξ\ dη\)\/\@\(\((x - ξ)\)\^\(\(2\)\(\ \)\) + \((y - η)\)\^\(\(2\)\(\ \)\) + z\^\(\(2\)\(\ \)\)\)\) dξ dη\)\)

Mathematica integrates over the last iterator first:

Integrate[f[x, y], y, x]
Integrate[f[x, y], {y, Yi, Yf}, {x, Xi,  Xf}]
Integrate[f[x, y], {y, Yi, Yf}, {x, Xi[y],  Xf[y]}]

For example,consider the difference in

Integrate[Exp[3  x], {y, 0, 1}, {x, 0, y}]
(Integrate[Exp[3  x], {x, 0, y}])
Integrate[(Integrate[Exp[3  x], {x, 0, y}]),{y, 0, 1}]

Compared to

ntegrate[Exp[3  x], {x, 0, y}, {y, 0, 1}]
(Integrate[Exp[3  x], {y, 0, 1}])
Integrate[ (Integrate[Exp[3  x], {y, 0, 1}]) ,{x, 0, y}]

We will try to find the potential dues to a triangular patch on a particle located at (x,y,z=1)

TrianglePotentialDirect  = 
      Integrate[
        (1/(Sqrt[(((x - ξ))^2) + (((y - η))^2) + (z^2)])), {η, 
          0, ((Sqrt[3])/2)}, {ξ, (η/(Sqrt[3])) -  (1/2), (1/2) - (η/(Sqrt[3])) }, 
        Assumptions -> {x ∈ Reals, y ∈  Reals, 
            z > 0}]

Trying to do this directly either takes too long or there is no closed form! We have to work around it by using Indefinite Integrals

TrianglePotentialNumeric[x_,  y_,  z_]  := 
      NIntegrate[
        (1/(Sqrt[(((x - ξ))^2) + (((y - η))^2) + (z^2)])), {η, 
          0, ((Sqrt[3])/2)}, {ξ, (η/(Sqrt[3])) -  (1/2), 
          (1/2) - (η/(Sqrt[3])) }]

TrianglePotentialNumeric[1, 3,  .01]

ContourPlot[
      TrianglePotentialNumeric[x, y, 1/20], {x, -1, 1}, {y, -0.5, 
        1.5}, Contours -> 8, 
      ColorFunction -> (Hue[1  - 0.66*#] &)]

ContourPlot[
      TrianglePotentialNumeric[x, y, 1/2], {x, -1, 1}, {y, -0.5, 
        1.5}, Contours -> 8, 
      ColorFunction -> (Hue[1 - 0.66*#] &)]