Python 官方文档:入门教程 => 点击学习
python使用integrate函数计算球体体积,具体方法如下:from scipy import integrateimport numpy as npimport timestart=time.clock()def half_circ
python使用integrate函数计算球体体积,具体方法如下:
from scipy import integrate
import numpy as np
import time
start=time.clock()
def half_circle(x):
return (1-x**2)**0.5
def half_sphere(x,y):
return (1-x**2-y**2)**0.5
volume,error=integrate.dblquad(half_sphere,-1,1,
lambda x: -half_circle(x),
lambda x: half_circle(x))
end=time.clock()
print('{}\n{}\n{}'.fORMat(volume,error,np.pi*4/3/2))
print('time={} Sconds'.format(end-start))
--结束END--
本文标题: python怎么用函数算体积
本文链接: https://www.lsjlt.com/news/114290.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0