#求解非线性方程组2x1-x2^2=1,x1^2-x2=2
from scipy.optimize import fsolve #导入求解方程组的函数
from scipy import integrate
def func(x:list):
x1=x[0]
x2=x[1]
xy=[2*x1-x2**2-1,x1**2-x2-2]
result=fsolve(xy,x) #输入初始值,并求解
return result
def g(y):
return (1-y**2)**0.5
pi_2,err=integrate.quad(g,-1,1) #积分结果和误差
print(pi_2*2)
---------------------
作者:wx_411180165
来源:CSDN
原文:https://blog.csdn.net/qq_24726509/article/details/84727111
版权声明:本文为博主原创文章,转载请附上博文链接!
|
|