📜  Python| sympy.as_independent() 方法

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

Python| sympy.as_independent() 方法

借助sympy.as_independent()方法,我们可以通过在sympy.as_independent()方法中作为参数传递的变量独立地分离数学表达式。

示例 #1:
在这个例子中我们可以看到,通过使用sympy.as_independent()方法,我们可以根据作为参数传递的自变量来分离数学函数。

# import sympy
from sympy import * 
  
x, y = symbols('x y')
  
# Use sympy.as_independent(variable) method
gfg = (1 + 2 * x + 1 / x).as_independent(x)
    
print(gfg)

输出 :

示例 #2:

# import sympy
from sympy import * 
  
x, y = symbols('x y')
  
# Use sympy.as_independent(variable) method
gfg = (1 / y**2 + x).as_independent(y)
    
print(gfg)

输出 :