Skip to content

Commit da03c32

Browse files
Merge pull request sympy#20228 from sidhu1012/perf
fix perfomance
2 parents 5d5b7d7 + fb1437f commit da03c32

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

sympy/functions/elementary/complexes.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,16 @@ def eval(cls, arg):
343343
elif a.is_extended_positive:
344344
pass
345345
else:
346-
ai = im(a)
347-
if a.is_imaginary and ai.is_comparable: # i.e. a = I*real
348-
s *= S.ImaginaryUnit
349-
if ai.is_extended_negative:
350-
# can't use sign(ai) here since ai might not be
351-
# a Number
352-
s = -s
346+
if a.is_imaginary:
347+
ai = im(a)
348+
if ai.is_comparable: # i.e. a = I*real
349+
s *= S.ImaginaryUnit
350+
if ai.is_extended_negative:
351+
# can't use sign(ai) here since ai might not be
352+
# a Number
353+
s = -s
354+
else:
355+
unk.append(a)
353356
else:
354357
unk.append(a)
355358
if c is S.One and len(unk) == len(args):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy