On the 4th of January 2010 Google used in place of its logo an animation depicting an apple that falls off a tree and bounces on the ground, in order to celebrate the 366th birthday of Sir Isaac Newton. Below, we analyze the algorithm used and display two relevant plots.

The algorithm of the falling apple goes like this:

x = 248
y = 46
v_x = 0
v_y = 1
while true:
draw_apple_at(x,y)
# In one time unit the apple moves a length equals its
# velocity.
# The int here makes corresponding JavaScript code simpler.
x = int(x) + v_x
y = int(y) - v_y
if y > -210:
# If the apple is still falling apply constant
# acceleration.
v_y += 2
elif v_y > 9:
# If the apple has hit the ground with enough speed,
# inverse # a portion of the vertical speed (the other
# portion is lost # as heat due to the collision). Also,
# apply a horizontal speed.
v_x = v_y * 0.1
v_y = v_y * -0.3
else:
# If the apple hits the ground with low speed, then bring
# it to a halt.
v_x = 0
v_y = 0

A plot of vertical position and vertical speed by time is the following:

A figure of all the discrete positions occupied by the apple during its fall is the following:

### Like this:

Like Loading...

*Related*

This entry was posted on January 30, 2010 at 9:12 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

## Leave a Reply