import matplotlib.pyplot as plt
# 定义计算乒乓球弹起高度的函数
def calculate_bounce_height(diameter, release_height):
return release_height * (diameter / 10) ** 0.5
# 定义直径和释放高度
diameters = [10, 15, 20, 25]
heights = [50, 100, 150, 200]
# 绘制曲线图
plt.figure(figsize=(10, 6))
for diameter in diameters:
bounce_heights = [calculate_bounce_height(diameter, height) for height in heights]
plt.plot(heights, bounce_heights, label=f'Diameter {diameter} cm')
plt.xlabel('Release Height (cm)')
plt.ylabel('Bounce Height of Ping Pong Ball (cm)')
plt.title('Ping Pong Ball Bounce Height vs. Release Height for Different Container Diameters')
plt.legend()
plt.grid()
plt.show()
aW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdAoKIyDlrprkuYnorqHnrpfkuZLkuZPnkIPlvLnotbfpq5jluqbnmoTlh73mlbAKZGVmIGNhbGN1bGF0ZV9ib3VuY2VfaGVpZ2h0KGRpYW1ldGVyLCByZWxlYXNlX2hlaWdodCk6CiAgICByZXR1cm4gcmVsZWFzZV9oZWlnaHQgKiAoZGlhbWV0ZXIgLyAxMCkgKiogMC41CgojIOWumuS5ieebtOW+hOWSjOmHiuaUvumrmOW6pgpkaWFtZXRlcnMgPSBbMTAsIDE1LCAyMCwgMjVdCmhlaWdodHMgPSBbNTAsIDEwMCwgMTUwLCAyMDBdCgojIOe7mOWItuabsue6v+WbvgpwbHQuZmlndXJlKGZpZ3NpemU9KDEwLCA2KSkKZm9yIGRpYW1ldGVyIGluIGRpYW1ldGVyczoKICAgIGJvdW5jZV9oZWlnaHRzID0gW2NhbGN1bGF0ZV9ib3VuY2VfaGVpZ2h0KGRpYW1ldGVyLCBoZWlnaHQpIGZvciBoZWlnaHQgaW4gaGVpZ2h0c10KICAgIHBsdC5wbG90KGhlaWdodHMsIGJvdW5jZV9oZWlnaHRzLCBsYWJlbD1mJ0RpYW1ldGVyIHtkaWFtZXRlcn0gY20nKQoKcGx0LnhsYWJlbCgnUmVsZWFzZSBIZWlnaHQgKGNtKScpCnBsdC55bGFiZWwoJ0JvdW5jZSBIZWlnaHQgb2YgUGluZyBQb25nIEJhbGwgKGNtKScpCnBsdC50aXRsZSgnUGluZyBQb25nIEJhbGwgQm91bmNlIEhlaWdodCB2cy4gUmVsZWFzZSBIZWlnaHQgZm9yIERpZmZlcmVudCBDb250YWluZXIgRGlhbWV0ZXJzJykKcGx0LmxlZ2VuZCgpCnBsdC5ncmlkKCkKcGx0LnNob3coKQ==
import matplotlib.pyplot as plt
# 定义计算乒乓球弹起高度的函数
def calculate_bounce_height(diameter, release_height):
return release_height * (diameter / 10) ** 0.5
# 定义直径和释放高度
diameters = [10, 15, 20, 25]
heights = [50, 100, 150, 200]
# 绘制曲线图
plt.figure(figsize=(10, 6))
for diameter in diameters:
bounce_heights = [calculate_bounce_height(diameter, height) for height in heights]
plt.plot(heights, bounce_heights, label=f'Diameter {diameter} cm')
plt.xlabel('Release Height (cm)')
plt.ylabel('Bounce Height of Ping Pong Ball (cm)')
plt.title('Ping Pong Ball Bounce Height vs. Release Height for Different Container Diameters')
plt.legend()
plt.grid()
plt.show()