📌  相关文章
📜  Python |如果半径增加,则半球体积的百分比增加

📅  最后修改于: 2021-05-04 15:03:56             🧑  作者: Mango

鉴于半球半径增加了固定百分比,因此目标是计算半球体积的增加百分比。

方法:
令,半球的半径= a
给定百分比增长= x%
增长前的数量= \frac{2}{3} * 3.14*a^3
增加后的新半径= a + \frac{ax}{100}
因此,新体积= \frac{2}{3}*3.14*(a^3 + (\frac{ax}{100})^3 + \frac{3a^3x}{100} + \frac{3a^3x^2}{10000})
音量变化= \frac{2}{3}*3.14*((\frac{ax}{100})^3 + \frac{3a^3x}{100} + \frac{3a^3x^2}{10000})
数量增加百分比= (\frac{2}{3}*3.14*((\frac{ax}{100})^3 + \frac{3a^3x}{100} + \frac{3a^3x^2}{10000})/\frac{2}{3}*3.14*a^3) * 100 = \frac{x^3}{10000} + 3x + \frac{3x^2}{100}

以下是上述方法的Python代码实现。

# Python3 program to find percentage increase 
# in the volume of the hemisphere 
# if the radius is increased by a given percentage 
    
def newvol(x): 
    
    print("percentage increase in the  volume of the"
          " hemisphere is ", pow(x, 3) / 10000 + 3 * x 
                + (3 * pow(x, 2)) / 100, "%") 
    
# Driver code 
x = 10.0
newvol(x) 

输出 :

percentage increase in the volume of the hemisphere is  33.1 %