是否有一种简单的方法可以使用sympy获取某个域中某个函数的所有不连续性?

sgf*_*gfw 5 python math sympy python-3.x

给定sympy中的表达式,是否可以找到给定间隔中的所有不连续性?例如,给定从(-2)到1 /(x ^ 2-1)的值,它将返回-1和1。它不必是符号。数值解实际上可能对我而言更好。

Ksh*_*ogi 2

您可以使用该singularities模块来实现此目的。

In [ ]: from sympy import *  
In [ ]: init_printing()
In [ ]: x = symbols('x')
In [ ]: singularities(1/(x**2 - 1), x)
Out[ ]: (-1, 1) # A tuple of SymPy objects
Run Code Online (Sandbox Code Playgroud)

参考:http ://docs.sympy.org/latest/modules/calculus/index.html#sympy.calculus.singularities.singularities