using System; using L=Science.Physics.GeneralPhysics; namespace Serway.Chapter04 { /// /// Example05: That's Quite an Arm! /// A stone is thrown from the top of a building upward at /// an angle of 30.0^{\circle} to the horizontal with an initial speed /// of 20.0 m/s, as shown in Figure 4.14. If the height of /// the building is 45.0 m, /// (A) how long does it take the stone to reach the ground? /// (B) What is the speed of the stone just before it strikes /// the ground? /// public class Example05 { public Example05() { } private string result; public string Result { get{return result;} } public void Compute() { L.Velocity v = new L.Velocity(); v.X = 20.0*Math.Cos(30.0*Math.PI/180.0); v.Y = 20.0*Math.Sin(30.0*Math.PI/180.0); double[] coe = {45.0,v.Y, -0.5*L.Constant.AccelerationOfGravity}; L.Complex[] poly = L.Calculus.SolutionOfPolynomialEquation(coe); double time1 = poly[0].Real; double time2 = poly[1].Real; //(A) if(time2 > time1) result+=time2.ToString(); else result+=time1.ToString(); //(B) L.Velocity vv = new L.Velocity(); vv.X = v.X; vv.Y = v.Y - L.Constant.AccelerationOfGravity*time2; L.Speed sp = new L.Speed(vv); result += " " + sp.Magnitude.ToString(); } } } // 4.21804890122294 35.8050275799363