首页>>帮助中心>>香港云服务器python怎么用函数算体积

香港云服务器python怎么用函数算体积

2023/5/31 547次

香港云服务器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))

一诺网络香港免备案专区,提供「香港增强云服务器」和「香港特惠云服务器」两种类型的高可用弹性计算服务,搭载新一代英特尔®至强®铂金处理器,接入CN2低延时高速回国带宽线路,网络访问顺滑、流畅。机房网络架构采用了BGP协议的解决方案可提供多线路互联融合网络,使得不同网络运营商线路的用户都能通过最佳路由实现快速访问。香港云服务器低至29元/月,购买链接:https://www.enuoidc.com/vps.html ?typeid=2