Python 非线性方程组

from scipy.optimize import fsolve  
from math import cos  

def f(x):  
    d = 140  
    l = 156  
    a = float(x[0])  
    r = float(x[1])  
    return [  
        cos(a) - 1 + (d*d)/(2*r*r), #方程1 
        l - r * a                   #方程2
    ]  
result = fsolve(f, [1, 1])  
print (result ) 
posted @ 2022-08-19 22:59  luoganttcc  阅读(11)  评论(0编辑  收藏  举报