示例#1
0
        static void Main(string[] args)
        {
            // A long-jumper leaves the ground at an angle of 20.0° above
            // the horizontal and at a speed of 11.0 m/s.
            // (a) How far does he jump in the horizontal direction?
            // (Assume his motion is equivalent to that of a particle.)
            // (b) What is the maximum height reached?

            // For the purposes of solving the problem, let's take
            //   point A as the initial position
            //   point B as the peak position
            //   point C as the final position.

            // First we'll get the answer in a symbolic form.

            var thA = new Symbol("thA"); // angle at point A
            var vA  = new Symbol("vA");  // velocity at point A

            var g = new Symbol("g");     // magnitude of gravity

            var _g = new Point(0, -g);   // gravity vector

            // An Obj representing the object at A:

            var objA =
                new Obj()
            {
                position     = new Point(0, 0),
                velocity     = Point.FromAngle(thA, vA),
                acceleration = _g,
                time         = 0
            };

            var objB =
                new Obj()
            {
                velocity     = new Point(objA.velocity.x, 0),
                acceleration = _g
            };

            var timeB = Calc.Time(objA, objB);
            var timeC = timeB * 2;

            objB = objA.AtTime(timeB);
            var objC = objA.AtTime(timeC);

            Console.WriteLine("How far does he jump in the horizontal direction?");
            Console.WriteLine(objC.position.x);

            Console.WriteLine();

            Console.WriteLine("What is the maximum height reached?");
            Console.WriteLine(objB.position.y);

            Console.WriteLine();

            Console.WriteLine("Now for the numerical solutions:");

            Console.WriteLine();

            Console.WriteLine("Distance jumped: ");

            Console.WriteLine(
                objC.position.x
                .Substitute(thA, Trig.ToRadians(20))
                .Substitute(g, 9.8)
                .Substitute(Trig.Pi, 3.14159)
                .Substitute(vA, 11)
                );

            Console.WriteLine();

            Console.WriteLine("Maximum height reached: ");

            Console.WriteLine(
                objB.position.y
                .Substitute(g, 9.8)
                .Substitute(thA, Trig.ToRadians(20))
                .Substitute(Trig.Pi, 3.14159)
                .Substitute(vA, 11)
                );

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            // A stone is thrown from the top of a building upward at an
            // angle of 30.0° to the horizontal and with an initial speed of
            // 20.0 m/s, as shown in Figure 4.12. If the height of the building
            // is 45.0 m, (a) how long is it before the stone hits the ground?
            // (b) What is the speed of the stone just before it strikes the
            // ground?

            var thA = new Symbol("thA"); // angle at point A
            var vA  = new Symbol("vA");  // velocity at point A

            var g = new Symbol("g");     // magnitude of gravity

            var _g = new Point(0, -g);   // gravity vector

            var objA = new Obj()
            {
                position     = new Point(0, 0),
                velocity     = Point.FromAngle(thA, vA),
                acceleration = _g,
                time         = 0
            };

            var objB = new Obj()
            {
                velocity     = new Point(objA.velocity.x, 0),
                acceleration = _g,
            };

            var timeB = Calc.Time(objA, objB);

            objB = objA.AtTime(timeB);

            var timeC = timeB * 2;

            var objC = objA.AtTime(timeC);

            var yD = new Symbol("yD");

            var objD = new Obj()
            {
                position     = new Point(null, yD),
                velocity     = new Point(objA.velocity.x, null),
                acceleration = _g
            };

            var timeAD = Calc.Time(objA, objD, 1);

            objD = objA.AtTime(timeAD);

            "How long is it before the stone hits the ground?".Disp();

            "".Disp();

            "Symbolic answer:".Disp();

            timeAD.Disp();

            "".Disp();

            "Numeric answer:".Disp();

            timeAD
            .Substitute(g, 9.8)
            .Substitute(thA, (30).ToRadians())
            .Substitute(Trig.Pi, 3.14159)
            .Substitute(vA, 20)
            .Substitute(yD, -45)
            .Disp();

            "".Disp();

            "What is the speed of the stone just before it strikes the ground?".Disp();

            "".Disp();

            "Symbolic answer:".Disp();

            objD.velocity.Norm().Disp();

            "".Disp();

            "Numeric answer:".Disp();

            objD.velocity.Norm()
            .Substitute(g, 9.8)
            .Substitute(thA, (30).ToRadians())
            .Substitute(Trig.Pi, 3.14159)
            .Substitute(vA, 20)
            .Substitute(yD, -45)
            .Disp();

            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            // In a local bar, a customer slides an empty beer mug
            // down the counter for a refill. The bartender is
            // momentarily distracted and does not see the mug, which slides
            // off the counter and strikes the floor 1.40 m from the
            // base of the counter. If the height of the counter is
            // 0.860 m, (a) with what velocity did the mug leave the
            // counter and (b) what was the direction of the mug’s
            // velocity just before it hit the floor?

            var xA  = new Symbol("xA");     // position.x at point A
            var yA  = new Symbol("yA");     // position.y at point A
            var thA = new Symbol("thA");    // angle at point A
            var vA  = new Symbol("vA");     // velocity at point A

            var xB = new Symbol("xB");

            var g  = new Symbol("g");       // magnitude of gravity
            var _g = new Point(0, -g);      // gravity vector

            Func <MathObject, MathObject> numeric = obj =>
                                                    obj
                                                    .Substitute(xA, 0)
                                                    .Substitute(xB, 1.4)
                                                    .Substitute(yA, 0.86)
                                                    .Substitute(g, 9.8)
                                                    .Substitute(Trig.Pi, 3.14159);

            var objA = new Obj()
            {
                position     = new Point(xA, yA),
                velocity     = new Point(null, 0),
                acceleration = _g,
                time         = 0
            };

            var objB = new Obj()
            {
                position     = new Point(xB, 0),
                velocity     = new Point(null, null),
                acceleration = _g
            };

            var timeB = Calc.Time(objA, objB, 1);

            objB.time = timeB;

            var _vA = Calc.InitialVelocity(objA, objB);

            objA.velocity = _vA;

            "With what velocity did the mug leave the counter?".Disp(); "".Disp();

            "symbolic:".Disp();

            "x:".Disp(); _vA.x.Disp();

            "y:".Disp(); _vA.y.Disp();

            "".Disp();

            "numeric:".Disp();

            "x:".Disp(); numeric(_vA.x).Disp();

            "y:".Disp(); numeric(_vA.y).Disp();

            "".Disp();

            "What was the direction of the mug’s velocity just before it hit the floor?".Disp(); "".Disp();

            objB = objA.AtTime(timeB);

            "symbolic:".Disp();

            objB.velocity.ToAngle().Disp(); "".Disp();

            "numeric:".Disp();

            numeric(objB.velocity.ToAngle().ToDegrees()).Disp();

            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            // One strategy in a snowball fight is to throw a first snowball at a
            // high angle over level ground. While your opponent is watching the
            // first one, you throw a second one at a low angle and timed to arrive
            // at your opponent before or at the same time as the first one. Assume
            // both snowballs are thrown with a speed of 25.0 m/s. The first one is
            // thrown at an angle of 70.0° with respect to the horizontal.
            //
            // (a) At what angle should the second (low-angle) snowball be thrown
            // if it is to land at the same point as the first?
            //
            // (b) How many seconds later should the second snowball be thrown if it
            // is to land at the same time as the first?

            var xA   = new Symbol("xA");    // position.x at point A
            var yA   = new Symbol("yA");    // position.y at point A
            var th1A = new Symbol("th1A");  // angle of snowball 1 at point A
            var vA   = new Symbol("vA");    // velocity at point A

            var g  = new Symbol("g");       // magnitude of gravity
            var _g = new Point(0, -g);      // gravity vector

            //Func<MathObject, MathObject> numeric = obj =>
            //    obj
            //        .Substitute(xA, 0)
            //        .Substitute(xB, 1.4)
            //        .Substitute(yA, 0.86)
            //        .Substitute(g, 9.8)
            //        .Substitute(Trig.Pi, 3.14159);

            var obj1A = new Obj()           // snowball 1 at initial point
            {
                position     = new Point(xA, yA),
                velocity     = Point.FromAngle(th1A, vA),
                acceleration = _g,
                time         = 0
            };

            var obj1B = new Obj()            // snowball 1 at final point
            {
                position     = new Point(null, new DoubleFloat(0.0)),
                velocity     = new Point(obj1A.velocity.x, null),
                acceleration = _g
            };

            var time1B = Calc.Time(obj1A, obj1B, 1);

            obj1B = obj1A.AtTime(time1B);

            var obj2A = new Obj()           // snowball 2 at initial point
            {
                position     = obj1A.position,
                speed        = vA,
                acceleration = _g
            };

            var obj2B = new Obj()           // snowball 2 at final point
            {
                position     = obj1B.position,
                acceleration = _g
            };

            var th2 = Calc.InitialAngle(obj2A, obj2B, 0, 0);

            ("At what angle should the second (low-angle) snowball " +
             "be thrown if it is to land at the same point as the first?").Disp();

            "".Disp();

            "symbolic:".Disp();

            th2.Disp(); "".Disp();

            "numeric:".Disp();

            th2
            .ToDegrees()
            .Substitute(yA, 0)
            .Substitute(th1A, (70).ToRadians())
            .Substitute(vA, 25)
            .Substitute(g, 9.8)
            .Substitute(Trig.Pi, Math.PI)
            .Disp();

            "".Disp();

            obj2A.velocity = Point.FromAngle(th2, vA);

            var time2B = Calc.Time(obj2A, obj2B, 1);

            ("How many seconds later should the second snowball be thrown if it " +
             "is to land at the same time as the first?").Disp();

            "".Disp();

            "symbolic:".Disp();

            (time1B - time2B).Disp(); "".Disp();

            "numeric:".Disp();

            (time1B - time2B)
            .Substitute(yA, 0.0)
            .Substitute(th1A, (70).ToRadians())
            .Substitute(vA, 25.0)
            .Substitute(Trig.Pi, 3.14159)
            .Substitute(g, 9.8)
            .Substitute(0, 0.0)
            .Disp();

            Console.ReadLine();
        }
示例#5
0
        static void Main(string[] args)
        {
            // An Alaskan rescue plane drops a package of emergency rations
            // to a stranded party of explorers, as shown in Figure
            // 4.13. If the plane is traveling horizontally at 40.0 m/s and is
            // 100 m above the ground, where does the package strike the
            // ground relative to the point at which it was released?

            var xA = new Symbol("xA");      // position.x at point A

            var yA = new Symbol("yA");      // position.y at point A

            var thA = new Symbol("thA");    // angle at point A

            var vA = new Symbol("vA");      // velocity at point A

            var g = new Symbol("g");        // magnitude of gravity

            var _g = new Point(0, -g);      // gravity vector

            var objA = new Obj()            // obj at the initial position
            {
                position     = new Point(xA, yA),
                velocity     = Point.FromAngle(thA, vA),
                acceleration = _g,
                time         = 0
            };

            var objB = new Obj()            // obj at the final position
            {
                position     = new Point(null, 0),
                velocity     = new Point(objA.velocity.x, null),
                acceleration = _g
            };

            var timeB = Calc.Time(objA, objB, 1);

            objB = objA.AtTime(timeB);

            "Where does the package strike the ground relative to the point at which it was released?".Disp(); "".Disp();

            "symbolic:".Disp();

            objB.position.x.Disp(); "".Disp();

            "numeric:".Disp();

            objB.position.x
            .Substitute(xA, 0)
            .Substitute(yA, 100)
            .Substitute(vA, 40)
            .Substitute(thA, 0.0)
            .Substitute(g, 9.8)
            .Disp();

            ("What are the horizontal and vertical components " +
             "of the velocity of the package just before it hits the ground?").Disp(); "".Disp();

            "symbolic velocity.x:".Disp();

            objB.velocity.x.Disp(); "".Disp();

            "symbolic velocity.y:".Disp();

            objB.velocity.y.Disp(); "".Disp();

            "numeric velocity.x:".Disp();

            objB.velocity.x
            .Substitute(xA, 0)
            .Substitute(yA, 100)
            .Substitute(vA, 40)
            .Substitute(thA, 0.0)
            .Substitute(g, 9.8)
            .Disp(); "".Disp();

            "numeric velocity.y:".Disp();

            objB.velocity.y
            .Substitute(xA, 0)
            .Substitute(yA, 100)
            .Substitute(vA, 40)
            .Substitute(thA, 0.0)
            .Substitute(g, 9.8)
            .Disp(); "".Disp();

            Console.ReadLine();
        }
示例#6
0
        static void Main(string[] args)
        {
            // A ski jumper leaves the ski track moving in the horizontal
            // direction with a speed of 25.0 m/s, as shown in Figure 4.14.
            // The landing incline below him falls off with a slope of 35.0°.
            // Where does he land on the incline?

            var thA = new Symbol("thA");    // angle at point A

            var vA = new Symbol("vA");      // velocity at point A

            var g = new Symbol("g");        // magnitude of gravity

            var _g = new Point(0, -g);      // gravity vector

            var th = new Symbol("th");      // angle of incline

            var objA = new Obj()
            {
                position     = new Point(0, 0),
                velocity     = Point.FromAngle(thA, vA),
                acceleration = _g,
                time         = 0
            };

            Func <MathObject, MathObject> numeric = obj =>
                                                    obj
                                                    .Substitute(vA, 25)
                                                    .Substitute(thA, 0.0)
                                                    .Substitute(th, (-35).ToRadians())
                                                    .Substitute(Trig.Pi, 3.14159)
                                                    .Substitute(g, 9.8);

            var intersection = objA.ProjectileInclineIntersection(th);

            Action nl = () => "".Disp();

            "Where does he land on the incline?".Disp(); nl();

            "x position (symbolic):".Disp();

            intersection.x.Disp(); nl();

            "y position (symbolic):".Disp();

            intersection.y.Disp(); nl();

            "x position (numeric):".Disp();

            numeric(intersection.x).Disp(); nl();

            "y position (numeric):".Disp();

            numeric(intersection.y).Disp(); nl();

            var objB = new Obj()
            {
                position     = intersection,
                acceleration = _g
            };

            "Determine how long the jumper is airborne".Disp(); nl();

            "symbolic:".Disp();

            var timeB = Calc.Time(objA, objB, 1);

            timeB.Disp(); nl();

            "numeric:".Disp();

            numeric(timeB).Disp(); nl();

            objB = objA.AtTime(timeB);

            "Determine his vertical component of velocity just before he lands".Disp();
            nl();

            "symbolic:".Disp();

            objB.velocity.y.Disp(); nl();

            "numeric:".Disp();

            numeric(objB.velocity.y).Disp();

            Console.ReadLine();
        }