首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么八面体和立方体的表面积与体积比是一个常数,而不是我的程序中所反映的?

为什么八面体和立方体的表面积与体积比是一个常数,而不是我的程序中所反映的?
EN

Stack Overflow用户
提问于 2021-04-22 00:49:54
回答 1查看 107关注 0票数 0

我在发表论文时遇到了困难,因为我正在为他们的SA编码两个柏拉图固体:v:立方体和八面体。

通常,当导出立方体和八面体的SA:V比时,其值分别为6/a和(3*sqrt(6))/a。

当你把这些比率作为一个比率,你得到一个恒定的非1:1的比例,所以,我的输出是如何1:1的关系?

输出(单击链接):

比率图:

表格

用于用户请求、制表和绘图的所有实例中两种形状的相关代码(忽略二十面体代码):第一个实例:

代码语言:javascript
复制
    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

表/图,它们发生的地方:

代码语言:javascript
复制
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()

我已经仔细地四次检查了手工计算和小部件计算,online...they都是正确的,并且在所有计算程序输出中都是匹配的,但是它仍然有一些错误。似乎其中一个在覆盖另一个,但在哪里?

注意:此代码中没有错误消息。我也为冗长的代码道歉。在某些情况下,为了重现性,或者只是为了提供更大的上下文,我不得不将所有的东西复制和粘贴在一起。X只是格式化的占位符。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-22 03:12:47

您正在计算“相对于给定直径的参考球体而言,柏拉图多面体的表面积与体积比”,粗体增加。

所以在你比较立方体和八面体之前,你比较立方体和立方体直径的球体,八面体和八面体直径的球体。

(我猜这是指限定的球体,我不会检查刻有字的球体。)

球体的SA/V比为6/d,其中d为直径。

边长为a的立方体的最大直径为sqrt(3)a,因此立方体/球比为(6/a)/(6/( sqrt(3) a)) =sqrt(3)。

边长为a的八面体的最大直径为sqrt(2)a,因此八面体/球比为(3sqrt(6)/a)/(6/(sqrt(2)a)) = sqrt(3)。

因此,由于与球体的比较,这一比例为1:1。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67205288

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档