using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter02 { /// /// Example03: Average and Instantaneous Velocity /// A particle moves along the x axis. Its position varies /// with time according to the expression x = -4t +2t^2 /// where x is in meters and t is in seconds. /// The position-time graph for this motion is shown /// in Figure 2.4. Note that the particle moves in the /// negative x direction for the first second of motion, /// is momentarily at rest at the moment t = 1s, and /// moves in the positive x direction at times t > 1s. /// (A) Determine the displacement of the particle in the time /// intervals t = 0 to t = 1 s and t = 1s to t = 3 s. /// (B) Calculate the average velocity during these two /// time intervals. /// (C) Find the instantaneous velocity of the particle /// at t = 2.5 s. /// public class Example03 { public Example03() { } private string result; public string Result { get{return result;} } public void Compute() { L.Time t = new L.Time(); L.Vector.FunctionOfTime PositionTime = new L.Vector.FunctionOfTime(Func); L.Position xinitial = new L.Position(); xinitial.VectorFunctionOfTime = PositionTime; L.Position xfinal = new L.Position(); xfinal.VectorFunctionOfTime = PositionTime; L.Position x = new L.Position(); x.VectorFunctionOfTime = PositionTime; //(A) t.s = 0.0; xinitial.Set(t); result += xinitial.X.ToString()+"\r\n"; t.s = 1.0; xfinal.Set(t); result += xfinal.X.ToString()+"\r\n"; L.Displacement delta = new L.Displacement(xfinal,xinitial); result += delta.X.ToString()+"\r\n"; t.s = 1.0; xinitial.Set(t); result += xinitial.X.ToString()+"\r\n"; t.s = 3.0; xfinal.Set(t); result += xfinal.X.ToString()+"\r\n"; L.Displacement delta2 = new L.Displacement(xfinal,xinitial); result += delta2.X.ToString()+"\r\n"; //(B) t.Interval = 1.0 - 0.0; L.Velocity v1 = new L.Velocity(delta,t); result += v1.X.ToString()+"\r\n"; t.Interval = 3.0 - 1.0; L.Velocity v2 = new L.Velocity(delta2,t); result += v2.X.ToString()+"\r\n"; //(C) t.s = 2.5; L.Velocity v = new L.Velocity(x,t); result += v.ToString()+"\r\n"; } private L.Vector Func(L.Time t) { L.Vector x = new L.Vector(); x.X = -4.0*t.s+2.0*t.s*t.s; x.Y = 0.0; x.Z = 0.0; return x; } } } /* 0 -2 -2 -2 6 8 -2 4 5.99999999999994 +/- 0 i +0 +/- 0 j +0 +/- 0 k (m/s) */