You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detection logic for complex-valued math sequences #17
Currently, s() can handle only real-valued inputs. Complex-valued sequences can be created by composing s(re) + 1j*s(im) or s(mag) * math.exp(1)**(1j*s(arg)), but this is inconvenient.
So, it would be nice to have support for complex-valued sequences.
The complication is that logarithms behave less nicely for complex inputs. If we want to keep supporting both numeric (float, mpmath) and symbolic (SymPy) input, different logic may be needed to correctly detect the sequence for these cases.
Also, just for a pie in the sky, automatic OEIS lookup (if an internet connection is available) would be nice for integer inputs. (Maybe as a separate feature; for many sequences, only the first few elements are known anyway.)
For the complex-logarithm complication: the clean solution is to use the principal value. Python's cmath.log and SymPy's log already return the principal branch by default, so detection logic that works in the real case should carry over — the multi-valuedness concern dissolves if we simply commit to the principal branch as the detected-sequence convention.
Documenting the convention in the user-facing docstring (and mentioning it briefly in the failure message when detection is ambiguous) is then enough.
Activity
Technologicat commentedon Apr 24, 2026
For the complex-logarithm complication: the clean solution is to use the principal value. Python's
cmath.logand SymPy'slogalready return the principal branch by default, so detection logic that works in the real case should carry over — the multi-valuedness concern dissolves if we simply commit to the principal branch as the detected-sequence convention.Documenting the convention in the user-facing docstring (and mentioning it briefly in the failure message when detection is ambiguous) is then enough.
— Claude (Opus 4.7)