using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter04 { /// /// Example01: Motion in a Plane /// A particle starts from the origin at t = 0 with an /// initial velocity having an x component of 20 m/s /// and a y component of -15 m/s. The particle moves in /// the xy plane with an x component of acceleration only, /// given by a_x = 4.0 m/s^2. /// (A) Determine the components of the velocity vector at /// any time and the total velocity vector at any time. /// (B) Calculate the velocity and speed of the particle /// at t = 5.0 s. /// (C) Determine the x and y coordinates of the particle at /// any time t and the position vector at this time. /// public class Example01 { public Example01() { } private string result; public string Result { get{return result;} } public void Compute() { L.Velocity vini = new L.Velocity(); vini.X = 20.0; vini.Y = -15.0; L.Vector.FunctionOfTime f = new L.Vector.FunctionOfTime(Accele); L.Acceleration a = new L.Acceleration(); a.VectorFunctionOfTime = f; //(A,B) L.Time ti = new L.Time(); ti.s = 0.0; L.Time tf = new L.Time(); tf.s = 5.0; L.Velocity v = new L.Velocity(ti,vini,a,tf); result += v.ToString() + v.Norm.ToString() + "\r\n"; //(C) L.Vector.FunctionOfTime fv = new L.Vector.FunctionOfTime(Velo); L.Velocity vfunc = new L.Velocity(); vfunc.VectorFunctionOfTime = fv; L.Position xini = new L.Position(); xini.X = 0.0; xini.Y = 0.0; L.Position x = new L.Position(ti,xini,vfunc,tf); result += x.ToString() + " " + x.Norm.ToString(); } private L.Vector Velo(L.Time t) { L.Vector res = new L.Vector(); res.X = 20.0+4.0*t.s; res.Y = -15.0; return res; } private L.Vector Accele(L.Time t) { L.Vector res = new L.Vector(); res.X = 4.0; return res; } } } /* 40 +/- 0 i -15 +/- 0 j +0 +/- 0 k (m/s)42.7200187265877 150 +/- 0 i -75 +/- 0 j +0 +/- 0 k (m) 167.705098312484 */