# solve 求解方程组无解

0
[待解决问题]

Python使用symbol.solve求解函数 方程组如下;
[
X - 163.861322655775log(Y) - 282.006923794028 + 11.0706849793993pi,
0.4Z**2 - Y + 0.16,
-Z - 0.000973074986749799
X + 0.158780214645761
]

0

# 0 0.4Z 2 −Y+0.16=0 − 𝑍 − 0.000973074986749799 𝑋 + 0.158780214645761

0
−Z−0.000973074986749799X+0.158780214645761=0

python
Copy code
import numpy as np
from scipy.optimize import fsolve

def equations(vars):
X, Y, Z = vars
eq1 = X - 163.861322655775 * np.log(Y) - 282.006923794028 + 11.0706849793993 * np.pi
eq2 = 0.4 * Z**2 - Y + 0.16
eq3 = -Z - 0.000973074986749799 * X + 0.158780214645761
return [eq1, eq2, eq3]

# Initial guess

initial_guess = [1, 1, 1]

# Solve equations

solution = fsolve(equations, initial_guess)

print(solution)

𝑍
Z：

# 𝑍

0.000973074986749799
𝑋
+
0.158780214645761
Z=−0.000973074986749799X+0.158780214645761

# 0.4 ( − 0.000973074986749799 𝑋 + 0.158780214645761 ) 2 − 𝑌 + 0.16

0
0.4(−0.000973074986749799X+0.158780214645761)
2
−Y+0.16=0

# 𝑋 − 163.861322655775 log ⁡ ( 𝑌 ) − 282.006923794028 + 11.0706849793993 𝜋

0
X−163.861322655775log(Y)−282.006923794028+11.0706849793993π=0

python
Copy code
from sympy import symbols, Eq, log, pi, solve

# 定义符号

X, Y, Z = symbols('X Y Z')

# 定义方程

eq1 = Eq(X - 163.861322655775 * log(Y) - 282.006923794028 + 11.0706849793993 * pi, 0)
eq2 = Eq(0.4 * Z**2 - Y + 0.16, 0)
eq3 = Eq(-Z - 0.000973074986749799 * X + 0.158780214645761, 0)

# 求解方程组

solution = solve((eq1, eq2, eq3), (X, Y, Z))

print(solution)

Technologyforgood | 园豆：6766 (大侠五级) | 2024-05-23 20:31

您需要登录以后才能回答，未注册用户请先注册