using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter08 { /// /// Example11: Force and Energy on an Atomic Scale /// The potential energy associated with the force between /// two neutral atoms in a molecule can be modeled by the /// Lennard-Jones potential energy function, /// where x is the separation of the atoms. /// The function U(x) contains two parameters \sigma and \epsilon /// that determined from experiments. Sample values for the /// interaction between two atoms in a molecule are /// \sigma = 0.263 nm and \epsilon = 1.51 \times 10^{-22} J. /// (A) Using a spreadsheet or similar tool. Graph this /// function and find the most likely distance between the /// two atoms. /// x = 2.95 \times 10^{-10} m /// (B) Determine the force that one atom exerts on the /// other in the molecule as a function of separation and argue /// that the way this force behaves is physically plausible /// when the atoms are close together and far apart. /// F_x = 4\epsilon(12\sigma^12/x^13 - 6\sigma^6/x^7) /// public class Example11 { public Example11() { } private string result; public string Result { get{return result;} } private double sigma = 0.263; //*Math.Pow(10.0,-9.0); private double epsilon = 1.51; //*Math.Pow(10.0,-22.0); public void Compute() { L.Calculus.Function f = new L.Calculus.Function(fff); double[] c = new double[1]; double[] sol = L.Calculus.MinimumOfFunction(f,c,100.0); result+=Convert.ToString(sol[0])+"nm"; result+="\r\n"+Convert.ToString(sol[1])+"X10^(-22) J"; //(B) L.Scalar.FunctionOfPosition ff = new L.Scalar.FunctionOfPosition(func); L.PotentialEnergy U = new L.PotentialEnergy(); U.ScalarFunctionOfPosition = ff; L.Position x = new L.Position(); x.X = 0.295207474574121; // nm x.Y = 0.0; // nm x.Z = 0.0; // nm L.Force F = new L.Force(U,x); result+="\r\n"+F.ToString()+"X10^(-22)"; result+="\r\n"+Convert.ToString (4.0*epsilon*(12.0*Math.Pow(sigma,12.0)/Math.Pow(x.X,13.0) - 6.0*Math.Pow(sigma,6.0)/Math.Pow(x.X,7.0)))+"X10^(-22) N"; } private double fff(double[] x) { L.Position p = new L.Position(); p.X = x[0]; L.Scalar s = func(p); return s.Magnitude; } private L.Scalar func(L.Position x) { L.Scalar s = new L.Scalar(); s.Magnitude = 4.0*epsilon*(Math.Pow(sigma/x.X,12.0) -Math.Pow(sigma/x.X,6.0)); return s; } } } /* 0.295208407171185nm -1.50999999950762X10^(-22) J 5.50555982208975E-05 +/- 0 i +0 +/- 0 j +0 +/- 0 k (N)X10^(-22) 5.50555958685095E-05X10^(-22) N */