📜  Python| sympy.limit() 方法

📅  最后修改于: 2022-05-13 01:54:56.596000             🧑  作者: Mango

Python| sympy.limit() 方法

借助sympy.limit()方法,我们可以找到任何数学表达式的极限,
例如,

(1)   \begin{equation*} \lim_{x\to a} f(x) \end{equation*}

示例 #1:

Python3
# import sympy
from sympy import *
 
x = symbols('x')
expr = sin(x)/x;
   
print("Expression : {}".format(expr))
     
# Use sympy.limit() method
limit_expr = limit(expr, x, 0) 
     
print("Limit of the expression tends to 0 : {}".format(limit_expr))


Python3
# import sympy
from sympy import *
 
x = symbols('x')
expr = sin(3 * x)/x;
   
print("Expression : {}".format(expr))
     
# Use sympy.limit() method
limit_expr = limit(expr, x, 0) 
     
print("Limit of the expression tends to 0 : {}".format(limit_expr))


输出:

Expression : sin(x)/x
Limit of the expression tends to 0 : 1

示例 #2:

Python3

# import sympy
from sympy import *
 
x = symbols('x')
expr = sin(3 * x)/x;
   
print("Expression : {}".format(expr))
     
# Use sympy.limit() method
limit_expr = limit(expr, x, 0) 
     
print("Limit of the expression tends to 0 : {}".format(limit_expr)) 

输出:

Expression : sin(3*x)/x
Limit of the expression tends to 0 : 3