Notebook giving examples of Line Integrals Mathematica 9 Version If you are using Mathematica 8 or earlier, you will need to load in the VectorAnalysis package. In Mathematica 9, vector analysis is part of the default kernel but the format for various expressions has changed. If you look at the help page for VectorAnalysis it has in detail what has changed. If you want to run old code (such as this notebook), you can still load in the package and Mathematica will give you a warning but will let all the old formating work. This notebook is written in Mathematica 9 format. See the other notebook for Mathematica 8 or earlier’s format. Sec. 6.8 #5 --- example of line integral Here's the vector F: ff = 8x ^ 2 y, - x y ^ 2<; field1 = VectorPlot@ff, 8x, - 1, 5<, 8y, - 1, 3<, VectorScale ® .25D 4 3 2 1 0 -1 -2 -2 0 2 4 The first path for the line integral: linea = 81, 1< + s 83, 1< 81 + 3 s, 1 + s< Slope (here constant) D@linea, sD 83, 1< 6 2 LineIntegralsMath9.nb Here's a general and compact way of doing the line integral: [email protected]@linea, sD . 8x ® linea@@1DD, y ® linea@@2DD<, 8s, 0, 1<D 86 3 This is the path that we have integrated along Show@field1, Graphics@8Red, Arrow@881, 1<, 84, 2<<D<DD 4 3 2 1 0 -1 -2 -2 0 2 4 Second path (in three segments) lineb1 = 81, y<; [email protected]@lineb1, yD . x ® 1, 8y, 1, 0<D 1 3 lineb2 = 8x, 0<; [email protected]@lineb2, xD . y ® 0, 8x, 1, 4<D 0 lineb3 = 84, y<; [email protected]@lineb3, yD . x ® 4, 8y, 0, 2<D 32 - 3 Sum leads to a different result than first path: 6 LineIntegralsMath9.nb 1 3 - 32 3 31 - 3 Show@field1, Graphics@8Red, Arrow@881, 1<, 81, 0<, 84, 0<, 84, 2<<D<DD 4 3 2 1 0 -1 -2 -2 0 2 4 6 Evaluate curl F The format of Curl in ff3d = 8x ^ 2 y, - x y ^ 2, 0<; Curl@ff3d, 8x, y, z<D 90, 0, - x2 - y2 = Since it does not vanish, work depends on path. VectorPlot3D@8x ^ 2 y, - x y ^ 2, 0<, 8x, - 10, 10<, 8y, - 10, 10<, 8z, - 10, 10<, AxesLabel ® 8x, y, z<D 3 4 LineIntegralsMath9.nb -10 x 10 0 10 y 0 10 0 z -10 -10 When you see the vector lines seem to be “swirling” in the same direction, this is a sign of having a nonzero curl. Sec. 6.10 #6 Do by brute force: vv = 8Hx ^ 3 - x ^ 2L y, Hy ^ 3 - 2 y ^ 2 + yL x, z ^ 2 - 1<; Result agrees with evaluation done in lecture notes using divergence theorem and surface integral: Integrate@Div@vv, 8x, y, z<D, 8x, 0, 1<, 8y, 0, 1<, 8z, 0, 1<D 1 LineIntegralsMath9.nb VectorPlot3D@vv, 8x, 0, 1<, 8y, 0, 1<, 8z, 0, 1<, AxesLabel ® 8x, y, z<D 1.0 y 0.5 0.0 1.0 z 0.5 0.0 0.0 0.5 x 1.0 Sec. 6.11 #18 Here's B, which is indeed divergenceless: bb = 8x ^ 2 - y z + y, x - 2 y z, z ^ 2 - 2 z x + x + y<; Div@bb, 8x, y, z<D 0 5 6 LineIntegralsMath9.nb VectorPlot3D@bb, 8x, - 10, 10<, 8y, - 10, 10<, 8z, - 10, 10<, AxesLabel ® 8x, y, z<D 10 z 0 10 -10 0 -10 y 0 x -10 10 Checking the answer found in lecture notes: aa = 80, x z ^ 2 - z x ^ 2 + x ^ 2 2 + x y, - x ^ 2 2 + 2 x y z - y ^ 2 z 2 + y ^ 2 2<; LineIntegralsMath9.nb VectorPlot3D@aa, 8x, - 10, 10<, 8y, - 10, 10<, 8z, - 10, 10<, AxesLabel ® 8x, y, z<D -10 10 x 0 y 0 10 10 -10 0 z -10 Curl@aa, 8x, y, z<D 9x2 + y - y z, x - 2 y z, x + y - 2 x z + z2 = Remember that to plot this correctly we need to use Evaluate[ ] on the Curl function, otherwise Mathematica will try to take the curl with respect to numerical values. 7 8 LineIntegralsMath9.nb VectorPlot3D@Evaluate@Curl@aa, 8x, y, z<DD, 8x, - 10, 10<, 8y, - 10, 10<, 8z, - 10, 10<, AxesLabel ® 8x, y, z<D 10 y 0 -10 10 z 0 -10 -10 0 x 10 Curl@aa, 8x, y, z<D - bb 80, 0, 0<
© Copyright 2026 Paperzz