(*^

::[paletteColors = 128; 
	fontset = title, "Palatino", 24, L2, center, bold, R16263, G10386, B11798, nohscroll;
	fontset = subtitle, "Palatino", 18, L2, center, bold, R16263, G10386, B11798, nohscroll;
	fontset = subsubtitle, "Palatino", 14, L2, center, bold, R16263, G10386, B11798, nohscroll;
	fontset = section, "Palatino", 14, L2, bold, R16263, G10386, B11798, nohscroll, grayBox;
	fontset = subsection, "Palatino", 12, L2, bold, R16263, G10386, B11798, nohscroll, blackBox;
	fontset = subsubsection, "Palatino", 12, L2, italic, B65535, nohscroll, whiteBox;
	fontset = text, "Palatino", 12, L2, italic, B65535, nohscroll;
	fontset = smalltext, "Palatino", 10, L2, B65535, nohscroll;
	fontset = input, "Courier", 14, L2, nowordwrap;
	fontset = output, "Courier", 12, L2, nowordwrap;
	fontset = message, "Courier", 12, L2, R65535, nowordwrap;
	fontset = print, "Courier", 12, L2, nowordwrap;
	fontset = info, "Geneva", 12, L2, nowordwrap;
	fontset = postscript, "Courier", 12, L2, nowordwrap;
	fontset = name, "Geneva", 10, L2, italic, B65535, nowordwrap, nohscroll;
	fontset = header, "Times", 10, L2;
	fontset = footer, "Helvetica", 10, L2, center;
	fontset = help, "Helvetica", 10, L2, nohscroll;
	fontset = clipboard, "New York", 12, L2;
	fontset = completions, "New York", 12, L2, nowordwrap;
	fontset = network, "Courier", 10, L2, nowordwrap;
	fontset = graphlabel, "Courier", 12, L2, nowordwrap;
	fontset = special1, "Courier", 10, L2, condense, nowordwrap;
	fontset = special2, "New York", 12, L2, center, nowordwrap;
	fontset = special3, "New York", 12, L2, right, nowordwrap;
	fontset = special4, "New York", 12, L2, nowordwrap;
	fontset = special5, "New York", 12, L2, nowordwrap;]
:[font = title; inactive; startGroup; ]
VectorFields
by Theodore W. Gray
modified by Sha Xin Wei 10/89 (RotationMatrix2D, fixed scaling, color fields)
7/90 ParametricSurfaceField, ParametricSurfacePotential
;[s]
3:0,0;13,1;33,3;167,-1;
4:1,27,18,Palatino,1,24,16263,10386,11798;1,16,10,Palatino,2,12,16263,10386,11798;0,15,11,Garamond,0,14,16263,10386,11798;1,13,9,Garamond,0,12,16263,10386,11798;
:[font = text; inactive; ]
     This Notebook contains definitions of functions which draw fields of vectors in two and three dimensions.  It is a very preliminary Notebook, and not intended for general distribution.  Most of the functions work fine, but they have not been tested extensively, and may contain bugs.  For examples of how to use the VectorField functions, see the Notebooks "VectorField Examples".
:[font = section; inactive; initialization; startGroup; ]
Implementation
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Remove any previous definitions for the functions defined in this file:
:[font = input; initialization; endGroup; wordwrap; ]
*)
Remove[vectorLines];
Remove[VectorField];
Remove[VectorFieldAnalytic];
Remove[vectorLines3D];
Remove[vectorLines3Dh];
Remove[VectorField3D];
Remove[VectorFieldAnalytic3D];
Remove[vectorLinesSurface];
Remove[VectorSurface];
Remove[VectorSurfaceAnalytic];
Remove[colorVectorLines];
Remove[ColorVectorField];
Remove[colorVectorLines3D];
Remove[colorVectorLines3Dh];
Remove[ColorVectorField3D];
Remove[colorVectorLinesSurface];
Remove[colorVectorSurface];
Remove[VectorSurfaceAnalytic];

(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define the usage strings for each of the functions:
:[font = input; initialization; wordwrap; ]
*)
VectorField::usage =
	"VectorField[{dfdx, dfdy}, 
	    {x, x0, x1, (xu)}, {y, y0, y1, (yu)},scaling, (options)]
	produces a vector field plot of the function whose
	derivatives are given by dfdx and dfdy. scaling scales field uniformly.";
(*
;[s]
3:0,0;205,1;212,0;239,-1;
2:2,16,11,Courier,0,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = input; initialization; wordwrap; ]
*)
ColorVectorField::usage =
	"ColorVectorField[{dfdx, dfdy}, 
	    {x, x0, x1, (xu)}, {y, y0, y1, (yu)},scaling, (options)]
	produces a color vector field plot of the function whose derivatives are given by dfdx and dfdy. scaling scales field uniformly.";
(*
;[s]
6:0,1;16,0;28,1;44,0;220,2;227,0;254,-1;
3:3,16,11,Courier,0,14,0,0,0;2,16,11,Courier,0,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = input; initialization; wordwrap; ]
*)
VectorFieldAnalytic::usage =
	"VectorFieldAnalytic[f, 
	    {x, x0, x1, (xu)}, {y, y0, y1, (yu)}, scaling, (options)]
	produces a vector field plot of the function f by
	calculating its derivatives analytically.";
(*
:[font = input; initialization; ]
*)
VectorField3D::usage =
	"VectorField3D[{dfdx, dfdy, dfdz}, 
	    {x, x0, x1, (xu)}, {y, y0, y1, (yu)}, {z, z0, z1, (zu)},scaling, (options)]
	produces a space vector field plot of the function whose 
	derivatives are given by dfdx, dfdy and dfdz. 
	scaling scales field uniformly.";
(*
;[s]
3:0,0;249,1;256,0;283,-1;
2:2,16,11,Courier,0,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = input; initialization; ]
*)
ColorVectorField3D::usage =
	"ColorVectorField3D[{dfdx, dfdy, dfdz}, 
	    {x, x0, x1, (xu)}, {y, y0, y1, (yu)}, {z, z0, z1, (zu)}, (options)]
	produces a color space vector field plot of the function whose 
	derivatives are given by dfdx, dfdy and dfdz.";
(*
:[font = input; initialization; ]
*)
VectorSurfaceAnalytic::usage =
	"VectorSurfaceAnalytic[f, 
		{x, x0, x1, (xu)}, {y, y0, y1, (yu)},scaling,options] 
	produces a color tangent field to a graph z=f(x,y) in space.";

(*
:[font = input; initialization; ]
*)
ParametricSurfaceField::usage = 
	"ParametricSurfaceField[vs_,vf_,{x_,x0_,x1_,dx_},{y_,y0_,y1_,dy_},options___]  :=
	graphs a vector field vf over a surface vs (both vector-valued functions of x,y)"
(*
:[font = input; initialization; endGroup; wordwrap; ]
*)
ParametricSurfacePotential::usage = 
		"ParametricSurfacePotential[function_,potential_,
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		options___]
		graphs a vector field, defined by a potential, over a surface"
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Begin the private part of this package, and define a few utilities:
:[font = input; initialization; wordwrap; ]
*)
Needs["Geometry`Rotations`"]
Needs["Graphics`Colors`"]
(*
:[font = input; initialization; ]
*)
FilterOptions::usage = "FilterOptions[symbol, options...] returns a sequence
	of those options that are valid options for symbol. (qv R. Maeder p.64)"

FilterOptions[ command_Symbol, opts___ ] :=
	Block[{keywords = First /@ Options[command]},
		Sequence @@ Select[ {opts}, MemberQ[keywords, First[#]]& ]
	]

(*
:[font = input; initialization; endGroup; wordwrap; ]
*)
plotpoints = PlotPoints /. Options[Plot3D]; 
rot45 = N[RotationMatrix2D[7Pi/8]];
rotm45 = N[RotationMatrix2D[-7Pi/8]];
cross3[{a1_, a2_, a3_}, {b1_, b2_, b3_}] := 
	{-(a3 b2) + a2 b3, a3 b1 - a1 b3,  -(a2 b1) + a1 b2}
mag[a_] := Sqrt[Apply[Plus, a^2]]
(*
;[s]
6:0,1;45,0;55,2;71,0;92,2;108,0;252,-1;
6:3,16,11,Courier,0,14,0,0,0;1,16,11,Courier,0,14,0,0,0;2,16,11,Courier,0,14,0,0,0;0,16,11,Courier,0,14,0,0,0;0,16,11,Courier,0,14,0,0,0;0,16,11,Courier,0,14,0,0,0;
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define vectorLines:
:[font = input; initialization; endGroup; wordwrap; ]
*)
vectorLines[point:{x_, y_}, grad:{dx_, dy_}] :=
	Block[{direction = N[grad/5],
		   endPoint = point + grad},
	{Line[{point, endPoint}],
	 Line[{endPoint +  rot45 . direction, endPoint,
	 	   endPoint + rotm45 . direction}]}
	]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define VectorField:
:[font = input; initialization; endGroup; wordwrap; ]
*)
VectorField[{dfdx_, dfdy_}, 
		{u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, 
		{v_, v0_, v1_, dv_:((v1-v0)/(plotpoints-1))},
		scaling_,
		options___] :=
	  Show[Graphics[Flatten[
		Table[vectorLines[N[{u, v}], 
				N[{dfdx, dfdy} scaling]],
				{u, u0, u1, du}, {v, v0, v1, dv}]]
	  ], options]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define colorVectorLines:
:[font = input; initialization; endGroup; wordwrap; ]
*)
colorVectorLines[point:{x_, y_}, 
				 grad:{dx_, dy_}, du_, dv_] :=
	Block[{direction = N[grad/5],
		   endPoint = point + grad},
	{HSBColor[Mod[2 (Abs[dx/du] + Abs[dy/dv]), 1], 
			  1, 1],
	 Line[{point, endPoint}],
	 Line[{endPoint +  rot45 . direction, endPoint,
	 	   endPoint + rotm45 . direction}]}
	]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define ColorVectorField:
:[font = input; initialization; endGroup; wordwrap; ]
*)
ColorVectorField[{dfdx_, dfdy_}, 
		{u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, 
		{v_, v0_, v1_, dv_:((v1-v0)/(plotpoints-1))},
		scaling_,
		options___] :=
	  Show[Graphics[Flatten[
		Table[colorVectorLines[N[{u, v}], 
				N[{dfdx, dfdy} scaling], du, dv],
				{u, u0, u1, du}, {v, v0, v1, dv}]]
	  ], options]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define VectorFieldAnalytic:
:[font = input; initialization; endGroup; wordwrap; ]
*)
VectorFieldAnalytic[function_, 
		{u_, u0_, u1_, du_:((u1-u0)/(plotpoints-1))}, 
		{v_, v0_, v1_, dv_:((v1-v0)/(plotpoints-1))},scaling_,
		options___] :=
	VectorField[{D[function, u], D[function, v]},
				{u, u0, u1, du}, {v, v0, v1, dv},scaling,
				options]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define vectorLines3D:
:[font = input; initialization; endGroup; wordwrap; ]
*)
vectorLines3D[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_}] :=
	Line[{point, point + grad}]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define vectorLines3Dh:
:[font = input; initialization; endGroup; wordwrap; ]
*)
vectorLines3Dh[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_}] :=
	Block[{endpoint, perp, perpm, offsetPoint,
		   arrowA, arrowB, arrowC, arrowD},
	  
	  endpoint = point + grad;
	  
	  perp = cross3[grad, {0,0,1}];
	  perpm = mag[perp];
	  If[perpm == 0, perp = cross3[grad, {0,1,0}];
	  				 perpm = mag[perp], ];
	  perp = perp mag[grad]/(7 perpm);
	  
	  offsetPoint = point + 4/5 grad;
	  arrowA = offsetPoint + perp;
	  
	  perp = cross3[grad, perp];
	  perp = perp mag[grad]/(7 mag[perp]);
	  arrowB = offsetPoint + perp;
	  
	  perp = cross3[grad, perp];
	  perp = perp mag[grad]/(7 mag[perp]);
	  arrowC = offsetPoint + perp;
	  
	  perp = cross3[grad, perp];
	  perp = perp mag[grad]/(7 mag[perp]);
	  arrowD = offsetPoint + perp;
	  
	  {Line[{point, endpoint}],
	   Line[{arrowA, endpoint, arrowC}],
	   Line[{arrowB, endpoint, arrowD}],
	   Line[{arrowA, arrowB, arrowC, arrowD, arrowA}]}
	]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define VectorField3D:
:[font = input; initialization; wordwrap; ]
*)
Options[VectorField3D] = {Heads->False};
(*
:[font = input; initialization; endGroup; wordwrap; ]
*)
VectorField3D[{dfdx_, dfdy_, dfdz_}, 
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		{z_, z0_, z1_, dz_:((z1-z0)/(plotpoints-1))},
		scaling_,
		options___] :=
	Block[{heads = Heads /. {options} /. 
	  							Options[VectorField3D]},
	  
	  Show[Graphics3D[
		If[TrueQ[heads],
		  Table[vectorLines3Dh[N[{x, y, z}], 
					N[{dfdx, dfdy, dfdz} scaling]],
				{x, x0, x1, dx}, {y, y0, y1, dy},
				{z, z0, z1, dz}],
		  Table[vectorLines3D[N[{x, y, z}], 
					N[{dfdx, dfdy, dfdz} scaling]],
				{x, x0, x1, dx}, {y, y0, y1, dy},
				{z, z0, z1, dz}]
		  ]
	    ](*, options*)]
	]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define colorVectorLines3D:
:[font = input; initialization; endGroup; wordwrap; ]
*)
colorVectorLines3D[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_},du_,dv_,dw_] :=
	{HSBColor[Mod[2 (Abs[dx/du] + Abs[dy/dv] + Abs[dz/dw]), 1], 1, 1], Line[{point, point + grad}]}
(*
:[font = text; inactive; startGroup; Cclosed; ]
Define colorVectorLines3Dh:
;[s]
3:0,0;26,1;27,0;28,-1;
4:2,16,10,Palatino,2,12,0,0,65535;1,16,10,Palatino,2,12,0,0,65535;0,14,10,Palatino,0,12,0,0,65535;0,18,12,Palatino,2,14,0,0,0;
:[font = input; initialization; endGroup; wordwrap; ]
*)
colorVectorLines3Dh[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_},du_,dv_,dw_] :=
	Block[{endpoint, perp, perpm, offsetPoint,
		   arrowA, arrowB, arrowC, arrowD},
	  
	  endpoint = point + grad;
	  
	  perp = cross3[grad, {0,0,1}];
	  perpm = mag[perp];
	  If[perpm == 0, perp = cross3[grad, {0,1,0}];
	  				 perpm = mag[perp], ];
	  perp = perp mag[grad]/(7 perpm);
	  
	  offsetPoint = point + 4/5 grad;
	  arrowA = offsetPoint + perp;
	  
	  perp = cross3[grad, perp];
	  perp = perp mag[grad]/(7 mag[perp]);
	  arrowB = offsetPoint + perp;
	  
	  perp = cross3[grad, perp];
	  perp = perp mag[grad]/(7 mag[perp]);
	  arrowC = offsetPoint + perp;
	  
	  perp = cross3[grad, perp];
	  perp = perp mag[grad]/(7 mag[perp]);
	  arrowD = offsetPoint + perp;
	  
	  {HSBColor[Mod[2 (Abs[dx/du] + Abs[dy/dv] + 	Abs[dz/dw]), 1], 1, 1],
			 Line[{point, endpoint}],
	   Line[{arrowA, endpoint, arrowC}],
	   Line[{arrowB, endpoint, arrowD}],
	   Line[{arrowA, arrowB, arrowC, arrowD, arrowA}]}
	]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define ColorVectorField3D:
:[font = input; initialization; wordwrap; ]
*)
Options[ColorVectorField3D] = {Heads->False};
(*
:[font = input; initialization; endGroup; wordwrap; ]
*)
ColorVectorField3D[{dfdx_, dfdy_, dfdz_}, 
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		{z_, z0_, z1_, dz_:((z1-z0)/(plotpoints-1))},
		scaling_,
		options___] :=
	Block[{heads = Heads /. {options} /. 
	  							Options[VectorField3D]},
	  
	  Show[Graphics3D[
		If[TrueQ[heads],
		  Table[colorVectorLines3Dh[N[{x, y, z}], 
					N[{dfdx, dfdy, dfdz} scaling], dx,dy,dz],
				{x, x0, x1, dx}, {y, y0, y1, dy},
				{z, z0, z1, dz}],
		  Table[colorVectorLines3D[N[{x, y, z}], 
					N[{dfdx, dfdy, dfdz} scaling], dx,dy,dz],
				{x, x0, x1, dx}, {y, y0, y1, dy},
				{z, z0, z1, dz}]
		  ]
	    ](*, options*)]
	]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define VectorFieldAnalytic3D:
:[font = input; initialization; endGroup; wordwrap; ]
*)
VectorFieldAnalytic3D[function_, 
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		{z_, z0_, z1_, dz_:((z1-z0)/(plotpoints-1))},
		options___] :=
	VectorField3D[{D[function, x], D[function, y],
				 D[function, z]},
				{x, x0, x1, dx}, {y, y0, y1, dy},
				{z, z0, z1, dz},
				options]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define vectorLinesSurface:
:[font = input; initialization; endGroup; wordwrap; ]
*)
vectorLinesSurface[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_}] :=
	Line[{point, point + grad}]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define VectorSurface:
:[font = input; initialization; endGroup; wordwrap; ]
*)
VectorSurface[{function_, dfdx_, dfdy_}, 
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		scaling_,
		options___] :=
	  Show[Graphics3D[
		Table[vectorLinesSurface[{x, y, function}, 
					{dx, dy, dx dfdx + dy dfdy} 
					scaling],
				{x, x0, x1, dx}, {y, y0, y1, dy}]
	  ], options]
(*
:[font = text; inactive; initialization; startGroup; ]
Define colorVectorLinesSurface:
:[font = input; initialization; endGroup; wordwrap; ]
*)
colorVectorLinesSurface[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_}] :=
		{HSBColor[Mod[N[(Abs[dx] + Abs[dy] + Abs[dz])], 1], 1, 1],Line[{point, point + grad}]}
(*
:[font = text; inactive; initialization; startGroup; ]
Define colorAffineVector:
:[font = input; initialization; endGroup; wordwrap; ]
*)
colorAffineVector[point:{x_, y_, z_}, 
			   grad:{dx_, dy_, dz_}, hue0_:1] :=
		{HSBColor[hue0, 1, 1],Line[{point, point + grad}]}
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define colorVectorSurface:
:[font = input; initialization; endGroup; wordwrap; ]
*)
colorVectorSurface[{function_, dfdx_, dfdy_}, 
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		scaling_,
		options___] :=
	  Show[Graphics3D[
		Table[colorVectorLinesSurface[{x, y, function}, 
					{dx, dy, dx dfdx + dy dfdy} scaling],
				{x, x0, x1, dx}, {y, y0, y1, dy}]
	  ], options]
(*
:[font = text; inactive; initialization; startGroup; Cclosed; ]
Define VectorSurfaceAnalytic: (  MODIFIED TO USE  colorVectorSurface )
:[font = input; initialization; endGroup; wordwrap; ]
*)
VectorSurfaceAnalytic[function_, 
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		scaling_,
		options___] :=
	colorVectorSurface[{function,
				 D[function, x], 
				 D[function, y]},
				{x, x0, x1, dx}, {y, y0, y1, dy},
				scaling,
				options]
(*
:[font = text; inactive; initialization; startGroup; ]
Define ParametricSurfaceField:
:[font = input; initialization; endGroup; ]
*)
Clear[ParametricSurfaceField];

ParametricSurfaceField[vs_,vf_,{x_,x0_,x1_},{y_,y0_,y1_},options___]  :=
 ParametricSurfaceField[vs,{vf,1},{x,x0,x1,(x1-x0)/10.}, 
 {y, y0,y1,(y1-y0)/10.},options]

ParametricSurfaceField[vs_,vf_,{x_,x0_,x1_,dx_},{y_,y0_,y1_,dy_},options___]  :=
 ParametricSurfaceField[vs,{vf,1},{x,x0,x1,dx}, 
 {y, y0,y1,dy},options]

ParametricSurfaceField[vs_,{vf_,hue_},{x_,x0_,x1_,dx_},{y_,y0_,y1_,dy_},options___]  :=
	 Show[
	  Graphics3D[
	  Table[colorAffineVector[vs,vf,hue],
				Release[N[{x,x0,x1,dx}]], Release[N[{y, y0,y1,dy}]]]
	  ],FilterOptions[Graphics3D,options]]
(*
:[font = text; inactive; startGroup; Cclosed; ]
Define ParametricSurfacePotential: (  needs VectorAnalysis.m )
;[s]
3:0,0;7,1;33,0;63,-1;
2:2,16,10,Palatino,2,12,0,0,65535;1,16,10,Palatino,2,12,0,0,65535;
:[font = input; ]
Needs["Calculus`VectorAnalysis`"]
:[font = input; endGroup; endGroup; endGroup; wordwrap; ]
ParametricSurfacePotential[function_,potential_,
		{x_, x0_, x1_}, 
		{y_, y0_, y1_},
		options___] := 

 ParametricSurfacePotential[
		function,potential,
		{x, x0, x1, ((x1-x0)/(plotpoints-1))}, 
		{y, y0, y1, ((y1-y0)/(plotpoints-1))},
		options
		]

ParametricSurfacePotential[function_,potential_,
		{x_, x0_, x1_, dx_:((x1-x0)/(plotpoints-1))}, 
		{y_, y0_, y1_, dy_:((y1-y0)/(plotpoints-1))},
		options___] :=
	ParametricSurfaceField[function,
				 Grad[potential],
				{x, x0, x1, dx}, {y, y0, y1, dy},
				options]
^*)