using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter30 { /// /// Example07: The Magnetic Force on a Current Segment /// Wire 1 in Figure 30.16 is oriented along the y axis and /// carries a steady current I_1. A rectangular loop located /// to the right of the wire and in the xy plane carries a /// current I_2. Find the magnetic force exerted by wire 1 on /// the top wire of length b in the loop, labeled Wire 2 in /// the figure. /// public class Example07 { public Example07() { } private string result; public string Result { get{return result;} } private double a = 1.0; private double b = 3.0; public void Compute() { L.Vector.FunctionOfPosition faa = new L.Vector.FunctionOfPosition (Bfield); L.MagneticField B = new L.MagneticField(); B.VectorFunctionOfPosition = faa; L.Line.Parameterization fa = new L.Line.Parameterization(Line); L.Line l = new L.Line(fa); l.ParameterStartValue = a; l.ParameterEndValue = b; L.ElectricCurrent I = new L.ElectricCurrent(); I.A = 10.0; L.MagneticForce F = new L.MagneticForce(I,l,B); result+=F.ToString()+"\r\n"; result+=Convert.ToString(I.A/2.0/Math.PI *Math.Log(1.0+(b-a)/a))+"\r\n"; } private L.Position Line(double t) { L.Position xyz = new L.Position(); xyz.X = t; xyz.Y = 0.0; xyz.Z = 0.0; return xyz; } private L.Vector Bfield(L.Position r) { L.Vector B = new L.Vector(); B.X = 0.0; B.Y = 0.0; B.Z = -1.0/2.0/Math.PI/r.X; return B; } } } //0 +/- 0 i -1.74849576283111 +/- 0 j +0 +/- 0 k (N) //1.7484957628303