Godtone
Joined 17 December 2020
→My Python 3 code: made in_subgroup more correct and work for more cases (no need for manual conversion anymore!) |
→My Python 3 code: corrected behaviour of unfact_int in the case where f==[] and p!=None |
||
| 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==None and f==[] is intentional. | |||
def unfact_int(f, p=None): | def unfact_int(f, p=None): | ||
return ( | return ( | ||
1 if f==[] | 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)) ]) | ||