Google’s bouncing apple for Newton anniversary

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:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: