python怎么编辑极限函数
在python中利用符号计算编辑极限函数,具体方法如下:
import sympy
sympy.init_printing()
from sympy import I, pi, oo
import numpy as npx = sympy.Symbol('x')
expr = sympy.sin(x) / x
result = sympy.limit(expr,x,0)
print('limit:',result)f = sympy.Function('f')
x, h = sympy.symbols("x, h")
diff_limit = (f(x + h) - f(x))/h
result = sympy.limit(diff_limit.subs(f, sympy.cos), h, 0)
print('limit:',result)
result = sympy.limit(diff_limit.subs(f, sympy.sin), h, 0)
print('limit:',result)expr = (x**2 - 3*x) / (2*x - 2)
p = sympy.limit(expr/x, x, sympy.oo)
q = sympy.limit(expr - p*x, x, sympy.oo)
print('result:p,q = ',p,q)# 求和
n = sympy.symbols("n", integer=True)
s = sympy.Sum(1/(n**2), (n, 1, oo))
print('sum:',s)
print('sum:',s.doit())# 求积
p = sympy.Product(n, (n, 1, 7))
print('product:',p)
print('product:',p.doit())expr = sympy.Sum((x)**n/(sympy.factorial(n)), (n, 1, oo)).doit().simplify()
print('expr:',expr)
声明:本站所有作品(图文、音视频)均由用户自行上传分享,或互联网相关知识整合,仅供网友学习交流,若您的权利被侵害,请联系 管理员 删除。
本文链接:http://news.ew35.com/