Thursday, June 19, 2025

Square trisection

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 y1(x)=x2 has its vertex at (0,0).

    Area below y1=01x2,dx=13.

  • Concave-down parabola y2(x)=x2+2x has its vertex at (1,1).

    Area below y2=01(x2+2x),dx=23.

  • Three equal regions

    • Region A (bottom strip): area =13.
    • Region B (between the two parabolas): 2313=13.
    • Region C (top strip): 123=13.

Because each region occupies 13 of the square’s total area, the two parabolas achieve the desired trisection while meeting the specified vertices. The code above draws the square’s boundary and both parabolic arcs so you can verify the construction visually or adapt it further (e.g., change sampling density, export as SVG, add shading, etc.).

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