@wentorai/research-plugins 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/curated/analysis/README.md +64 -0
- package/curated/domains/README.md +104 -0
- package/curated/literature/README.md +53 -0
- package/curated/research/README.md +62 -0
- package/curated/tools/README.md +87 -0
- package/curated/writing/README.md +61 -0
- package/index.ts +39 -0
- package/mcp-configs/academic-db/ChatSpatial.json +17 -0
- package/mcp-configs/academic-db/academia-mcp.json +17 -0
- package/mcp-configs/academic-db/academic-paper-explorer.json +17 -0
- package/mcp-configs/academic-db/academic-search-mcp-server.json +17 -0
- package/mcp-configs/academic-db/agentinterviews-mcp.json +17 -0
- package/mcp-configs/academic-db/all-in-mcp.json +17 -0
- package/mcp-configs/academic-db/apple-health-mcp.json +17 -0
- package/mcp-configs/academic-db/arxiv-latex-mcp.json +17 -0
- package/mcp-configs/academic-db/arxiv-mcp-server.json +17 -0
- package/mcp-configs/academic-db/bgpt-mcp.json +17 -0
- package/mcp-configs/academic-db/biomcp.json +17 -0
- package/mcp-configs/academic-db/biothings-mcp.json +17 -0
- package/mcp-configs/academic-db/catalysishub-mcp-server.json +17 -0
- package/mcp-configs/academic-db/clinicaltrialsgov-mcp-server.json +17 -0
- package/mcp-configs/academic-db/deep-research-mcp.json +17 -0
- package/mcp-configs/academic-db/dicom-mcp.json +17 -0
- package/mcp-configs/academic-db/enrichr-mcp-server.json +17 -0
- package/mcp-configs/academic-db/fec-mcp-server.json +17 -0
- package/mcp-configs/academic-db/fhir-mcp-server-themomentum.json +17 -0
- package/mcp-configs/academic-db/fhir-mcp.json +19 -0
- package/mcp-configs/academic-db/gget-mcp.json +17 -0
- package/mcp-configs/academic-db/google-researcher-mcp.json +17 -0
- package/mcp-configs/academic-db/idea-reality-mcp.json +17 -0
- package/mcp-configs/academic-db/legiscan-mcp.json +19 -0
- package/mcp-configs/academic-db/lex.json +17 -0
- package/mcp-configs/ai-platform/Adaptive-Graph-of-Thoughts-MCP-server.json +17 -0
- package/mcp-configs/ai-platform/ai-counsel.json +17 -0
- package/mcp-configs/ai-platform/atlas-mcp-server.json +17 -0
- package/mcp-configs/ai-platform/counsel-mcp.json +17 -0
- package/mcp-configs/ai-platform/cross-llm-mcp.json +17 -0
- package/mcp-configs/ai-platform/gptr-mcp.json +17 -0
- package/mcp-configs/browser/decipher-research-agent.json +17 -0
- package/mcp-configs/browser/deep-research.json +17 -0
- package/mcp-configs/browser/everything-claude-code.json +17 -0
- package/mcp-configs/browser/gpt-researcher.json +17 -0
- package/mcp-configs/browser/heurist-agent-framework.json +17 -0
- package/mcp-configs/data-platform/4everland-hosting-mcp.json +17 -0
- package/mcp-configs/data-platform/context-keeper.json +17 -0
- package/mcp-configs/data-platform/context7.json +19 -0
- package/mcp-configs/data-platform/contextstream-mcp.json +17 -0
- package/mcp-configs/data-platform/email-mcp.json +17 -0
- package/mcp-configs/note-knowledge/ApeRAG.json +17 -0
- package/mcp-configs/note-knowledge/In-Memoria.json +17 -0
- package/mcp-configs/note-knowledge/agent-memory.json +17 -0
- package/mcp-configs/note-knowledge/aimemo.json +17 -0
- package/mcp-configs/note-knowledge/biel-mcp.json +19 -0
- package/mcp-configs/note-knowledge/cognee.json +17 -0
- package/mcp-configs/note-knowledge/context-awesome.json +17 -0
- package/mcp-configs/note-knowledge/context-mcp.json +17 -0
- package/mcp-configs/note-knowledge/conversation-handoff-mcp.json +17 -0
- package/mcp-configs/note-knowledge/cortex.json +17 -0
- package/mcp-configs/note-knowledge/devrag.json +17 -0
- package/mcp-configs/note-knowledge/easy-obsidian-mcp.json +17 -0
- package/mcp-configs/note-knowledge/engram.json +17 -0
- package/mcp-configs/note-knowledge/gnosis-mcp.json +17 -0
- package/mcp-configs/note-knowledge/graphlit-mcp-server.json +19 -0
- package/mcp-configs/reference-mgr/arxiv-cli.json +17 -0
- package/mcp-configs/reference-mgr/arxiv-search-mcp.json +17 -0
- package/mcp-configs/reference-mgr/chiken.json +17 -0
- package/mcp-configs/reference-mgr/claude-scholar.json +17 -0
- package/mcp-configs/reference-mgr/devonthink-mcp.json +17 -0
- package/mcp-configs/registry.json +447 -0
- package/openclaw.plugin.json +21 -0
- package/package.json +61 -0
- package/skills/analysis/dataviz/color-accessibility-guide/SKILL.md +230 -0
- package/skills/analysis/dataviz/geospatial-viz-guide/SKILL.md +218 -0
- package/skills/analysis/dataviz/interactive-viz-guide/SKILL.md +287 -0
- package/skills/analysis/dataviz/network-visualization-guide/SKILL.md +195 -0
- package/skills/analysis/dataviz/publication-figures-guide/SKILL.md +238 -0
- package/skills/analysis/dataviz/python-dataviz-guide/SKILL.md +195 -0
- package/skills/analysis/econometrics/causal-inference-guide/SKILL.md +197 -0
- package/skills/analysis/econometrics/iv-regression-guide/SKILL.md +198 -0
- package/skills/analysis/econometrics/panel-data-guide/SKILL.md +274 -0
- package/skills/analysis/econometrics/robustness-checks/SKILL.md +250 -0
- package/skills/analysis/econometrics/stata-regression/SKILL.md +117 -0
- package/skills/analysis/econometrics/time-series-guide/SKILL.md +235 -0
- package/skills/analysis/statistics/bayesian-statistics-guide/SKILL.md +221 -0
- package/skills/analysis/statistics/hypothesis-testing-guide/SKILL.md +210 -0
- package/skills/analysis/statistics/meta-analysis-guide/SKILL.md +206 -0
- package/skills/analysis/statistics/nonparametric-tests-guide/SKILL.md +221 -0
- package/skills/analysis/statistics/power-analysis-guide/SKILL.md +240 -0
- package/skills/analysis/statistics/sem-guide/SKILL.md +231 -0
- package/skills/analysis/statistics/survival-analysis-guide/SKILL.md +195 -0
- package/skills/analysis/wrangling/missing-data-handling/SKILL.md +224 -0
- package/skills/analysis/wrangling/pandas-data-wrangling/SKILL.md +242 -0
- package/skills/analysis/wrangling/questionnaire-design-guide/SKILL.md +234 -0
- package/skills/analysis/wrangling/text-mining-guide/SKILL.md +225 -0
- package/skills/domains/ai-ml/computer-vision-guide/SKILL.md +213 -0
- package/skills/domains/ai-ml/deep-learning-papers-guide/SKILL.md +200 -0
- package/skills/domains/ai-ml/llm-evaluation-guide/SKILL.md +194 -0
- package/skills/domains/ai-ml/prompt-engineering-research/SKILL.md +233 -0
- package/skills/domains/ai-ml/reinforcement-learning-guide/SKILL.md +254 -0
- package/skills/domains/ai-ml/transformer-architecture-guide/SKILL.md +233 -0
- package/skills/domains/biomedical/clinical-research-guide/SKILL.md +232 -0
- package/skills/domains/biomedical/clinicaltrials-api/SKILL.md +177 -0
- package/skills/domains/biomedical/epidemiology-guide/SKILL.md +200 -0
- package/skills/domains/biomedical/genomics-analysis-guide/SKILL.md +270 -0
- package/skills/domains/business/market-analysis-guide/SKILL.md +112 -0
- package/skills/domains/business/strategic-management-guide/SKILL.md +154 -0
- package/skills/domains/chemistry/computational-chemistry-guide/SKILL.md +266 -0
- package/skills/domains/chemistry/retrosynthesis-guide/SKILL.md +215 -0
- package/skills/domains/cs/algorithms-complexity-guide/SKILL.md +194 -0
- package/skills/domains/cs/dblp-api/SKILL.md +129 -0
- package/skills/domains/cs/software-engineering-research/SKILL.md +218 -0
- package/skills/domains/ecology/biodiversity-data-guide/SKILL.md +296 -0
- package/skills/domains/ecology/conservation-biology-guide/SKILL.md +198 -0
- package/skills/domains/ecology/gbif-api/SKILL.md +158 -0
- package/skills/domains/ecology/inaturalist-api/SKILL.md +173 -0
- package/skills/domains/economics/behavioral-economics-guide/SKILL.md +239 -0
- package/skills/domains/economics/development-economics-guide/SKILL.md +181 -0
- package/skills/domains/economics/fred-api/SKILL.md +189 -0
- package/skills/domains/education/curriculum-design-guide/SKILL.md +144 -0
- package/skills/domains/education/learning-science-guide/SKILL.md +150 -0
- package/skills/domains/finance/financial-data-analysis/SKILL.md +152 -0
- package/skills/domains/finance/quantitative-finance-guide/SKILL.md +151 -0
- package/skills/domains/geoscience/climate-science-guide/SKILL.md +158 -0
- package/skills/domains/geoscience/gis-remote-sensing-guide/SKILL.md +129 -0
- package/skills/domains/humanities/digital-humanities-guide/SKILL.md +181 -0
- package/skills/domains/humanities/philosophy-research-guide/SKILL.md +148 -0
- package/skills/domains/law/courtlistener-api/SKILL.md +213 -0
- package/skills/domains/law/legal-research-guide/SKILL.md +250 -0
- package/skills/domains/math/linear-algebra-applications/SKILL.md +227 -0
- package/skills/domains/math/numerical-methods-guide/SKILL.md +236 -0
- package/skills/domains/math/oeis-api/SKILL.md +158 -0
- package/skills/domains/pharma/clinical-pharmacology-guide/SKILL.md +165 -0
- package/skills/domains/pharma/drug-development-guide/SKILL.md +177 -0
- package/skills/domains/physics/computational-physics-guide/SKILL.md +300 -0
- package/skills/domains/physics/nasa-ads-api/SKILL.md +150 -0
- package/skills/domains/physics/quantum-computing-guide/SKILL.md +234 -0
- package/skills/domains/social-science/social-research-methods/SKILL.md +194 -0
- package/skills/domains/social-science/survey-research-guide/SKILL.md +182 -0
- package/skills/literature/discovery/citation-alert-guide/SKILL.md +154 -0
- package/skills/literature/discovery/conference-proceedings-guide/SKILL.md +142 -0
- package/skills/literature/discovery/literature-mapping-guide/SKILL.md +175 -0
- package/skills/literature/discovery/paper-tracking-guide/SKILL.md +211 -0
- package/skills/literature/discovery/rss-paper-feeds/SKILL.md +214 -0
- package/skills/literature/discovery/semantic-scholar-recs-guide/SKILL.md +164 -0
- package/skills/literature/fulltext/doaj-api/SKILL.md +120 -0
- package/skills/literature/fulltext/interlibrary-loan-guide/SKILL.md +163 -0
- package/skills/literature/fulltext/open-access-guide/SKILL.md +183 -0
- package/skills/literature/fulltext/pmc-oai-api/SKILL.md +184 -0
- package/skills/literature/fulltext/preprint-servers-guide/SKILL.md +128 -0
- package/skills/literature/fulltext/repository-harvesting-guide/SKILL.md +207 -0
- package/skills/literature/fulltext/unpaywall-api/SKILL.md +113 -0
- package/skills/literature/metadata/altmetrics-guide/SKILL.md +132 -0
- package/skills/literature/metadata/citation-network-guide/SKILL.md +236 -0
- package/skills/literature/metadata/crossref-api/SKILL.md +133 -0
- package/skills/literature/metadata/datacite-api/SKILL.md +126 -0
- package/skills/literature/metadata/doi-resolution-guide/SKILL.md +168 -0
- package/skills/literature/metadata/h-index-guide/SKILL.md +183 -0
- package/skills/literature/metadata/journal-metrics-guide/SKILL.md +188 -0
- package/skills/literature/metadata/opencitations-api/SKILL.md +128 -0
- package/skills/literature/metadata/orcid-api/SKILL.md +136 -0
- package/skills/literature/metadata/orcid-integration-guide/SKILL.md +178 -0
- package/skills/literature/search/arxiv-api/SKILL.md +95 -0
- package/skills/literature/search/biorxiv-api/SKILL.md +123 -0
- package/skills/literature/search/boolean-search-guide/SKILL.md +199 -0
- package/skills/literature/search/citation-chaining-guide/SKILL.md +148 -0
- package/skills/literature/search/database-comparison-guide/SKILL.md +100 -0
- package/skills/literature/search/europe-pmc-api/SKILL.md +120 -0
- package/skills/literature/search/google-scholar-guide/SKILL.md +182 -0
- package/skills/literature/search/mesh-terms-guide/SKILL.md +164 -0
- package/skills/literature/search/openalex-api/SKILL.md +134 -0
- package/skills/literature/search/pubmed-api/SKILL.md +130 -0
- package/skills/literature/search/scientify-literature-survey/SKILL.md +203 -0
- package/skills/literature/search/semantic-scholar-api/SKILL.md +134 -0
- package/skills/literature/search/systematic-search-strategy/SKILL.md +214 -0
- package/skills/research/automation/ai-scientist-guide/SKILL.md +228 -0
- package/skills/research/automation/data-collection-automation/SKILL.md +248 -0
- package/skills/research/automation/research-workflow-automation/SKILL.md +266 -0
- package/skills/research/deep-research/meta-synthesis-guide/SKILL.md +174 -0
- package/skills/research/deep-research/research-cog/SKILL.md +153 -0
- package/skills/research/deep-research/scoping-review-guide/SKILL.md +217 -0
- package/skills/research/deep-research/systematic-review-guide/SKILL.md +250 -0
- package/skills/research/funding/figshare-api/SKILL.md +163 -0
- package/skills/research/funding/grant-writing-guide/SKILL.md +233 -0
- package/skills/research/funding/nsf-grant-guide/SKILL.md +206 -0
- package/skills/research/funding/open-science-guide/SKILL.md +255 -0
- package/skills/research/funding/zenodo-api/SKILL.md +174 -0
- package/skills/research/methodology/action-research-guide/SKILL.md +201 -0
- package/skills/research/methodology/experimental-design-guide/SKILL.md +236 -0
- package/skills/research/methodology/grad-school-guide/SKILL.md +182 -0
- package/skills/research/methodology/grounded-theory-guide/SKILL.md +171 -0
- package/skills/research/methodology/mixed-methods-guide/SKILL.md +208 -0
- package/skills/research/methodology/qualitative-research-guide/SKILL.md +234 -0
- package/skills/research/methodology/scientify-idea-generation/SKILL.md +222 -0
- package/skills/research/paper-review/paper-reading-assistant/SKILL.md +266 -0
- package/skills/research/paper-review/peer-review-guide/SKILL.md +227 -0
- package/skills/research/paper-review/rebuttal-writing-guide/SKILL.md +185 -0
- package/skills/research/paper-review/scientify-write-review-paper/SKILL.md +209 -0
- package/skills/tools/code-exec/jupyter-notebook-guide/SKILL.md +178 -0
- package/skills/tools/code-exec/python-reproducibility-guide/SKILL.md +341 -0
- package/skills/tools/code-exec/r-reproducibility-guide/SKILL.md +236 -0
- package/skills/tools/code-exec/sandbox-execution-guide/SKILL.md +221 -0
- package/skills/tools/diagram/mermaid-diagram-guide/SKILL.md +269 -0
- package/skills/tools/diagram/plantuml-guide/SKILL.md +397 -0
- package/skills/tools/diagram/scientific-illustration-guide/SKILL.md +225 -0
- package/skills/tools/document/anystyle-api/SKILL.md +199 -0
- package/skills/tools/document/grobid-pdf-parsing/SKILL.md +294 -0
- package/skills/tools/document/markdown-academic-guide/SKILL.md +217 -0
- package/skills/tools/document/pdf-extraction-guide/SKILL.md +321 -0
- package/skills/tools/knowledge-graph/knowledge-graph-construction/SKILL.md +306 -0
- package/skills/tools/knowledge-graph/ontology-design-guide/SKILL.md +214 -0
- package/skills/tools/knowledge-graph/rag-methodology-guide/SKILL.md +325 -0
- package/skills/tools/ocr-translate/formula-recognition-guide/SKILL.md +367 -0
- package/skills/tools/ocr-translate/handwriting-recognition-guide/SKILL.md +211 -0
- package/skills/tools/ocr-translate/latex-ocr-guide/SKILL.md +204 -0
- package/skills/tools/ocr-translate/multilingual-research-guide/SKILL.md +234 -0
- package/skills/tools/scraping/academic-web-scraping/SKILL.md +326 -0
- package/skills/tools/scraping/api-data-collection-guide/SKILL.md +301 -0
- package/skills/tools/scraping/web-scraping-ethics-guide/SKILL.md +250 -0
- package/skills/writing/citation/bibtex-management-guide/SKILL.md +246 -0
- package/skills/writing/citation/citation-style-guide/SKILL.md +248 -0
- package/skills/writing/citation/reference-manager-comparison/SKILL.md +208 -0
- package/skills/writing/citation/zotero-api/SKILL.md +188 -0
- package/skills/writing/composition/abstract-writing-guide/SKILL.md +188 -0
- package/skills/writing/composition/discussion-writing-guide/SKILL.md +194 -0
- package/skills/writing/composition/introduction-writing-guide/SKILL.md +194 -0
- package/skills/writing/composition/literature-review-writing/SKILL.md +196 -0
- package/skills/writing/composition/methods-section-guide/SKILL.md +185 -0
- package/skills/writing/composition/response-to-reviewers/SKILL.md +215 -0
- package/skills/writing/composition/scientific-writing-guide/SKILL.md +152 -0
- package/skills/writing/latex/bibliography-management-guide/SKILL.md +206 -0
- package/skills/writing/latex/latex-drawing-guide/SKILL.md +234 -0
- package/skills/writing/latex/latex-ecosystem-guide/SKILL.md +240 -0
- package/skills/writing/latex/math-typesetting-guide/SKILL.md +231 -0
- package/skills/writing/latex/overleaf-collaboration-guide/SKILL.md +211 -0
- package/skills/writing/latex/tikz-diagrams-guide/SKILL.md +211 -0
- package/skills/writing/polish/academic-translation-guide/SKILL.md +175 -0
- package/skills/writing/polish/academic-writing-refiner/SKILL.md +143 -0
- package/skills/writing/polish/ai-writing-humanizer/SKILL.md +178 -0
- package/skills/writing/polish/grammar-checker-guide/SKILL.md +184 -0
- package/skills/writing/polish/plagiarism-detection-guide/SKILL.md +167 -0
- package/skills/writing/templates/beamer-presentation-guide/SKILL.md +263 -0
- package/skills/writing/templates/conference-paper-template/SKILL.md +219 -0
- package/skills/writing/templates/thesis-template-guide/SKILL.md +200 -0
- package/skills/writing/templates/thesis-writing-guide/SKILL.md +220 -0
- package/src/tools/arxiv.ts +131 -0
- package/src/tools/crossref.ts +112 -0
- package/src/tools/openalex.ts +174 -0
- package/src/tools/pubmed.ts +166 -0
- package/src/tools/semantic-scholar.ts +108 -0
- package/src/tools/unpaywall.ts +58 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: linear-algebra-applications
|
|
3
|
+
description: "Apply linear algebra concepts to research computing and data analysis"
|
|
4
|
+
metadata:
|
|
5
|
+
openclaw:
|
|
6
|
+
emoji: "1234"
|
|
7
|
+
category: "domains"
|
|
8
|
+
subcategory: "math"
|
|
9
|
+
keywords: ["linear algebra", "matrix decomposition", "SVD", "eigenvalues", "PCA", "numerical computing"]
|
|
10
|
+
source: "wentor-research-plugins"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Applied Linear Algebra for Research
|
|
14
|
+
|
|
15
|
+
A skill for applying linear algebra to research computing, data analysis, and scientific modeling. Covers matrix decompositions, eigenvalue problems, least squares, dimensionality reduction, and practical implementation in NumPy/SciPy.
|
|
16
|
+
|
|
17
|
+
## Essential Operations
|
|
18
|
+
|
|
19
|
+
### Matrix Multiplication and Solving Systems
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import numpy as np
|
|
23
|
+
from scipy import linalg
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def solve_linear_system(A: np.ndarray, b: np.ndarray) -> dict:
|
|
27
|
+
"""
|
|
28
|
+
Solve Ax = b and analyze the system.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
A: Coefficient matrix (n x n)
|
|
32
|
+
b: Right-hand side vector (n,)
|
|
33
|
+
"""
|
|
34
|
+
n = A.shape[0]
|
|
35
|
+
|
|
36
|
+
# Check condition number (sensitivity to perturbations)
|
|
37
|
+
cond = np.linalg.cond(A)
|
|
38
|
+
|
|
39
|
+
result = {
|
|
40
|
+
"shape": A.shape,
|
|
41
|
+
"rank": np.linalg.matrix_rank(A),
|
|
42
|
+
"condition_number": cond,
|
|
43
|
+
"well_conditioned": cond < 1e10,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if result["rank"] == n:
|
|
47
|
+
x = np.linalg.solve(A, b)
|
|
48
|
+
result["solution"] = x
|
|
49
|
+
result["residual_norm"] = np.linalg.norm(A @ x - b)
|
|
50
|
+
else:
|
|
51
|
+
# Underdetermined or singular -- use least-squares
|
|
52
|
+
x, residuals, rank, sv = np.linalg.lstsq(A, b, rcond=None)
|
|
53
|
+
result["least_squares_solution"] = x
|
|
54
|
+
result["note"] = "System is rank-deficient; least-squares solution returned"
|
|
55
|
+
|
|
56
|
+
return result
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Matrix Decompositions
|
|
60
|
+
|
|
61
|
+
### LU Decomposition (Solving Multiple Systems)
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
def lu_factorization(A: np.ndarray) -> dict:
|
|
65
|
+
"""
|
|
66
|
+
LU decomposition for efficiently solving Ax=b for multiple b.
|
|
67
|
+
"""
|
|
68
|
+
P, L, U = linalg.lu(A)
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
"P": P, # Permutation matrix
|
|
72
|
+
"L": L, # Lower triangular
|
|
73
|
+
"U": U, # Upper triangular
|
|
74
|
+
"usage": (
|
|
75
|
+
"Once computed, solve for any new right-hand side b "
|
|
76
|
+
"in O(n^2) instead of O(n^3). Use scipy.linalg.lu_solve()."
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Singular Value Decomposition (SVD)
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
def svd_analysis(A: np.ndarray) -> dict:
|
|
85
|
+
"""
|
|
86
|
+
SVD of matrix A = U S V^T and its applications.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
A: Input matrix (m x n)
|
|
90
|
+
"""
|
|
91
|
+
U, s, Vt = np.linalg.svd(A, full_matrices=False)
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
"U_shape": U.shape, # Left singular vectors (m x k)
|
|
95
|
+
"singular_values": s, # Sorted descending
|
|
96
|
+
"Vt_shape": Vt.shape, # Right singular vectors (k x n)
|
|
97
|
+
"rank": np.sum(s > 1e-10),
|
|
98
|
+
"condition_number": s[0] / s[-1] if s[-1] > 0 else float("inf"),
|
|
99
|
+
"energy_ratio": np.cumsum(s ** 2) / np.sum(s ** 2),
|
|
100
|
+
"applications": [
|
|
101
|
+
"Low-rank approximation (truncated SVD)",
|
|
102
|
+
"Principal Component Analysis (PCA)",
|
|
103
|
+
"Pseudoinverse computation",
|
|
104
|
+
"Latent Semantic Analysis (LSA) in text mining",
|
|
105
|
+
"Image compression",
|
|
106
|
+
"Noise reduction"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Eigendecomposition
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
def eigen_analysis(A: np.ndarray) -> dict:
|
|
115
|
+
"""
|
|
116
|
+
Eigenvalue decomposition of a square matrix.
|
|
117
|
+
"""
|
|
118
|
+
eigenvalues, eigenvectors = np.linalg.eig(A)
|
|
119
|
+
|
|
120
|
+
# Sort by magnitude
|
|
121
|
+
idx = np.argsort(np.abs(eigenvalues))[::-1]
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
"eigenvalues": eigenvalues[idx],
|
|
125
|
+
"eigenvectors": eigenvectors[:, idx],
|
|
126
|
+
"is_symmetric": np.allclose(A, A.T),
|
|
127
|
+
"is_positive_definite": (
|
|
128
|
+
np.all(np.real(eigenvalues) > 0)
|
|
129
|
+
if np.allclose(A, A.T) else "N/A (not symmetric)"
|
|
130
|
+
),
|
|
131
|
+
"spectral_radius": np.max(np.abs(eigenvalues)),
|
|
132
|
+
"trace_check": (
|
|
133
|
+
f"Sum of eigenvalues: {np.sum(eigenvalues):.4f}, "
|
|
134
|
+
f"Trace of A: {np.trace(A):.4f}"
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Research Applications
|
|
140
|
+
|
|
141
|
+
### Principal Component Analysis
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
def pca_from_scratch(X: np.ndarray, n_components: int = 2) -> dict:
|
|
145
|
+
"""
|
|
146
|
+
PCA using eigendecomposition of the covariance matrix.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
X: Data matrix (n_samples x n_features), centered
|
|
150
|
+
n_components: Number of principal components to retain
|
|
151
|
+
"""
|
|
152
|
+
# Center the data
|
|
153
|
+
X_centered = X - X.mean(axis=0)
|
|
154
|
+
|
|
155
|
+
# Covariance matrix
|
|
156
|
+
C = np.cov(X_centered, rowvar=False)
|
|
157
|
+
|
|
158
|
+
# Eigendecomposition (symmetric matrix -> use eigh for stability)
|
|
159
|
+
eigenvalues, eigenvectors = np.linalg.eigh(C)
|
|
160
|
+
|
|
161
|
+
# Sort descending
|
|
162
|
+
idx = np.argsort(eigenvalues)[::-1]
|
|
163
|
+
eigenvalues = eigenvalues[idx]
|
|
164
|
+
eigenvectors = eigenvectors[:, idx]
|
|
165
|
+
|
|
166
|
+
# Select top components
|
|
167
|
+
components = eigenvectors[:, :n_components]
|
|
168
|
+
explained_variance = eigenvalues[:n_components]
|
|
169
|
+
total_variance = eigenvalues.sum()
|
|
170
|
+
|
|
171
|
+
# Project data
|
|
172
|
+
X_projected = X_centered @ components
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
"components": components,
|
|
176
|
+
"explained_variance_ratio": explained_variance / total_variance,
|
|
177
|
+
"cumulative_variance": np.cumsum(explained_variance) / total_variance,
|
|
178
|
+
"projected_data": X_projected
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Least Squares Regression
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
def least_squares_fit(X: np.ndarray, y: np.ndarray) -> dict:
|
|
186
|
+
"""
|
|
187
|
+
Solve the normal equations: beta = (X^T X)^{-1} X^T y
|
|
188
|
+
"""
|
|
189
|
+
# Using the numerically stable QR decomposition
|
|
190
|
+
Q, R = np.linalg.qr(X)
|
|
191
|
+
beta = linalg.solve_triangular(R, Q.T @ y)
|
|
192
|
+
|
|
193
|
+
y_hat = X @ beta
|
|
194
|
+
residuals = y - y_hat
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
"coefficients": beta,
|
|
198
|
+
"r_squared": 1 - np.sum(residuals ** 2) / np.sum((y - y.mean()) ** 2),
|
|
199
|
+
"residual_norm": np.linalg.norm(residuals),
|
|
200
|
+
"method": "QR decomposition (more stable than normal equations)"
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Numerical Stability
|
|
205
|
+
|
|
206
|
+
### Best Practices
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
1. Avoid explicitly computing matrix inverses:
|
|
210
|
+
BAD: x = np.linalg.inv(A) @ b
|
|
211
|
+
GOOD: x = np.linalg.solve(A, b)
|
|
212
|
+
|
|
213
|
+
2. Use specialized routines for structured matrices:
|
|
214
|
+
- Symmetric positive definite: Cholesky (linalg.cho_solve)
|
|
215
|
+
- Sparse: scipy.sparse.linalg.spsolve
|
|
216
|
+
- Banded: scipy.linalg.solve_banded
|
|
217
|
+
|
|
218
|
+
3. Check condition numbers before solving:
|
|
219
|
+
- cond(A) > 10^10 suggests the solution may be unreliable
|
|
220
|
+
- Consider regularization (Tikhonov/ridge) for ill-conditioned systems
|
|
221
|
+
|
|
222
|
+
4. Use appropriate precision:
|
|
223
|
+
- float64 for most research computing
|
|
224
|
+
- float32 for large-scale GPU computations (monitor for precision loss)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
When working with very large matrices, leverage sparse matrix representations (scipy.sparse), iterative solvers (conjugate gradient, GMRES), and randomized algorithms (randomized SVD) to keep computation tractable.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: numerical-methods-guide
|
|
3
|
+
description: "Apply numerical methods and scientific computing techniques"
|
|
4
|
+
metadata:
|
|
5
|
+
openclaw:
|
|
6
|
+
emoji: "abacus"
|
|
7
|
+
category: "domains"
|
|
8
|
+
subcategory: "math"
|
|
9
|
+
keywords: ["numerical methods", "scientific computing", "ODE solver", "optimization", "interpolation", "finite differences"]
|
|
10
|
+
source: "wentor-research-plugins"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Numerical Methods Guide
|
|
14
|
+
|
|
15
|
+
A skill for applying numerical methods in scientific computing and research. Covers root finding, numerical integration, ODE solvers, optimization, interpolation, and error analysis with practical implementations in Python.
|
|
16
|
+
|
|
17
|
+
## Root Finding
|
|
18
|
+
|
|
19
|
+
### Newton's Method and Alternatives
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import numpy as np
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def newton_method(f, df, x0: float, tol: float = 1e-10,
|
|
26
|
+
max_iter: int = 100) -> dict:
|
|
27
|
+
"""
|
|
28
|
+
Newton's method for finding roots of f(x) = 0.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
f: Function whose root we seek
|
|
32
|
+
df: Derivative of f
|
|
33
|
+
x0: Initial guess
|
|
34
|
+
tol: Convergence tolerance
|
|
35
|
+
max_iter: Maximum iterations
|
|
36
|
+
"""
|
|
37
|
+
x = x0
|
|
38
|
+
history = [x]
|
|
39
|
+
|
|
40
|
+
for i in range(max_iter):
|
|
41
|
+
fx = f(x)
|
|
42
|
+
dfx = df(x)
|
|
43
|
+
|
|
44
|
+
if abs(dfx) < 1e-15:
|
|
45
|
+
return {"root": x, "converged": False,
|
|
46
|
+
"reason": "Zero derivative encountered"}
|
|
47
|
+
|
|
48
|
+
x_new = x - fx / dfx
|
|
49
|
+
history.append(x_new)
|
|
50
|
+
|
|
51
|
+
if abs(x_new - x) < tol:
|
|
52
|
+
return {
|
|
53
|
+
"root": x_new,
|
|
54
|
+
"converged": True,
|
|
55
|
+
"iterations": i + 1,
|
|
56
|
+
"f_at_root": f(x_new),
|
|
57
|
+
"convergence": "quadratic"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
x = x_new
|
|
61
|
+
|
|
62
|
+
return {"root": x, "converged": False, "reason": "Max iterations reached"}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Method Selection Guide
|
|
66
|
+
|
|
67
|
+
| Method | Convergence | Requires | Robustness |
|
|
68
|
+
|--------|------------|----------|-----------|
|
|
69
|
+
| Bisection | Linear (slow) | Bracketing interval | Very robust |
|
|
70
|
+
| Newton | Quadratic (fast) | Derivative | May diverge |
|
|
71
|
+
| Secant | Superlinear (~1.62) | Two initial guesses | Moderate |
|
|
72
|
+
| Brent | Superlinear | Bracketing interval | Very robust |
|
|
73
|
+
|
|
74
|
+
## Numerical Integration
|
|
75
|
+
|
|
76
|
+
### Quadrature Methods
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from scipy import integrate
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def numerical_integration_comparison(f, a: float, b: float) -> dict:
|
|
83
|
+
"""
|
|
84
|
+
Compare numerical integration methods.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
f: Function to integrate
|
|
88
|
+
a: Lower bound
|
|
89
|
+
b: Upper bound
|
|
90
|
+
"""
|
|
91
|
+
# Adaptive Gaussian quadrature (recommended default)
|
|
92
|
+
quad_result, quad_error = integrate.quad(f, a, b)
|
|
93
|
+
|
|
94
|
+
# Simpson's rule (fixed-point)
|
|
95
|
+
n_points = 101
|
|
96
|
+
x = np.linspace(a, b, n_points)
|
|
97
|
+
simps_result = integrate.simpson(f(x), x=x)
|
|
98
|
+
|
|
99
|
+
# Romberg integration
|
|
100
|
+
romb_result = integrate.romberg(f, a, b)
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
"quad": {"value": quad_result, "error_estimate": quad_error},
|
|
104
|
+
"simpson": {"value": simps_result, "n_points": n_points},
|
|
105
|
+
"romberg": {"value": romb_result},
|
|
106
|
+
"recommendation": (
|
|
107
|
+
"Use scipy.integrate.quad for most cases. "
|
|
108
|
+
"It adaptively chooses points for accuracy."
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Ordinary Differential Equations
|
|
114
|
+
|
|
115
|
+
### Solving Initial Value Problems
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from scipy.integrate import solve_ivp
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def solve_ode_system(f, t_span: tuple, y0: list,
|
|
122
|
+
method: str = "RK45") -> dict:
|
|
123
|
+
"""
|
|
124
|
+
Solve a system of ODEs: dy/dt = f(t, y).
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
f: Right-hand side function f(t, y)
|
|
128
|
+
t_span: (t_start, t_end)
|
|
129
|
+
y0: Initial conditions
|
|
130
|
+
method: Solver method (RK45, RK23, Radau, BDF, LSODA)
|
|
131
|
+
"""
|
|
132
|
+
sol = solve_ivp(
|
|
133
|
+
f, t_span, y0,
|
|
134
|
+
method=method,
|
|
135
|
+
dense_output=True,
|
|
136
|
+
rtol=1e-8,
|
|
137
|
+
atol=1e-10
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
"success": sol.success,
|
|
142
|
+
"message": sol.message,
|
|
143
|
+
"t": sol.t,
|
|
144
|
+
"y": sol.y,
|
|
145
|
+
"n_evaluations": sol.nfev,
|
|
146
|
+
"method_used": method
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Example: Lorenz system (chaotic dynamics)
|
|
151
|
+
def lorenz(t, state, sigma=10, rho=28, beta=8/3):
|
|
152
|
+
x, y, z = state
|
|
153
|
+
return [
|
|
154
|
+
sigma * (y - x),
|
|
155
|
+
x * (rho - z) - y,
|
|
156
|
+
x * y - beta * z
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
result = solve_ode_system(lorenz, (0, 50), [1.0, 1.0, 1.0])
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Solver Selection
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Non-stiff problems:
|
|
166
|
+
RK45 (default): 4th/5th order Runge-Kutta, adaptive step
|
|
167
|
+
RK23: Lower order, useful for less smooth problems
|
|
168
|
+
DOP853: High-order, excellent for smooth problems
|
|
169
|
+
|
|
170
|
+
Stiff problems:
|
|
171
|
+
Radau: Implicit Runge-Kutta, good for stiff systems
|
|
172
|
+
BDF: Backward differentiation formula (classic stiff solver)
|
|
173
|
+
LSODA: Automatically switches between non-stiff and stiff
|
|
174
|
+
|
|
175
|
+
How to tell if your problem is stiff:
|
|
176
|
+
- RK45 takes many tiny steps or fails to converge
|
|
177
|
+
- The system has widely separated time scales
|
|
178
|
+
- Chemical kinetics, circuit simulations often stiff
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Optimization
|
|
182
|
+
|
|
183
|
+
### Minimization Methods
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from scipy.optimize import minimize
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def optimize_with_comparison(f, x0: np.ndarray,
|
|
190
|
+
bounds: list = None) -> dict:
|
|
191
|
+
"""
|
|
192
|
+
Compare optimization methods on a given objective function.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
f: Objective function to minimize
|
|
196
|
+
x0: Initial guess
|
|
197
|
+
bounds: List of (min, max) tuples for each variable
|
|
198
|
+
"""
|
|
199
|
+
results = {}
|
|
200
|
+
|
|
201
|
+
# Gradient-free
|
|
202
|
+
res_nm = minimize(f, x0, method="Nelder-Mead")
|
|
203
|
+
results["Nelder-Mead"] = {"x": res_nm.x, "fun": res_nm.fun,
|
|
204
|
+
"nfev": res_nm.nfev}
|
|
205
|
+
|
|
206
|
+
# Gradient-based (quasi-Newton)
|
|
207
|
+
res_bfgs = minimize(f, x0, method="L-BFGS-B", bounds=bounds)
|
|
208
|
+
results["L-BFGS-B"] = {"x": res_bfgs.x, "fun": res_bfgs.fun,
|
|
209
|
+
"nfev": res_bfgs.nfev}
|
|
210
|
+
|
|
211
|
+
return results
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Error Analysis
|
|
215
|
+
|
|
216
|
+
### Sources of Numerical Error
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
1. Rounding error:
|
|
220
|
+
Finite precision arithmetic (float64 has ~16 significant digits)
|
|
221
|
+
Accumulates in long computations
|
|
222
|
+
|
|
223
|
+
2. Truncation error:
|
|
224
|
+
Error from approximating continuous math with discrete formulas
|
|
225
|
+
Example: Finite difference df/dx ~ (f(x+h) - f(x)) / h
|
|
226
|
+
|
|
227
|
+
3. Conditioning:
|
|
228
|
+
Sensitivity of the result to perturbations in input
|
|
229
|
+
Condition number quantifies this amplification
|
|
230
|
+
|
|
231
|
+
Best practice: Always compare your numerical solution against
|
|
232
|
+
analytical solutions (when available) or use convergence studies
|
|
233
|
+
(refine the discretization and check if the answer converges).
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
When publishing numerical results, report the method used, convergence criteria, error tolerances, grid resolution (for PDEs), and validate against known test cases. Provide code so readers can reproduce your computations.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oeis-api
|
|
3
|
+
description: "On-Line Encyclopedia of Integer Sequences API"
|
|
4
|
+
metadata:
|
|
5
|
+
openclaw:
|
|
6
|
+
emoji: "🔍"
|
|
7
|
+
category: "domains"
|
|
8
|
+
subcategory: "math"
|
|
9
|
+
keywords: ["number theory", "algebra", "probability theory", "applied mathematics"]
|
|
10
|
+
source: "https://oeis.org/eishelp1.html"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# OEIS API Guide
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
The On-Line Encyclopedia of Integer Sequences (OEIS) is a comprehensive database of integer sequences, founded by Neil Sloane in 1964 and now containing over 370,000 entries. It is one of the most widely cited resources in mathematics, serving as the definitive reference for identifying, cataloging, and exploring integer sequences that arise in combinatorics, number theory, algebra, analysis, and applied mathematics.
|
|
18
|
+
|
|
19
|
+
The OEIS provides a web-accessible search interface that can also be used programmatically to query sequences by their terms, by A-number (the unique identifier for each sequence), or by keyword. The API returns structured data in JSON or plain text format, including the sequence terms, formulas, generating functions, references, links to related sequences, and contributed programs in various languages.
|
|
20
|
+
|
|
21
|
+
Mathematicians, computer scientists, physicists, and researchers in any quantitative discipline use the OEIS to identify unknown sequences encountered in their work, verify conjectures, discover connections between different areas of mathematics, and access formulas and programs for computing sequence terms. It is an indispensable tool for both pure and applied mathematical research.
|
|
22
|
+
|
|
23
|
+
## Authentication
|
|
24
|
+
|
|
25
|
+
No authentication required. The OEIS is a free, open resource that does not require any API key, token, or registration. All queries are publicly accessible. The OEIS Foundation operates as a non-profit and relies on voluntary contributions.
|
|
26
|
+
|
|
27
|
+
## Core Endpoints
|
|
28
|
+
|
|
29
|
+
### search: Search for Sequences
|
|
30
|
+
|
|
31
|
+
Search the OEIS database by sequence terms, keywords, A-number, or author name. This is the primary endpoint for querying the encyclopedia.
|
|
32
|
+
|
|
33
|
+
- **URL**: `GET https://oeis.org/search`
|
|
34
|
+
- **Parameters**:
|
|
35
|
+
|
|
36
|
+
| Parameter | Type | Required | Description |
|
|
37
|
+
|-----------|--------|----------|---------------------------------------------------------------|
|
|
38
|
+
| q | string | Yes | Search query: sequence terms (comma-separated), keyword, or A-number |
|
|
39
|
+
| fmt | string | No | Output format: `json`, `text`, `html` (default) |
|
|
40
|
+
| start | int | No | Offset for pagination (default 0) |
|
|
41
|
+
|
|
42
|
+
- **Example**:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Search by sequence terms
|
|
46
|
+
curl "https://oeis.org/search?q=1,1,2,3,5,8,13,21&fmt=json"
|
|
47
|
+
|
|
48
|
+
# Search by A-number
|
|
49
|
+
curl "https://oeis.org/search?q=A000045&fmt=json"
|
|
50
|
+
|
|
51
|
+
# Search by keyword
|
|
52
|
+
curl "https://oeis.org/search?q=catalan+numbers&fmt=json"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- **Response**: Returns a JSON object with `count` (total results), `start`, and `results` array. Each result contains `number` (A-number as integer), `name` (description), `data` (comma-separated terms), `offset`, `formula` (array of formula strings), `comment` (array), `reference` (array of bibliographic references), `link` (array of URLs), `program` (array of code implementations), and `xref` (cross-references to related sequences).
|
|
56
|
+
|
|
57
|
+
### lookup: Direct Sequence Retrieval
|
|
58
|
+
|
|
59
|
+
Retrieve a specific sequence by its A-number directly via the URL path. This provides a simpler access pattern for known sequences.
|
|
60
|
+
|
|
61
|
+
- **URL**: `GET https://oeis.org/A{number}`
|
|
62
|
+
- **Parameters**:
|
|
63
|
+
|
|
64
|
+
| Parameter | Type | Required | Description |
|
|
65
|
+
|-----------|--------|----------|---------------------------------------------------------|
|
|
66
|
+
| number | int | Yes | The sequence A-number (in the URL path) |
|
|
67
|
+
| fmt | string | No | Output format: `json`, `text`, `html` |
|
|
68
|
+
|
|
69
|
+
- **Example**:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Retrieve the Fibonacci sequence (A000045)
|
|
73
|
+
curl "https://oeis.org/A000045?fmt=json"
|
|
74
|
+
|
|
75
|
+
# Retrieve the prime numbers (A000040)
|
|
76
|
+
curl "https://oeis.org/A000040?fmt=json"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- **Response**: Returns the same structured JSON as the search endpoint but for a single sequence, including `number`, `name`, `data`, `formula`, `maple` (Maple code), `mathematica` (Mathematica code), `program` (other language implementations), and `keyword` (classification tags like `nonn`, `easy`, `nice`).
|
|
80
|
+
|
|
81
|
+
## Rate Limits
|
|
82
|
+
|
|
83
|
+
No formal rate limits are published for the OEIS. However, the service is run by a non-profit organization with limited infrastructure. Users should be respectful and avoid sending more than a few requests per second. For bulk data access, the OEIS provides downloadable data files at https://oeis.org/stripped.gz (sequence terms) and https://oeis.org/names.gz (sequence names) which are more appropriate for large-scale analysis.
|
|
84
|
+
|
|
85
|
+
## Common Patterns
|
|
86
|
+
|
|
87
|
+
### Identify an Unknown Sequence
|
|
88
|
+
|
|
89
|
+
When you encounter an integer sequence in your research and want to identify it:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import requests
|
|
93
|
+
|
|
94
|
+
# You found this sequence in your combinatorial analysis
|
|
95
|
+
unknown_terms = "1,4,9,16,25,36,49,64"
|
|
96
|
+
|
|
97
|
+
resp = requests.get("https://oeis.org/search", params={"q": unknown_terms, "fmt": "json"})
|
|
98
|
+
data = resp.json()
|
|
99
|
+
|
|
100
|
+
if data["count"] > 0:
|
|
101
|
+
seq = data["results"][0]
|
|
102
|
+
print(f"A{seq['number']:06d}: {seq['name']}")
|
|
103
|
+
print(f"Terms: {seq['data']}")
|
|
104
|
+
if seq.get("formula"):
|
|
105
|
+
print(f"Formula: {seq['formula'][0]}")
|
|
106
|
+
else:
|
|
107
|
+
print("No matching sequence found in OEIS")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Retrieve Formulas and Programs
|
|
111
|
+
|
|
112
|
+
Get computational formulas and reference implementations for a known sequence:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
import requests
|
|
116
|
+
|
|
117
|
+
# Get the Catalan numbers (A000108)
|
|
118
|
+
resp = requests.get("https://oeis.org/A000108", params={"fmt": "json"})
|
|
119
|
+
data = resp.json()
|
|
120
|
+
seq = data["results"][0]
|
|
121
|
+
|
|
122
|
+
print(f"Sequence: {seq['name']}")
|
|
123
|
+
print(f"\nFirst terms: {seq['data']}")
|
|
124
|
+
|
|
125
|
+
print("\nFormulas:")
|
|
126
|
+
for f in seq.get("formula", [])[:5]:
|
|
127
|
+
print(f" {f}")
|
|
128
|
+
|
|
129
|
+
print("\nPrograms:")
|
|
130
|
+
for p in seq.get("program", [])[:5]:
|
|
131
|
+
print(f" {p}")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Cross-Reference Related Sequences
|
|
135
|
+
|
|
136
|
+
Explore mathematical connections through cross-references:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import requests
|
|
140
|
+
|
|
141
|
+
resp = requests.get("https://oeis.org/search", params={"q": "A000045", "fmt": "json"})
|
|
142
|
+
data = resp.json()
|
|
143
|
+
|
|
144
|
+
if data["results"]:
|
|
145
|
+
seq = data["results"][0]
|
|
146
|
+
print(f"Fibonacci numbers ({seq['name']})")
|
|
147
|
+
print(f"\nCross-references:")
|
|
148
|
+
for xref in seq.get("xref", [])[:10]:
|
|
149
|
+
print(f" {xref}")
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## References
|
|
153
|
+
|
|
154
|
+
- Official help and documentation: https://oeis.org/eishelp1.html
|
|
155
|
+
- OEIS homepage: https://oeis.org/
|
|
156
|
+
- OEIS Wiki: https://oeis.org/wiki/Welcome
|
|
157
|
+
- Downloadable data files: https://oeis.org/stripped.gz
|
|
158
|
+
- OEIS Foundation: https://oeisf.org/
|