Untitled

1118 days ago by pub

Here we give 2 examples of 2D vector fields that are NOT the gradient field of some function.

1. $\vec F_1= \, <-y,x>$

2. $\vec F_2= \, <sin(y),cos(x)>$

Notice that both fields "show" rotation (curl). At the bottom, we show that the $curl(\vec F) \ne 0$

var ('x y') F1=vector([-y,x]) view(F1)
 \newcommand{\Bold}{\mathbf{#1}}\left(-y,\,x\right) \newcommand{\Bold}{\mathbf{#1}}\left(-y,\,x\right)
V1=plot_vector_field(F1,(x,-2,2),(y,-2,2), color='red') show(V1,aspect_ratio=1,figsize=4)  var ('x y') F2=vector([sin(y),cos(x)]) view(F2)
 \newcommand{\Bold}{\mathbf{#1}}\left(\sin\left(y\right),\,\cos\left(x\right)\right) \newcommand{\Bold}{\mathbf{#1}}\left(\sin\left(y\right),\,\cos\left(x\right)\right)
V2=plot_vector_field(F2,(x,-2*pi,2*pi),(y,-2*pi,2*pi), color='blue') show(V2,aspect_ratio=1,figsize=4)  We define the divergence and curl operators. Because we have 2D vector fields, we just set the z-component = 0 to get 3D vector fields. Credit

var ('x y z') def divergence(F): assert(len(F) == 3) return diff(F,x) + diff(F,y) + diff(F,z) def curl(F): assert(len(F) == 3) return vector([diff(F,y)-diff(F,z), diff(F,z)-diff(F,x), diff(F,x)-diff(F,y)])
F1=vector([-y,x,0]) curl(F1)
 (0, 0, 2) (0, 0, 2)
F2=vector([sin(y),cos(x),0]) curl(F2)
 (0, 0, -sin(x) - cos(y)) (0, 0, -sin(x) - cos(y))

Notice that the curl in the $\vec k$ -direction is non-zero in both cases.