Skip to content

maths: add autocorrelation function#14895

Open
zain-cs wants to merge 4 commits into
TheAlgorithms:masterfrom
zain-cs:add-autocorrelation
Open

maths: add autocorrelation function#14895
zain-cs wants to merge 4 commits into
TheAlgorithms:masterfrom
zain-cs:add-autocorrelation

Conversation

@zain-cs

@zain-cs zain-cs commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Adds an autocorrelation function to the maths directory.

Autocorrelation measures the correlation of a signal with a delayed copy of itself. It is widely used in time series analysis, signal processing, and statistics.

Changes

  • Added maths/autocorrelation.py with:
    • autocorrelation(data, lag) function
    • Full docstring with parameter descriptions
    • Doctests for valid and invalid inputs
    • ValueError for invalid lag or zero variance

References

Checklist

  • This PR only changes one algorithm file
  • All functions have type hints
  • All functions have doctests
  • Wikipedia reference included

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant