fig = plt.figure(figsize = (9, 9))
ax = fig.add_subplot(111, xlim = (0, 0.51), ylim = (0, 0.51))
#Remove axes and ticks.
for side in ['top', 'right']:
ax.spines[side].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
plt.plot([0, 0.5, 0.5],
[0, 0.5, 0],
c = "#99999944",
ls = ":",
lw = 4)
plt.scatter([0.25, 0.5],
[0.25, 1.5-math.sqrt(2)],
c = "k",
lw = 5,
zorder = 2)
xs = [i/2000 for i in range(1001)]
for x in xs :
#left bound.
if x <= 0.25:
x1 = x
y1 = x
#Center curve bound.
else:
x1 = x
y1 = (1-math.sqrt(x))**2
plt.plot([x1, x1],
[0, y1],
c = "#99999944",
lw = 2,
zorder = 1)
variables = [("y = x", (0.095, 0.165), 20, 'left', 'bottom'),
("(0.25, 0.25)", (0.255, 0.25), 20, 'left', 'bottom'),
("√x + √y = 1", (0.355, 0.165), 20, 'left', 'bottom'),
("(0.5, 1.5-√2)", (0.505, 1.5-math.sqrt(2)), 20, 'left', 'bottom'),
("L", (0.25, 0.05), 80, 'center', 'bottom')]
for v in variables:
plt.annotate(v[0], v[1], c = "k",
fontsize = v[2],
fontweight = "bold",
ha = v[3],
va = v[4])
fig.savefig("2023.09.08 Extra Credit.png")