查看: 0  |  回复: 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个字符以上)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[硕博家园] 读博还是不读博 +16 向阳光 2020-11-25 19/950 2020-11-27 09:50 by seya
[教师之家] 求教:入外籍后,国内高校合同如何更新? +9 redbomb 2020-11-24 18/900 2020-11-27 09:42 by redbomb
[职场人生] 生活好艰辛 +6 Zabrina 2020-11-25 6/300 2020-11-27 07:44 by 昔年。。
[硕博家园] 科研上遇到问题或者困难怎么办 +8 耶1234 2020-11-26 8/400 2020-11-27 06:34 by hjaohuang
[教师之家] 大家毕业都投多少个高校呀? +9 EulerMo 2020-11-22 20/1000 2020-11-26 22:13 by 江畔恋心
[有机交流] 请问化合物的极性如何判断呀。。。 +4 安安妙妙 2020-11-24 5/250 2020-11-26 21:10 by 安安妙妙
[考博] 定向博士毕业无报到证? +4 诨小猴 2020-11-24 9/450 2020-11-26 17:26 by sature_2008
[有机交流] 又是被师兄骂的一天 +16 步步为? 2020-11-24 18/900 2020-11-26 15:21 by 星星女孩
[论文投稿] chinese journal of aeronautics 这个状态是内审吗,要多久呢 +3 comeonmy 2020-11-24 10/500 2020-11-26 15:15 by comeonmy
[有机交流] 酰胺合成~请大家不吝赐教~ +7 丑丑臭臭, 2020-11-23 17/850 2020-11-26 15:14 by chen4201
[论文投稿] 为何Current status已经是accept了,但是Date Final Disposition Set还是空的? 10+3 hdzw9071 2020-11-26 6/300 2020-11-26 15:11 by dxdx777
[论文投稿] 机械工程类着急毕业,求推荐好中的sci 10+3 jh00o0o 2020-11-23 6/300 2020-11-25 22:45 by bjhjl
[硕博家园] 最近某学姐可出名了。 +19 hlx7036 2020-11-22 20/1000 2020-11-25 19:32 by sunny_lala
[硕博家园] 关于读博择校 +25 lupo140155 2020-11-23 39/1950 2020-11-25 17:17 by lusaty315
[考研] 可否指点一下没有网上确认的人有什么出路 +6 Xanadux 2020-11-23 6/300 2020-11-25 14:13 by a735684166
[教师之家] 你们学校评职称有什么奇葩的规定? +14 一支穿雨箭 2020-11-20 17/850 2020-11-25 09:14 by 老冒
[考研] 吐槽当今的研究生招生:不合理的专业壁垒 +6 beefly 2020-11-23 6/300 2020-11-24 14:42 by qinqin浩
[硕博家园] 南方科技大学杨东助理教授招聘流体力学/航空航天等方向博士后、博硕士生 +8 Dong_Yang 2020-11-23 8/400 2020-11-24 13:00 by hqawj
[论文投稿] EST怎么这么慢啊。三天了还没有发邮件分配编辑! +6 执明 2020-11-21 9/450 2020-11-21 20:32 by 逝水无痕1990
[论文投稿] 二审加了审稿人,但是是小修了。 +3 abcdefg987 2020-11-20 3/150 2020-11-21 10:51 by pxpw4813
信息提示
请填处理意见