using System; using Science.Mathematics; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter02 { /// /// Example05: Average and Instantaneous Acceleration /// The velocity of a particle moving along the x axis varies /// in time according to the expression v_x = (40 - 5t^2) m/s, /// where t is in seconds. /// (A) Find the average acceleration in the time /// interval t = 0 to t = 2.0s /// (B) Determine the acceleration at t = 2.0 s. /// public class Example05 { public Example05() { } private string result; public string Result { get{return result;} } public void Compute() { L.Time t = new L.Time(); L.Vector.FunctionOfTime VelocityTime = new L.Vector.FunctionOfTime(Func); L.Velocity v1 = new L.Velocity(); v1.VectorFunctionOfTime = VelocityTime; L.Velocity v2 = new L.Velocity(); v2.VectorFunctionOfTime = VelocityTime; //(A) t.s = 0.0; v1.Set(t); result += Convert.ToString(v1.X)+"\r\n"; t.s = 2.0; v2.Set(t); result += Convert.ToString(v2.X)+"\r\n"; t.Interval = 2.0 - 0.0; L.Acceleration abar = new L.Acceleration(v2,v1,t); result += Convert.ToString(abar.X)+"\r\n"; //(B) L.Velocity v = new L.Velocity(VelocityTime); t.s = 2.0; L.Acceleration a = new L.Acceleration(v,t); result += Convert.ToString(a.X); } private L.Vector Func(L.Time t) { L.Vector v = new L.Vector(); v.X = 40.0 - 5.0*t.s*t.s; v.Y = 0.0; v.Z = 0.0; return v; } } }