Ellipse

Turtle unfortunately doesn’t provide function to draw an ellipse. An ellipse is a curve surrounding two focal points such that the sum of the distances to the two focal points is constant for every point on the curve. Ellipse is a generalization of a circle (where two focal points at the same location). Draw a filled ellipse as shown here. You may need to use sine or cosine functions in math library to draw this shape.

Filled Ellipse with Python Turtle

Buffon’s Needle

Buffon’s needle problem is as follows: “Suppose we have a floor made of parallel strips of wood, each the same width, and we drop a needle onto the floor. What is the probability that the needle will lie across a line between two strips?” (From Wikipedia)

Simulate Buffon’s needle experiment by drawing parallel lines with constant distance 200 between them and draw needles of length 100 (half the distance between lines) randomly between the top and bottom lines. The center of the needles are uniformly distributed between top and bottom lines. The angle of the needles are uniformly distributed between 0 and 360 degrees. When a needle touch one of the lines, draw the needle in red, otherwise draw the needle in blue.

Try dropping 100, 1000, 10000, 100000 needles. Display the number of red and blue needles and the ratio between the total number of needles and the number of red needles (what does this ratio converge to?)

100 needles dropped
1000 needles dropped
10,000 needles dropped
100,000 needles dropped