using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter04 { /// /// Example02: Approximating Projectile Motion /// A ball is thrown in such a way that its initial vertical /// and horizontal components of velocity are 40 m/s /// and 20 m/s, respectively. Estimate the total time of /// flight and the distance the ball is from its starting /// point when it lands. /// public class Example02 { public Example02() { } private string result; public string Result { get{return result;} } public void Compute() { L.Velocity v0 = new L.Velocity(); v0.X = 20.0; v0.Y = 40.0; Science.Mathematics.Calculus.PolynomialFunction v = new Science.Mathematics.Calculus.PolynomialFunction(); v.MaximumPower = 1; v.Which = 0; v.Coefficient = v0.Y; v.Which = 1; v.Coefficient = -L.Constant.AccelerationOfGravity; v.FindRoot(); double time = 2.0*v.Root[0].Real; double distance = v0.X*time; result += Convert.ToString(time); result += " and "+Convert.ToString(distance); } } }