用 Python 求解多解方程

问题描述 投票:0回答:0

我需要得到以下三角方程的解:

我知道根据 $\Delta$ 的值存在 M 或 M-1 解。有谁知道我可以在 Python 中使用任何模块或算法来完成这项任务?

我试过这个方法但是对公差很敏感,没用:

def f(k, N, d):
    return np.tan(k*(N)) - d*np.sin(k)/(1+d*np.cos(k))
    

k = np.linspace(0, np.pi, 10000+1, endpoint=False)[1:] 

def ksolutions(k,N,d):
    solutions=[]
    tol=4*1e-4
    for i in k:
        if abs(f(i,N,d))<tol:
            solutions.append(i)
    
    print(solutions) 
python equation-solving
© www.soinside.com 2019 - 2024. All rights reserved.