Scratch Programming: Newton's Apple - Gravity

Newton's apple

Students, you know that Apple's Newton story right?

Legend of the fall of 1665, Newton sat pondering the reasons for the movement of planets around the sun under the apple tree in his yard. At this time, an apple happened to fall, it fell on Newton's feet. This is the occasional moment, Newton discovered the cause of the apple falling - the effect of gravity.

Since then, the apple is considered a symbol of the spirit of scientific inquiry. Well, the students, we have to explore, we Scratch , how to simulate falling objects?

Like the Apple Newton discovered the truth about the whereabouts, we need to simulate the effect of gravity thereby making the process of falling out.

Newton's Apple - Gravity

For simple procedure, you can use the average rate of decline. I.e., at intervals for the Y coordinate increases a fixed value, it.

For some high demand programs, it requires the use of algorithms to perform more accurate simulations.

 

Gravity movement, generally referred to as free fall. The free fall of the knowledge of physics, the speed of the object starts from 0, will be described using the following equation:

Newton's Apple - Gravity

Where t is the time, usually in seconds; S is the displacement (or falling distance) in meters; U is the velocity in meters / second; where g is the gravitational acceleration, in m / s ^ 2 , reflecting the effects of gravity for the free fall. On a different planet, the value of the acceleration of gravity is different.

On Earth, the gravitational acceleration value of approximately 9.81 m / s ^ 2, and on the moon, the gravitational acceleration value of about 1.633 m / sec ^ 2. So on the moon, the falling speed of free fall will be much slower than on Earth.

Again we were two formulas above one o'clock in-depth explanation.

The first formula shows the rate of decline in free fall over time. That is, "speed = acceleration time *", so the object during free fall, the speed will be faster, but if a large acceleration, the speed at the same time larger.

Linear relationship between speed and time.

Newton's Apple - Gravity

The displacement versus time is a parabola, you can see the increase over time, shift changes faster and faster. In 1 second, 4.9 meters down, while in two seconds, it has dropped 19.6 meters.Newton's Apple - Gravity

In our program, how to simulate gravity of it?

Here we Scratch simulation of a small ball dropping in, to check the correctness of the algorithm.

The basic procedure is as follows, placing a ball. Write the following procedure.

Newton's Apple - Gravity

Of course, the above procedure is uniform decline, let's simulate acceleration of free fall.

Method 1: Use directly displaced formula

Newton's Apple - Gravity

The results are as follows, you can see the movement of the ball faster and faster. If the change the interval, the change in position can be such that some of the smoother. If you change the acceleration g, you can see the rate of decline will be faster or slower.

Newton's Apple - Gravity

It should be mentioned here directly as a change from the fall of the Y values, is about 1 meter as a pixel, can be seen 10 seconds down 397 m, i.e. 397 pixels.

Method 2 speed changes considered

The above method for this fall is a good time, but if it comes to simulate bounce, or consider changes in speed.

In this case the formula is actually used during each time interval [Delta] t, the speed increase g * Δt, while at the same time, the displacement substantially change Δt * u. This can be more flexible parabolic etc. simulated. For example, the following procedure can be completed in simulated pinball.

Newton's Apple - Gravity

Wherein tstep time interval, xSpeed the X direction speed operation, represents 0.95 per bounce, speed is reduced to 0.95 times the original (simulation of energy loss).

Results are as follows:

Newton's Apple - Gravity

It can be seen bouncing simulated free fall.

 

to sum up

 

 

 

in conclusion:

 

Gravity is a simulation program requires a lot of functions.

2 according to the formula in free fall, the simulation is given in free fall in SCRATCH implementation.

3 algorithm using free fall, can accurately simulate the process of falling and bouncing the process object and the like.

4     mathematics and physics simulation program is the basis, in order to better simulate the natural world, learn math and physics is necessary.

Guess you like

Origin www.cnblogs.com/scratch3/p/10935772.html