24小时热门版块排行榜    

查看: 1429  |  回复: 0
【悬赏金币】回答本帖问题,作者横行天下99将赠送您 200 个金币

横行天下99

新虫 (初入文坛)

[求助] 在python中用sympy求定积分失败

用python sympy 求定积分,代码如下:
E=210000
from sympy import *
x=symbols('x')
T_2=(125-x)/50*(21-18)+18
Radius_2=T_2/40*10.5*0.5
I_2=((89-Radius_2*2)*T_2**3/12)+((T_2-Radius_2*2)**3*Radius_2/12)+(3.1415926536*(Radius_2*2)**4/64)
δ_2=float(integrate((x**2)/(E*I_2),(x,75,125)))
运行后电脑显示如下:
Traceback (most recent call last):
  File "G:\caculation.py", line 84, in <module>
    δ_2=float(integrate((x**2)/(E*I_2),(x,X_2,X_3)))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 1545, in integrate
    return integral.doit(**doit_flags)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 482, in doit
    did = self.xreplace(reps).doit(**hints)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 593, in doit
    antideriv = self._eval_integral(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 929, in _eval_integral
    result, i = risch_integrate(f, x, separate_integral=True,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\risch.py", line 1757, in risch_integrate
    ans = integrate(fa.as_expr()/fd.as_expr(), DE.x, risch=False)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 1545, in integrate
    return integral.doit(**doit_flags)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 593, in doit
    antideriv = self._eval_integral(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\integrals.py", line 1015, in _eval_integral
    parts.append(coeff * ratint(g, x))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\rationaltools.py", line 51, in ratint
    g, h = ratint_ratpart(p, q, x)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\integrals\rationaltools.py", line 146, in ratint_ratpart
    u, v, _ = g.cofactors(g.diff())
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\polytools.py", line 2846, in cofactors
    h, cff, cfg = F.cofactors(G)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\polyclasses.py", line 677, in cofactors
    h, cff, cfg = dmp_inner_gcd(F, G, lev, dom)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\euclidtools.py", line 1582, in dmp_inner_gcd
    return dup_inner_gcd(f, g, K)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\euclidtools.py", line 1514, in dup_inner_gcd
    return dup_ff_prs_gcd(f, g, K)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\euclidtools.py", line 1032, in dup_ff_prs_gcd
    cff = dup_quo(f, h, K)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\densearith.py", line 1579, in dup_quo
    return dup_div(f, g, K)[0]
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\densearith.py", line 1535, in dup_div
    return dup_ff_div(f, g, K)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\sympy\polys\densearith.py", line 1458, in dup_ff_div
    raise PolynomialDivisionFailed(f, g, K)
sympy.polys.polyerrors.PolynomialDivisionFailed: couldn't reduce degree in a polynomial division algorithm when dividing [EX(2.23619108242795e-7*E), EX(0.00122184751598725*E), EX(-1.80020279144187*E), EX(799.418707575197*E), EX(-115682.870492365*E)] by [EX(1.00000000000000)]. This can happen when it's not possible to detect zero in the coefficient domain. The domain of computation is EX. You may want to use a different simplification algorithm. Note that in general it's not possible to guarantee to detect zero in this domain.
这是什么原因?
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 横行天下99 的主题更新
不应助 确定回帖应助 (注意:应助才可能被奖励,但不允许灌水,必须填写15个字符以上)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 申请科研项目纯靠实力能成功吗? 200+4 David1982 2026-10-13 7/350 2026-10-14 14:24 by 13108017953
[硕博家园] 极限拉扯,如何抉择 +10 Isak0320 2026-10-12 14/700 2026-10-14 11:39 by thegarfield
[有机交流] OpenAI又攻克数学难题了,离AI做有机合成还有多远? +8 wangyl_123 2026-10-10 12/600 2026-10-13 20:40 by Merryya
[教师之家] 课题组会帮你通过考核么? +4 好运来~9527 2026-10-10 7/350 2026-10-13 08:41 by xli1984
[基金申请] 入职后第一次管课题组的专利缴费,对账才发现官费比别人多掏了一倍 +6 13108017953 2026-10-08 6/300 2026-10-12 20:07 by w3w3y3
[公派出国] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 9/450 2026-10-11 22:34 by XQNyDCa1Tk5n
[公派出国] 售SCI一区文章,我:8O5.5.1.O5.4,科目全,可伽急 +5 qR2AdCWTVtkw 2026-10-09 10/500 2026-10-11 22:26 by XQNyDCa1Tk5n
[找工作] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 8/400 2026-10-11 22:26 by XQNyDCa1Tk5n
[考博] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 9/450 2026-10-11 22:15 by XQNyDCa1Tk5n
[考博] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +3 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 22:11 by XQNyDCa1Tk5n
[教师之家] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 (EPI+-1)(金币-50) +5 qR2AdCWTVtkw 2026-10-09 10/500 2026-10-11 22:06 by XQNyDCa1Tk5n
[教师之家] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 (EPI+-1)(金币-50) +5 qR2AdCWTVtkw 2026-10-09 10/500 2026-10-11 14:25 by VOMexwnDzOFZ
[教师之家] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 (EPI+-1)(金币-50) +4 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 14:05 by VOMexwnDzOFZ
[考研] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 8/400 2026-10-11 13:51 by VOMexwnDzOFZ
[硕博家园] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +5 qR2AdCWTVtkw 2026-10-09 8/400 2026-10-11 13:45 by VOMexwnDzOFZ
[找工作] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 10:54 by VOMexwnDzOFZ
[找工作] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +4 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 10:34 by VOMexwnDzOFZ
[考博] 招收博士生一名 +3 mandolin 2026-10-10 3/150 2026-10-11 10:21 by 不是山谷!
[公派出国] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +4 qR2AdCWTVtkw 2026-10-09 4/200 2026-10-11 03:14 by M0zrYVSAnxpE
[有机交流] 各位大佬,路线设计求助 +6 zapen 2026-10-08 8/400 2026-10-10 15:59 by zapen
信息提示
请填处理意见