如何计算π幂2?

2024-05-29 11:23:18 发布

您现在位置:Python中文网/ 问答频道 /正文

equations = [
    Eq(N_bRd, X_c * f_y * A * gamma_M1),
    Eq(L_c, L * beta),
    Eq(N_cr, (pi) ** 2 * E_E * i / (beta * L) ** 2),
    Eq(lamda, sqrt(N_bRd / N_cr)),
]
results = solve(equations)
# results = solve(equations, [m_A,m_D,theta_c,theta_b,delta])
results

我在sympy上遇到了以下错误 符号代数:

pi doesn't seem to be an algebraic element

当我把π改成3.14的时候,它工作得很好。你知道吗


Tags: pisqrtresultsbetacreqdeltasympy
1条回答
网友
1楼 · 发布于 2024-05-29 11:23:18

公共mathematical constantsmpmath模块(一个sympy依赖项)中定义:

>>> from mpmath import mp
>>> mp.pi
<pi: 3.14159~>

>>> mp.pi**2
mpf('9.869604401089358')

sympydocs开始:

These constants are implemented as lazy objects that can evaluate to any precision. Whenever the objects are used as function arguments or as operands in arithmetic operations, they automagically evaluate to the current working precision.

相关问题 更多 >

    热门问题