Python编写求极限,类似于Matlab代码

 

求下面的极限

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from sympy import *
x = Symbol('x')
s = (x-3)/(x**2-9)
print(limit(s, x, 3))

结果输出:答案是 1/6

D:\Anaconda3\python.exe F:/PycharmProjects/TensorFlow/001.py
1/6

Process finished with exit code 0
 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐