當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python sympy.powdenest()用法及代碼示例

借助sympy.powdenest()方法,我們可以通過使用等式簡化數學表達式的冪(x^a)^b=x^ab

用法: sympy.powdenest()
返回:Return the simplified mathematical expression using identity.

範例1:
在這個例子中,我們可以通過使用sympy.powdenest()方法,我們能夠使用恒等式簡化數學表達的能力,即(x^a)^b=x^ab


# import sympy 
from sympy import * 
  
x, y = symbols('x y') 
gfg_exp = (x**2)**3
   
# Use sympy.powdenest() method 
fact = powdenest(gfg_exp) 
   
print(fact)

輸出:

x**6

範例2:

# import sympy 
from sympy import * 
  
x, y, z, a, b = symbols('x y z a b') 
gfg_exp = (x**(a + b))**2
   
# Use sympy.powdenest() method 
fact = powdenest(gfg_exp) 
   
print(fact)

輸出:

x**(2*a + 2*b)



相關用法


注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy.powdenest() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。