Line Integrals
Another way of writing this is if f={f1,f2,f3} (or f1 i + f2 j +f3 k), and if we write x'(t)dt as dx, y'(t)dt as dy and z'(t)dt as dz, then we can write Integal of f(r).dr as
Integral of f1dx + f2dy + f3dz.
Let's try f(x,y)=2xy i+x^3 j on an upper semicircular path with radius 1.
f[x_,y_]:={2 x y,x^3}
r[t_]:={Cos[t],Sin[t]}
D[r[t],t]
arc=ParametricPlot[r[t],{t,0,Pi},AspectRatio->Automatic]
f[r[t][[1]],r[t][[2]]].D[r[t],t]
Integrate[f[r[t][[1]],r[t][[2]]].D[r[t],t],{t,0,Pi}]It should be clear that if you follow the curve backwards, the integral is the negative of the integral following the curve forwards.
Integrate[f[r[t][[1]],r[t][[2]]].D[r[t],t],{t,Pi,0}]If your curve is made up of two or more curves pieced together, simply do each piece separately and add them up. Let's try the semicircle along with the "bottom line".
r2[t_]:={t,0}
bottomline=ParametricPlot[r2[t],{t,-1,1},
PlotStyle->{RGBColor[1,0,0]}]
Show[arc,bottomline]
Be careful. When integrating around this curve, we follow the semicircle counterclockwise (t from 0 to Pi) and the bottom line from -1 to 1.
f[r2[t][[1]],r2[t][[2]]].D[r2[t],t]
Well, that certainly makes life easy. The line integral along r2 contributes nothing, so the line integral around arc+bottomline is the same as the line integral around arc.
This works the same way in three dimensions.