(* ::Package:: *)

(*efield.m*)

(*Calculation of electric field from potenital*)
For[i=iini+1,i<=ilast-1,i++,
	For[j=jini+1,j<=jlast-1,j++,
		For[k=kini+1,k<=klast-1,k++,
		Ex[i,j,k]=-(V[i+1,j,k]-V[i-1,j,k])/(2*Deltax);
		Ey[i,j,k]=-(V[i,j+1,k]-V[i,j-1,k])/(2*Deltax);
		Ez[i,j,k]=-(V[i,j,k+1]-V[i,j,k-1])/(2*Deltax);
		];
	];
];

tE=Table[
{Ex[i,j,k],Ey[i,j,k],Ez[i,j,k]},{i,iini+1,ilast-1},{j,jini+1,jlast-1},{k,kini+1,klast-1}];

tEz=Table[
{Ex[i,j,kprime],Ey[i,j,kprime]},{i,iini+1,ilast-1},{j,jini+1,jlast-1}];
Print["ListVectorPlot[tEz] of Electric Field"];
Print[ListVectorPlot[tEz]];

Print["ListStreamPlot[tEz] of Electric Field"];
Print[ListStreamPlot[tEz]];

Print["ListStreamDensityPlot[tEz] of Electric Field"];
Print[ListStreamDensityPlot[tEz]];

Print["ListVectorPlot3D[tE]"];
Print[ListVectorPlot3D[tE]];


