[code]#--------------------------------------------------#[br]# Define lists for fields, names and text[br]#--------------------------------------------------#[br]Ltxt = {"curl=<0,0,0>", "curl=<0,0,2>", "curl=<0,0,2x/(x^2+1)-2y/(y^2+1)>", "curl=<0, 0, 1/y^2-1/x^2>", "curl=<0,0,0>", "curl=<0,0,1-cos(y)>", "curl=<0,0,2>", "curl=<0,0,0>"}[br]LFx = {1.5x + 0*y, 0*x - 1.5y, 0*x + 1.5ln(1+y^2), 0*x + 1/y, -4y/(x^2+y^2)+0*y, 1.5sin(y)+ 0*x, x-y + 0*x, 1.5x + 0*y}[br]LFy = {0*x + 1.5y, 1.5x + 0*y, 1.5ln(1+x^2) + 0*y, 1/x + 0*y, 4x/(x^2+y^2)+0*x, 1.5x + 0*y, x+y + 0*y, -1.5y + 0*x}[br]Lname = {"", "<-y,x>", "", "<1/y,1/x>", "<-y/r^2,x/r^2>", "", "", ""}[br]SetCaption(Lname, "Field:=")[br]ind = SelectedIndex( Lname )[br][br]#------------------------------------#[br]# Define field components[br]#------------------------------------#[br]F1 = Element(LFx, ind)[br]F2 = Element(LFy, ind)[br][br]#-------------------#[br]# Define limits[br]#-------------------#[br]xmin = -4[br]xmax = 4[br]ymin = -4[br]ymax = 4[br][br]#-------------------#[br]# Auxiliar list[br]#-------------------#[br]LN = 1...10[br][br]#---------------------------------------------#[br]# Define random position of points[br]#---------------------------------------------#[br]Execute(Zip(" XP"+k+" = RandomUniform( xmin, xmax ) ", k, LN))[br]Execute(Zip(" YP"+k+" = RandomUniform( ymin, ymax ) ", k, LN))[br][br]#-------------------#[br]# Define points[br]#-------------------#[br]Execute(Zip(" P"+k+" = ( XP"+k+", YP"+k+" ) ", k, LN))[br]Execute(Zip(" ShowLabel( P"+k+", false ) ", k, LN))[br][br]#-------------------#[br]# Define velocity[br]#-------------------#[br]Execute(Zip(" VXP"+k+" = F1( P"+k+" ) ", k, LN))[br]Execute(Zip(" VYP"+k+" = F2( P"+k+" ) ", k, LN))[br][br]#----------------------------------#[br]# Set slider for animation[br]#----------------------------------#[br]animate = false[br]SetCaption(animate, "Run")[br]speed = 1[br]Run = Slider(-5, 5, 0.01, speed, 140, false, true, false, false)[br]SetVisibleInView(Run, 1, false)[br][br]#-----------------------------------------------#[br]# Define curl lists, values and angles[br]#-----------------------------------------------#[br]Execute(Zip(" curlList"+k+" = { 0, 2, 2*x(P"+k+")/(x(P"+k+")^2+1) - 2*y(P"+k+") /(y(P"+k+")^2+1), 1/y(P"+k+")^2 - 1/x(P"+k+")^2, 0, 1-cos(y(P"+k+")), 2, 0} ", k, LN))[br]Execute(Zip( " curlValue"+k+" = Element(curlList"+k+", ind) ", k, LN))[br]Execute(Zip( "curlAngle"+k+" = Slider(0, 2pi, 0.01, curlValue"+k+", 200, false, true, false, false)", k, LN))[br]Execute(Zip( " SetVisibleInView(curlAngle"+k+", 1, false) ", k, LN))[br][br]curlText = Element(Ltxt, ind)[br][br]#--------------------------------------------------------------#[br]# Define spokes for points to represent the curl[br]#--------------------------------------------------------------#[br]Execute(Zip(" spoke"+k+" = Sequence(Segment(Rotate(P"+k+" - (0.4, 0), j + curlAngle"+k+", P"+k+"), Rotate(P"+k+" + (0.4, 0), j + curlAngle"+k+", P"+k+")), j, 0, 2.0944, 1.0472)", k, LN))[br][br]back = Polygon((-4,-4), (4, -4), (4, 4), (-4,4))[br]#Set inverse filling for this polygon and no seleciton allowed#[br][br]#After creating the slider "Run" add these lines to the "OnUpdate" tab#[br]#Update location[br]Execute(Zip(" SetValue(XP"+k+", XP"+k+" + 0.01*VXP"+k+") ", k, LN))[br]Execute(Zip(" SetValue(YP"+k+", YP"+k+" + 0.01*VYP"+k+") ", k, LN))[br][br]#Check edges[br]Execute(Zip(" If( x(P"+k+")>=xmax, SetValue( XP"+k+", RandomUniform( xmin, xmax ) ), If( x(P"+k+")<=xmin, SetValue( XP"+k+", RandomUniform( xmin, xmax ) ) ) ) ", k, LN))[br]Execute(Zip(" If( y(P"+k+")>=ymax, SetValue( YP"+k+", RandomUniform( ymin, ymax ) ), If( y(P"+k+")<=ymin, SetValue( YP"+k+", RandomUniform( ymin, ymax ) ) ) ) ", k, LN))[br][br]#---------------------------------------------------------------#[br]# Vector field image for each example was made with this applet:[br]# https://www.geogebra.org/m/cXgNb58T[br]#---------------------------------------------------------------#[/code]