use code to draw a picture that divides a unit square into three equal parts using two inscribed parabolas, one positive and one negative, such that the vertex of the concave-up parabola is the lower left corner of the square and the vertex of the concave-down parabola is the upper right corner of the square
Here’s why the picture you see cuts the unit square into three equal-area bands:
-
Concave-up parabola
has its vertex at . -
Concave-down parabola
has its vertex at . -
Three equal regions
- Region A (bottom strip): area
. - Region B (between the two parabolas):
. - Region C (top strip):
.
- Region A (bottom strip): area
Because each region occupies
The code was as follows:
import numpy as np
import matplotlib.pyplot as plt
# x-coordinates inside the unit square
x = np.linspace(0, 1, 400)
# Two parabolas that split the square into three equal-area regions
y_up = x**2 # concave-up, vertex at (0, 0)
y_down = -x**2 + 2*x # concave-down, vertex at (1, 1)
# Draw the unit square
plt.figure()
plt.plot([0, 1], [0, 0]) # bottom
plt.plot([1, 1], [0, 1]) # right
plt.plot([1, 0], [1, 1]) # top
plt.plot([0, 0], [1, 0]) # left
# Plot the parabolas
plt.plot(x, y_up, label=r"$y = x^2$")
plt.plot(x, y_down, label=r"$y = -x^2 + 2x$")
# Formatting
plt.xlim(0, 1)
plt.ylim(0, 1)
plt.gca().set_aspect("equal", adjustable="box")
plt.title("Parabolic trisection of a unit square")
plt.legend()
plt.show()
No comments:
Post a Comment