Vector Fields and Line Integrals

:

:

End

Start

set field

Curl Point

Div Point

Field

Path

(drag slider for partial path)

Path Vectors

gList: {(0 * x) + y, x + (0 * y), x + (0 * y), x + y, (0 * x) + y^(2), 1 / x + (0 * y), sin(x) + (0 * x), x + (0 * y), y^(2) + (0 * x), log(1 + x^(2)) + (0 * y)}
fieldNames: {"< x, y >", "< y, x >", "< -y, x >", "< x-y, x+y >", "< x, y² >", "< 1/y, 1/x >", "< cos(x), sin(x) >", "< sin(y), x >", "< 2xy, y² >", "< ln(1+ y²), ln(1+x²) >"}
fieldIndex = SelectedIndex(fieldNames)
fList: {x + (0 * y), y + (0 * x), (0 * x) - y, x - y, x + (0 * y), (0 * x) + 1 / y, cos(x) + (0 * y), sin(y) + (0 * x), ((2 * x) * y), log(1 + y^(2)) + (0 * x)}
pathNames: {"Line Segment", "Right Semicircle", "Left Semicircle", "Spiral", "Ellipse"}
divPt = (2, 2)
divList: {2, 0, 0, 2, 1 + (2 * y(divPt)), 0, (-sin(x(divPt))) + cos(y(divPt)), 0, (4 * x(divPt)), 0}
yRadius = 1.4
xRadius = 2
B = (-2, -1)
A = (1, 1)
M = Midpoint(A, B)
α: Angle[Line[A, B], xAxis] - π / 2
pathList: {CurveCartesian[(t * x(B)) + ((1 - t) * x(A)), (t * y(B)) + ((1 - t) * y(A)), t, 0, 1], CurveCartesian[((0.5 * Distance[A, B]) * sin((π * t) + α)) + x(M), ((0.5 * Distance[A, B]) * cos((π * t) + α)) + y(M), t, 0, 1], CurveCartesian[((0.5 * Distance[A, B]) * sin(((-π) * t) + α)) + x(M), ((0.5 * Distance[A, B]) * cos(((-π) * t) + α)) + y(M), t, 0, 1], CurveCartesian[((Distance[A, B] * t) * sin(((3 * π) * t) + α)) + x(A), ((Distance[A, B] * t) * cos(((3 * π) * t) + α)) + y(A), t, 0, 1], CurveCartesian[(xRadius * cos(((2 * π) * t))) + x(A) - xRadius, (yRadius * sin(((2 * π) * t))) + y(A), t, 0, 1]}
grid = 12 (slider from 3 to 20, step 1)
scale = 0.1 (slider from 0 to 1, step 0.1)
xmax: x(Corner[3])
xmin: x(Corner[1])
ymin: y(Corner[1])
ymax: y(Corner[3])
xstep: (xmax - xmin) / (grid + 1)
ystep: (ymax - ymin) / (grid + 1)
s = 1 (slider from 0 to 1, step 0.1)
dS = 0.005 (slider from -5 to 5, step 0.1)
curlPt = (-0.242096800146603, 0.37189114150771674)
curlAngle = 1.43989659 (slider from 0 to 6.283185307179586, step 0.13089969)
spokes = Sequence(Segment[Rotate[curlPt - (0.25, 0), k + curlAngle, curlPt], Rotate[curlPt + (0.25, 0), k + curlAngle, curlPt]], k, 0, 2.0943951024, 1.0471975512)
curlList: {0, 0, 2, 2, 0, (-x(curlPt)^(-2)) + y(curlPt)^(-2), 0, 1 - cos(y(curlPt)), (-2 * x(curlPt)), (2 * x(curlPt) / (1 + x(curlPt)^(2))) - (2 * y(curlPt) / (1 + y(curlPt)^(2)))}
curl = Element(curlList, fieldIndex)
div = Element(divList, fieldIndex)
curlText: "|curl| = " + curl + ""
divText: "div = " + div + ""
divGlowCircle = Circle(divPt, 0.2)
g = Element(gList, fieldIndex)
f = Element(fList, fieldIndex)
vField = Sequence(Sequence[Vector[(j, k), (j + (scale * f(j, k)), k + (scale * g(j, k)))], j, xmin, xmax, xstep], k, ymin, ymax, ystep)
pathIndex = SelectedIndex(pathNames)
path = Element(pathList, pathIndex)
partPath = CurveCartesian(x(path(t)), y(path(t)), t, 0, s)
pathPt: path(s)
work = Sum(Sequence[((path(i + dS) - path(i)) * (f(x(path(i + dS / 2)), y(path(i + dS / 2))), g(x(path(i + dS / 2)), y(path(i + dS / 2))))), i, 0, s - dS, dS])
workText: "work = " + work + ""
showCurl = true
showDiv = true
showField = true
showPath = false
pathVectors = Sequence(Vector[path(s), path(s) + ((scale * f(x(path(s)), y(path(s)))), (scale * g(x(path(s)), y(path(s)))))], s, 0, 1, 0.1)
showPathVectors = false
arrow1 = Segment(path(0.2), path(0.21))
arrow2 = Segment(path(0.5), path(0.51))
arrow3 = Segment(path(0.8), path(0.81))