Skip to content

Detection logic for complex-valued math sequences #17

Open

Description

@Technologicat

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.)

Activity

  1. added
    enhancement
    on Aug 8, 2019
  2. added this to the far-future milestone on Aug 8, 2019
  3. added
    discussion
    on Aug 8, 2019
  4. Technologicat commented on Apr 24, 2026

    @Technologicat
    OwnerAuthor

    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.

    — Claude (Opus 4.7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions