How to simplify the exponents in equations in sympy
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) After using # even after simplifying the desired output one ** (b ** 15) and if it is not possible with Simpi, So, what should I import into Python?
Edit Even if I define 'B' as the real, and all other symbols
b = symbols ( It is simpler to get simplified exponents if 'expanses' are fixed.
', Real = true) (a ** 5) ** 10a ** 50 # only if XP numbers are (a ** b ** 5) ** b ** 10 (a ** (b ** 5) ) ** B ** 10 # No Simplification
(x m < / Sup>) n = X mn is true.
& gt; & Gt; & Gt; Import Mathematics & gt; & Gt; & Gt; X = math.e> & gt; & Gt; M = 2j * math.pi & gt; & Gt; & Gt; (X ** m) ** m # (E ^ (2πi)) ^ (2πi) = 1 ^ (2πi) = 1 (1.0000000000000000000016 + 0J) & gt; & Gt; & Gt; X ** (m * m) # e ^ (2πi × 2πi) = E ^ (- 4π²) ≠ 1 (7.157165835186074e-18-0j) AFAIK, therefore believe me This simplification should not be done unless you prove to be b true.
Edit: This is also incorrect if x is not positive.
& gt; & Gt; & Gt; X = -2> gt; & Gt; & Gt; M = 2> and gt; & Gt; N = 0.5 >>> & gt; & Gt; (X ** m) ** n 2.0 & gt; & Gt; & Gt; Edit x ** (m * n) -2.0 Edit (by Gnibbler): Here is the basic example with the restrictions of Kenny applied
> ; & Gt; & Gt; Sympy import symbols & gt; & Gt; & Gt; A, B = symbols ('AB', true = true, positive = true)> gt; & Gt; & Gt; Jammu = (a ** b ** 5) ** (b ** 10) & gt; & Gt; & Gt; Print JA ** (B ** 15)
Comments
Post a Comment