Godtone
Joined 17 December 2020
→My Python 3 code: corrected behaviour of unfact_int in the case where f==[] and p!=None |
→My Python 3 code: explained why the new more restrictive behaviour is intentional and fixed code |
||
| Line 512: | Line 512: | ||
# Note that this works for negative exponents of primes too but produces | # Note that this works for negative exponents of primes too but produces | ||
# a floating point value rather than an exact rational representation. | # a floating point value rather than an exact rational representation. | ||
# Also note that this failing when p | # Also note that this failing when p!=None and f==[] is intentional | ||
# because [] represents a failed subgroup factorisation in the subgroup case. | |||
def unfact_int(f, p=None): | def unfact_int(f, p=None): | ||
return ( | return ( | ||
1 if f==[] and p | 1 if f==[] and p==None | ||
else prod([ prime_idx(i)**f[i] for i in range(len(f)) ]) if p==None | else prod([ prime_idx(i)**f[i] for i in range(len(f)) ]) if p==None | ||
else prod([ p[i]**f[i] for i in range(len(f)) ]) | else prod([ p[i]**f[i] for i in range(len(f)) ]) | ||