Sympy Solve 需要永远运行

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

我一直在尝试使用 Sympy 的solve() 函数求解方程组;但每当我在 Jupyter Notebook 中运行它时,内核只是说它很忙,而且似乎没有完成运行并给我一个解决方案。

这就是我正在运行的:

from sympy import *

L = 2504 # mm
Ac = 3610 # mm^2
E = 203 # GPa
P = 587 # kN
theta = 42 # degrees

L = L*1e-3
Ac = Ac*1e-6
E = E*1e9
P = P*1e3
theta = rad(theta)

P1 = Matrix([0, -P, 0])
P2 = Matrix([-P, 0, 0])

ax, ay, cy = symbols('ax ay cy')

A = Matrix([ax, ay, 0])
C = Matrix([0, cy, 0])

eq1 = Eq(A + C + P1 + P2, zeros(3,1))
eq2 = Eq(L*cy + P*(L/2)*tan(theta) - P*(L/2), 0)

solve((eq1, eq2))
python jupyter-notebook sympy solver
1个回答
0
投票

您使用的是哪个版本的 sympy?有了 sympy

1.12.1
,我立即得到了答案:

{ax: 587000.000000000, ay: 557768.587001416, cy: 29231.4129985840}

查找 sympy 的版本:

import sympy as sp
print(sp.__version__)
© www.soinside.com 2019 - 2024. All rights reserved.