New issue 3109 by smi...@gmail.com: sqrt(exp(4*a)) != exp(2*a)
http://code.google.com/p/sympy/issues/detail?id=3109
Given the following,
>>> a.assumptions0
{}
>>> ai
I*pi/2
>>> e = exp(4*a)
These two should be the same:
>>> sqrt(e).subs(a,ai)
-1
>>> sqrt(e.subs(a,ai)) # subs before sqrt
1
>>> sqrt(e) # this is not a valid simplification
exp(2*a)
http://en.wikipedia.org/wiki/Exponentiation#Complex_powers_of_positive_real_numbers
says "the
identity (b**z)**u = b**(z*u) [where b is a positive real] is
valid...when z is real or u is an integer". (I wonder if |z| <= 1 is an
additional acceptable criteria.)
In the above we have b = E, z = 4*a and u = 1/2. u is not an integer and
4*I*pi/2 is 2*I*pi which is neither real nor less than 1 in magnitude.
https://github.com/sympy/sympy/pull/1105 has changes which modify power
rules. Tom might want to take a look since there are exp_polar related
changes; and it would be helpful if someone can prove that the
experimentally determined criteria `abs(e) < S.Pi/log(b)` is sufficient to
ensure that `(b**e)**a` == `b**(e*a)` when e is not real. I've done some
experimenting on my own and think it is right for b real or imaginary.
> it would be helpful if someone can prove that the experimentally
> determined criteria `abs(e) < S.Pi/log(b)` is sufficient to ensure that
> `(b**e)**a` == `b**(e*a)` when e is not real.
Are you making any assumptions on b?
No assumptions on b; it can be complex. And the rhs should be
abs(pi/log(b)).
Comment #5 on issue 3109 by smi...@gmail.com: sqrt(exp(4*a)) != exp(2*a)
http://code.google.com/p/sympy/issues/detail?id=3109
There are problems with how Pow.as_numer_denom works that leads to the
following error:
>>> print filldedent(str(m3))
-1484/375 - 4*(-12459439/52734375 + 114*sqrt(12657)/78125)**(1/3) -
172564/(140625*(-12459439/52734375 + 114*sqrt(12657)/78125)**(1/3))
>>> sqrt(m3).n()
0.221187120060844 + 2.51253478736008*I
>>> n,d=sqrt(m3).as_numer_denom()
>>> (n/d).n()
-0.221187120060844 - 2.51253478736008*I
This has also been fixed in https://github.com/sympy/sympy/pull/1105
Mul._eval_power also has an error that leads to the following failure:
>>> e=-sqrt(3)*(1+2*I)
>>> sqrt(e.n()).n()
1.03463339851334 - 1.6740720046904*I
>>> sqrt(e).n()
-1.03463339851334 + 1.6740720046904*I
>>> sqrt(e)
3**(1/4)*I*sqrt(1 + 2*I)
The negative sign should have been left inside. This is also fixed in
https://github.com/sympy/sympy/pull/1105
Comment #8 on issue 3109 by smi...@gmail.com: sqrt(exp(4*a)) != exp(2*a)
http://code.google.com/p/sympy/issues/detail?id=3109
(No comment was entered for this change.)