为什么八面体和立方体的表面积与体积之比是一个常数,却没有反映在我的程序中?
Why is the ratio of the Surface Area to Volume Ratios of a Octahedron and Cube, a constant, not reflected in my program?
由于我正在为其 SA:V 编码的两个柏拉图固体的问题:立方体和八面体,我在发表论文时遇到了困难。
通常情况下,推导立方体和八面体的SA:V比率时,会分别得出6/a和(3*sqrt(6))/a。
当您将这些比率作为一个比率时,您会得到一个恒定的非 1:1 比率,适用于所有尺寸范围,那么,我的输出如何成为 1:1 关系?
输出(点击link):
Graph of Ratios:
Table
所有实例中两种形状的相关代码,用于用户请求、制表和绘图(忽略二十面体代码):一例:
elif name_of_polyhedron == 'Octahedron':
a = d/math.sqrt(2)
SA_vex_octa = ((2*math.sqrt(3))*a**2)
V_vex_octa = (((math.sqrt(2))/(3))*a**3)
ratio_vex_octa = (SA_vex_octa/V_vex_octa)
print('The surface area of your octahedron is as follows:' +str(SA_vex_octa)+ 'm^2')
print('The volume of your octahedron is as follows:' +str(V_vex_octa)+ 'm^3')
print('The surface area to volume ratio of your octahedron is as follows:'
+str(ratio_vex_octa))
print('See how your ratio compares below!')
elif name_of_polyhedron == 'Icosahedron':
a = 4*(1/(math.sqrt(10+2*math.sqrt(5))))*((1/2)*d)
SA_vex_icosa = 5*(a**2)*math.sqrt(3)
V_vex_icosa = (5/12)*(a**3)*(3+sqrt(5))
ratio_vex_icosa = SA_vex_icosa/V_vex_icosa
print('The surface area of your icosahedron is as follows:' +str(SA_vex_icosa)+ 'm^2')
print('The volume of your icosahedron is as follows:' +str(V_vex_icosa)+ 'm^3')
print('The surface area to volume ratio of your icosahedron is as follows:'
+str(ratio_vex_icosa))
print('See how your ratio compares below!')
elif name_of_polyhedron == 'Cube':
a = d/math.sqrt(3)
SA_vex_cube = 6*a**2
V_vex_cube = a**3
ratio_vex_cube = SA_vex_cube/V_vex_cube
print('The surface area of your cube is as follows:' +str(SA_vex_cube)+ 'm^2')
print('The volume of your cube is as follows:' +str(V_vex_cube)+ 'm^3')
print('The surface area to volume ratio of your cube is as follows:' +str(ratio_vex_cube))
print('See how your ratio compares below!')
#Second Instance
a_4 = d/math.sqrt(2)
SA_vex_octa = (2*math.sqrt(3))*(a_4)**2
V_vex_octa = ((math.sqrt(2))/(3))*(a_4)**3
ratio_vex_octa = SA_vex_octa/V_vex_octa
a_5 = 4*(1/(math.sqrt(10+2*math.sqrt(5))))*((1/2)*d)
SA_vex_icosa = 5*((a_5)**2)*math.sqrt(3)
V_vex_icosa = (5/12)*((a_5)**3)*(3+math.sqrt(5))
ratio_vex_icosa = SA_vex_icosa/V_vex_icosa
a_6 = d/math.sqrt(3)
SA_vex_cube = 6*(a_6)**2
V_vex_cube = (a_6)**3
ratio_vex_cube = SA_vex_cube/V_vex_cube
#Third Instance
a_3 = (2/math.sqrt(6))*d
a_4 = d/math.sqrt(2)
a_5 = (2/(math.sqrt(10+2*math.sqrt(5))))*d
a_6 = d/math.sqrt(3)
a_7 = (2/(math.sqrt(3)*(1+math.sqrt(5)))*d)
a_8 = ((2/(math.sqrt(10+2*math.sqrt(5))))*d)
a_9 = ((2/(math.sqrt(50+22*math.sqrt(5))))*d)
a_10 = ((3/(math.sqrt(3)*(3+math.sqrt(5))))*d)
a_11 = ((2/(math.sqrt(50+22*math.sqrt(5))))*d)
SA_vex_tetra = (((a_3)**2)*math.sqrt(3))
V_vex_tetra = ((((a_3)**3)/12)*math.sqrt(2))
ratio_vex_tetra = [SA_vex_tetra/V_vex_tetra]
SA_vex_octa = (2*math.sqrt(3))*(a_4)**2
V_vex_octa = ((math.sqrt(2))/(3))*(a_4)**3
ratio_vex_octa = SA_vex_octa/V_vex_octa
SA_vex_icosa = 5*((a_5)**2)*math.sqrt(3)
V_vex_icosa = (5/12)*(a_5)**3*(3+math.sqrt(5))
ratio_vex_icosa = SA_vex_icosa/V_vex_icosa
SA_vex_cube = 6*(a_6)**2
V_vex_cube = (a_6)**3
ratio_vex_cube = SA_vex_cube/V_vex_cube
Table/Graph 它们出现的地方:
import matplotlib.pyplot as plt
from tabulate import tabulate
z = [('Tetrahedon',a_2,'Platonic',d,SA_vex_tetra,V_vex_tetra,ratio_vex_tetra),
('Octahedron',a_2,'Platonic',d,SA_vex_octa,V_vex_octa,ratio_vex_octa),
('Icosahedron',a_2,'Platonic',d,SA_vex_icosa,V_vex_icosa,ratio_vex_icosa),
('Cube',a_2,'Platonic',d,SA_vex_cube,V_vex_cube,ratio_vex_cube),
('Dodecahedron',a_2,'Platonic',d,SA_vex_dodeca,V_vex_dodeca,ratio_vex_dodeca),
('Cuboctahedron',a_2,'Archimedes',d,SA_vex_cubocta,V_vex_cubocta,ratio_vex_cubocta),
('Rhombicuboctahedron',a_2,'Archimedes',d,SA_vex_rhocubocta,V_vex_rhocubocta,ratio_vex_X),
('Snub Cube',a_2,'Archimedes',d,SA_vex_scube,V_vex_scube,ratio_vex_scube),
('Snub Dodecahedron',a_2,'Archimedes',d,SA_vex_sndodeca,V_vex_sndodeca,ratio_vex_sndodeca),
('Rhombicosidodecahedron',a_2,'Archimedes',d,SA_vex_ridodeca,V_vex_ridodeca,ratio_vex_ridodeca),
('Truncated Octahedron',a_2,'Archimedes',d,SA_vex_ridodeca,V_vex_ridodeca,ratio_vex_sndodeca),
('Deltoidal Icositetrahedron','Catalan',a_2,d,SA_vex_delicotetra,V_vex_delicotetra,ratio_vex_X),
('Great Dodecahedron',a_1,'Kepler-Poinsot',d,SA_cav_gdodeca,V_cav_gdodeca,ratio_cav_gdodeca),
('Great Icosahedron',a_1,'Kepler-Poinsot',d,SA_cav_gicosa,V_cav_gicosa,ratio_cav_gicosa),
('Great-Stellated Dodecahedron',a_1,'Kepler-Poinsot',d,SA_cav_gsdodeca,V_cav_gsdodeca,ratio_X_X),
('Small-Stellated Dodecahedron',a_1,'Kepler Poinsot',d,SA_cav_ssdodeca,V_cav_ssdodeca,X),
('Stellated Octahedron',a_1,'Da Vinci',d,SA_cav_stocta,V_cav_stocta,ratio_cav_stocta),
('Medial Rhombic Triacontahedron',a_1,'A-R',(Wenninger)',d,SA_cav_mrtria,V_cav_mrtria,X),
('Dodecadodecahedron',a_1,'A-R (Wenninger)',d,SA_cav_ddodeca,V_cav_ddodeca,ratio_cav_ddodeca),
('Medial Triambic Icosahedron',a_1,'A-R', (Wenninger)',d,SA_cav_mticosa,V_cav_mticosa,X),
('Small Ditrigonal Icosidodecahedron',a_1,'A-R',(Wenninger)',d,SA_cav_sdicosi,V_cav_sdicosi,X),
('Excavated Dodecahedron',a_1,'A-R',(Wenninger)',d,SA_cav_exdodeca,V_cav_exdodeca,X),
('Sphere',a_12,a_12,d,SA_sphere,V_sphere,ratio_sphere)]
table_1 = tabulate(z, headers=['Shape','Type','Subtype','C.D. (m)',
'SA (m^2)','V(m^3)','SA:V'], tablefmt='fancy_grid') #orgtbl or f or pretty
print(table_1)
Platonic_Array_Ratios = [ratio_vex_tetra,ratio_vex_octa,
ratio_vex_icosa,ratio_vex_cube,
ratio_vex_dodeca,ratio_sphere]
plt.title('Surface Area to Volume Ratio of Platonic Polyhedra Against Referential Sphere for
Given
Diameter')
plt.barh(['Tetrahedron', 'Octahedron',
'Icosahedron', 'Cube',
'Dodecahedron', 'Sphere'], Platonic_Array_Ratios)
plt.show()
# Platonic
plt.scatter(d,ratio_vex_tetra,label='Tetrahedron', color='b')
plt.scatter(d,ratio_vex_octa,label='Octahedron', color='g')
plt.scatter(d,ratio_vex_icosa,label='Icosahedron', color='y')
plt.scatter(d,ratio_vex_cube,label='Cube', color='m')
plt.scatter(d,ratio_vex_dodeca,label='Dodecahedron', color='c')
plt.scatter(d,ratio_sphere,label='Referential Sphere', color='r')
plt.axvline(x=d_vertical_slash, color='k')
plt.title('Comparison of SA:V of Platonic polyhedra against Referential Sphere with D(m)')
plt.xlabel('Circumspherical Diameter/Diagonal (m)')
plt.ylabel('Ratio Index')
plt.grid(alpha=.4,linestyle='--')
plt.xscale("log")
plt.legend(loc = 1)
plt.show()
我已经通过手工和在线小部件仔细检查了四次计算...它们都是正确的,并且在程序输出的所有计算中都相互匹配,但仍然存在错误。好像一个覆盖了另一个,但是在哪里?
注意:这段代码中没有错误信息。我也为长代码道歉。在某些情况下,我不得不将所有内容复制并粘贴在一起以实现可重复性或只是为了提供更大的上下文。 X 只是格式化的占位符。
您正在计算“柏拉图多面体的表面积与体积之比 相对于给定直径的参考球面” [已添加粗体]
因此,在将立方体与八面体进行比较之前,先将立方体与立方体直径 的球体进行比较, 并将八面体与球体 进行比较八面体的直径.
(我认为这意味着外接球体;我不会检查内切球体。)
球体的SA/V比率是6/d,其中d是直径。
边长为a的立方体的最大直径为sqrt(3)a,所以cube/sphere比率为(6/a)/(6/(sqrt(3)a)) =开方(3)
边长a的八面体的最大直径是sqrt(2)a,所以octahedron/sphere比值是(3sqrt(6)/a)/(6/(sqrt(2)a )) = 开方 (3)
由于与球体的比较,所以比率为 1:1。
由于我正在为其 SA:V 编码的两个柏拉图固体的问题:立方体和八面体,我在发表论文时遇到了困难。
通常情况下,推导立方体和八面体的SA:V比率时,会分别得出6/a和(3*sqrt(6))/a。
当您将这些比率作为一个比率时,您会得到一个恒定的非 1:1 比率,适用于所有尺寸范围,那么,我的输出如何成为 1:1 关系?
输出(点击link):
Graph of Ratios:
Table
所有实例中两种形状的相关代码,用于用户请求、制表和绘图(忽略二十面体代码):一例:
elif name_of_polyhedron == 'Octahedron':
a = d/math.sqrt(2)
SA_vex_octa = ((2*math.sqrt(3))*a**2)
V_vex_octa = (((math.sqrt(2))/(3))*a**3)
ratio_vex_octa = (SA_vex_octa/V_vex_octa)
print('The surface area of your octahedron is as follows:' +str(SA_vex_octa)+ 'm^2')
print('The volume of your octahedron is as follows:' +str(V_vex_octa)+ 'm^3')
print('The surface area to volume ratio of your octahedron is as follows:'
+str(ratio_vex_octa))
print('See how your ratio compares below!')
elif name_of_polyhedron == 'Icosahedron':
a = 4*(1/(math.sqrt(10+2*math.sqrt(5))))*((1/2)*d)
SA_vex_icosa = 5*(a**2)*math.sqrt(3)
V_vex_icosa = (5/12)*(a**3)*(3+sqrt(5))
ratio_vex_icosa = SA_vex_icosa/V_vex_icosa
print('The surface area of your icosahedron is as follows:' +str(SA_vex_icosa)+ 'm^2')
print('The volume of your icosahedron is as follows:' +str(V_vex_icosa)+ 'm^3')
print('The surface area to volume ratio of your icosahedron is as follows:'
+str(ratio_vex_icosa))
print('See how your ratio compares below!')
elif name_of_polyhedron == 'Cube':
a = d/math.sqrt(3)
SA_vex_cube = 6*a**2
V_vex_cube = a**3
ratio_vex_cube = SA_vex_cube/V_vex_cube
print('The surface area of your cube is as follows:' +str(SA_vex_cube)+ 'm^2')
print('The volume of your cube is as follows:' +str(V_vex_cube)+ 'm^3')
print('The surface area to volume ratio of your cube is as follows:' +str(ratio_vex_cube))
print('See how your ratio compares below!')
#Second Instance
a_4 = d/math.sqrt(2)
SA_vex_octa = (2*math.sqrt(3))*(a_4)**2
V_vex_octa = ((math.sqrt(2))/(3))*(a_4)**3
ratio_vex_octa = SA_vex_octa/V_vex_octa
a_5 = 4*(1/(math.sqrt(10+2*math.sqrt(5))))*((1/2)*d)
SA_vex_icosa = 5*((a_5)**2)*math.sqrt(3)
V_vex_icosa = (5/12)*((a_5)**3)*(3+math.sqrt(5))
ratio_vex_icosa = SA_vex_icosa/V_vex_icosa
a_6 = d/math.sqrt(3)
SA_vex_cube = 6*(a_6)**2
V_vex_cube = (a_6)**3
ratio_vex_cube = SA_vex_cube/V_vex_cube
#Third Instance
a_3 = (2/math.sqrt(6))*d
a_4 = d/math.sqrt(2)
a_5 = (2/(math.sqrt(10+2*math.sqrt(5))))*d
a_6 = d/math.sqrt(3)
a_7 = (2/(math.sqrt(3)*(1+math.sqrt(5)))*d)
a_8 = ((2/(math.sqrt(10+2*math.sqrt(5))))*d)
a_9 = ((2/(math.sqrt(50+22*math.sqrt(5))))*d)
a_10 = ((3/(math.sqrt(3)*(3+math.sqrt(5))))*d)
a_11 = ((2/(math.sqrt(50+22*math.sqrt(5))))*d)
SA_vex_tetra = (((a_3)**2)*math.sqrt(3))
V_vex_tetra = ((((a_3)**3)/12)*math.sqrt(2))
ratio_vex_tetra = [SA_vex_tetra/V_vex_tetra]
SA_vex_octa = (2*math.sqrt(3))*(a_4)**2
V_vex_octa = ((math.sqrt(2))/(3))*(a_4)**3
ratio_vex_octa = SA_vex_octa/V_vex_octa
SA_vex_icosa = 5*((a_5)**2)*math.sqrt(3)
V_vex_icosa = (5/12)*(a_5)**3*(3+math.sqrt(5))
ratio_vex_icosa = SA_vex_icosa/V_vex_icosa
SA_vex_cube = 6*(a_6)**2
V_vex_cube = (a_6)**3
ratio_vex_cube = SA_vex_cube/V_vex_cube
Table/Graph 它们出现的地方:
import matplotlib.pyplot as plt
from tabulate import tabulate
z = [('Tetrahedon',a_2,'Platonic',d,SA_vex_tetra,V_vex_tetra,ratio_vex_tetra),
('Octahedron',a_2,'Platonic',d,SA_vex_octa,V_vex_octa,ratio_vex_octa),
('Icosahedron',a_2,'Platonic',d,SA_vex_icosa,V_vex_icosa,ratio_vex_icosa),
('Cube',a_2,'Platonic',d,SA_vex_cube,V_vex_cube,ratio_vex_cube),
('Dodecahedron',a_2,'Platonic',d,SA_vex_dodeca,V_vex_dodeca,ratio_vex_dodeca),
('Cuboctahedron',a_2,'Archimedes',d,SA_vex_cubocta,V_vex_cubocta,ratio_vex_cubocta),
('Rhombicuboctahedron',a_2,'Archimedes',d,SA_vex_rhocubocta,V_vex_rhocubocta,ratio_vex_X),
('Snub Cube',a_2,'Archimedes',d,SA_vex_scube,V_vex_scube,ratio_vex_scube),
('Snub Dodecahedron',a_2,'Archimedes',d,SA_vex_sndodeca,V_vex_sndodeca,ratio_vex_sndodeca),
('Rhombicosidodecahedron',a_2,'Archimedes',d,SA_vex_ridodeca,V_vex_ridodeca,ratio_vex_ridodeca),
('Truncated Octahedron',a_2,'Archimedes',d,SA_vex_ridodeca,V_vex_ridodeca,ratio_vex_sndodeca),
('Deltoidal Icositetrahedron','Catalan',a_2,d,SA_vex_delicotetra,V_vex_delicotetra,ratio_vex_X),
('Great Dodecahedron',a_1,'Kepler-Poinsot',d,SA_cav_gdodeca,V_cav_gdodeca,ratio_cav_gdodeca),
('Great Icosahedron',a_1,'Kepler-Poinsot',d,SA_cav_gicosa,V_cav_gicosa,ratio_cav_gicosa),
('Great-Stellated Dodecahedron',a_1,'Kepler-Poinsot',d,SA_cav_gsdodeca,V_cav_gsdodeca,ratio_X_X),
('Small-Stellated Dodecahedron',a_1,'Kepler Poinsot',d,SA_cav_ssdodeca,V_cav_ssdodeca,X),
('Stellated Octahedron',a_1,'Da Vinci',d,SA_cav_stocta,V_cav_stocta,ratio_cav_stocta),
('Medial Rhombic Triacontahedron',a_1,'A-R',(Wenninger)',d,SA_cav_mrtria,V_cav_mrtria,X),
('Dodecadodecahedron',a_1,'A-R (Wenninger)',d,SA_cav_ddodeca,V_cav_ddodeca,ratio_cav_ddodeca),
('Medial Triambic Icosahedron',a_1,'A-R', (Wenninger)',d,SA_cav_mticosa,V_cav_mticosa,X),
('Small Ditrigonal Icosidodecahedron',a_1,'A-R',(Wenninger)',d,SA_cav_sdicosi,V_cav_sdicosi,X),
('Excavated Dodecahedron',a_1,'A-R',(Wenninger)',d,SA_cav_exdodeca,V_cav_exdodeca,X),
('Sphere',a_12,a_12,d,SA_sphere,V_sphere,ratio_sphere)]
table_1 = tabulate(z, headers=['Shape','Type','Subtype','C.D. (m)',
'SA (m^2)','V(m^3)','SA:V'], tablefmt='fancy_grid') #orgtbl or f or pretty
print(table_1)
Platonic_Array_Ratios = [ratio_vex_tetra,ratio_vex_octa,
ratio_vex_icosa,ratio_vex_cube,
ratio_vex_dodeca,ratio_sphere]
plt.title('Surface Area to Volume Ratio of Platonic Polyhedra Against Referential Sphere for
Given
Diameter')
plt.barh(['Tetrahedron', 'Octahedron',
'Icosahedron', 'Cube',
'Dodecahedron', 'Sphere'], Platonic_Array_Ratios)
plt.show()
# Platonic
plt.scatter(d,ratio_vex_tetra,label='Tetrahedron', color='b')
plt.scatter(d,ratio_vex_octa,label='Octahedron', color='g')
plt.scatter(d,ratio_vex_icosa,label='Icosahedron', color='y')
plt.scatter(d,ratio_vex_cube,label='Cube', color='m')
plt.scatter(d,ratio_vex_dodeca,label='Dodecahedron', color='c')
plt.scatter(d,ratio_sphere,label='Referential Sphere', color='r')
plt.axvline(x=d_vertical_slash, color='k')
plt.title('Comparison of SA:V of Platonic polyhedra against Referential Sphere with D(m)')
plt.xlabel('Circumspherical Diameter/Diagonal (m)')
plt.ylabel('Ratio Index')
plt.grid(alpha=.4,linestyle='--')
plt.xscale("log")
plt.legend(loc = 1)
plt.show()
我已经通过手工和在线小部件仔细检查了四次计算...它们都是正确的,并且在程序输出的所有计算中都相互匹配,但仍然存在错误。好像一个覆盖了另一个,但是在哪里?
注意:这段代码中没有错误信息。我也为长代码道歉。在某些情况下,我不得不将所有内容复制并粘贴在一起以实现可重复性或只是为了提供更大的上下文。 X 只是格式化的占位符。
您正在计算“柏拉图多面体的表面积与体积之比 相对于给定直径的参考球面” [已添加粗体]
因此,在将立方体与八面体进行比较之前,先将立方体与立方体直径 的球体进行比较, 并将八面体与球体 进行比较八面体的直径.
(我认为这意味着外接球体;我不会检查内切球体。)
球体的SA/V比率是6/d,其中d是直径。
边长为a的立方体的最大直径为sqrt(3)a,所以cube/sphere比率为(6/a)/(6/(sqrt(3)a)) =开方(3)
边长a的八面体的最大直径是sqrt(2)a,所以octahedron/sphere比值是(3sqrt(6)/a)/(6/(sqrt(2)a )) = 开方 (3)
由于与球体的比较,所以比率为 1:1。