using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter23 { /// /// Example09: The Electric Field of a Uniformly Charged Disk /// A disk of radius R has a uniform surface charge density /// \sigma. Calculate the electric field at a point P that /// lies along the central perpendicular axis of the disk /// and a distance x from the center of the disk. /// E_x = 2\pi k_e \sigma ( 1 - x /(x^2 + R^2)^{1/2}) /// public class Example09 { public Example09() { } private string result; public string Result { get{return result;} } double ke = L.Constant.CoulombConstant; double sigma = 10.0; // sigma = Q / (Math.PI R^2) double R = 2.0; double x = 3.0; double y = 0.00000000001; double z = 0.00000000001; L.Position r = new L.Position(); L.Position rp = new L.Position(); public void Compute() { rp.X = x; rp.Y = y; rp.Z = z; L.Vector proj = new L.Vector(); L.Calculus.Function Ex = new L.Calculus.Function(funcx); double[] r = {0.0,0.0}; double[] rt = {R, 2.0*Math.PI}; double[] res = L.Calculus.IntegrationMultiD(Ex, r, rt); proj.X = res[0]; proj.StandardDeviationOfX = res[1]; L.Calculus.Function Ey = new L.Calculus.Function(funcy); res = L.Calculus.IntegrationMultiD(Ey, r, rt); proj.Y = res[0]; proj.StandardDeviationOfY = res[1]; L.Calculus.Function Ez = new L.Calculus.Function(funcz); res = L.Calculus.IntegrationMultiD(Ez, r, rt); proj.Z = res[0]; proj.StandardDeviationOfZ = res[1]; result+=proj.ToString()+"\r\n "; result+=Convert.ToString(2.0*Math.PI*ke*sigma *(1.0 - x /Math.Sqrt(x*x + R*R))); } private double funcx(double[] rtheta) { r.X = 0.0; r.Y = rtheta[0]*Math.Cos(rtheta[1]); r.Z = rtheta[0]*Math.Sin(rtheta[1]); L.ElectricCharge q = new L.ElectricCharge(); q.C = sigma*rtheta[0]; L.ElectricField E = new L.ElectricField(q,r,rp); return E.X; } private double funcy(double[] rtheta) { r.X = 0.0; r.Y = rtheta[0]*Math.Cos(rtheta[1]); r.Z = rtheta[0]*Math.Sin(rtheta[1]); L.ElectricCharge q = new L.ElectricCharge(); q.C = sigma*rtheta[0]; L.ElectricField E = new L.ElectricField(q,r,rp); return E.Y; } private double funcz(double[] rtheta) { r.X = 0.0; r.Y = rtheta[0]*Math.Cos(rtheta[1]); r.Z = rtheta[0]*Math.Sin(rtheta[1]); L.ElectricCharge q = new L.ElectricCharge(); q.C = sigma*rtheta[0]; L.ElectricField E = new L.ElectricField(q,r,rp); return E.Z; } } } /* 94841965772.6548 +/- 257867.405761845 i -414791.381599429 +/- 369279.737985012 j +475637.831721448 +/- 368684.532583328 k 94841413676.1735 */