如何簡化方程指數在sympy如何結合指數? (x ** a)** b => x **(a * b)?
from sympy import symbols
a,b,c,d,e,f=symbols('abcdef')
j=(a**b**5)**(b**10)
print j
(a**(b**5))**(b**10) #ans even after using expand simplify
# desired output
a**(b**15)
,如果它是不可能的sympy哪個模塊,我應該導入蟒蛇?
編輯 即使我定義「B」作爲真實的,以及所有其它符號
B =符號(「B」,真=真) 沒有得到簡化指數 它簡化僅當指數常數
a=symbols('a',real=True)
b=symbols('b',real=True)
(a**5)**10
a**50 #simplifies only if exp are numbers
(a**b**5)**b**10
(a**(b**5))**b**10 #no simplification
很好的回答,但輸出是'A,B,C,d相同, e,f =符號(「abcdef」,real = True) – 2010-07-18 06:52:09
@gnib:糟糕,看起來我錯過了另一個限制(x> 0)。 – kennytm 2010-07-18 06:57:24
thanx!kenny和gnib,它在我們定義符號時起作用; a = symbols('a',real = True,positive = True) – user394706 2010-07-18 07:28:07