Skip to content

Commit 9fae900

Browse files
committed
2 parents 1890ae9 + 25a174e commit 9fae900

11 files changed

Lines changed: 2149 additions & 1074 deletions

File tree

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,37 @@
216216

217217
Note: OEIS lookups require network access to oeis.org.
218218

219+
- **Multi-Index Sequences**: Define sequences with multiple indices like Pascal's
220+
triangle P_{n,k} or grid-based recurrences:
221+
222+
```javascript
223+
// Pascal's Triangle: P_{n,k} = P_{n-1,k-1} + P_{n-1,k}
224+
ce.declareSequence('P', {
225+
variables: ['n', 'k'],
226+
base: { 'n,0': 1, 'n,n': 1 }, // Pattern-based base cases
227+
recurrence: 'P_{n-1,k-1} + P_{n-1,k}',
228+
domain: { n: { min: 0 }, k: { min: 0 } },
229+
constraints: 'k <= n', // k must not exceed n
230+
});
231+
232+
ce.parse('P_{5,2}').evaluate(); // → 10
233+
ce.parse('P_{10,5}').evaluate(); // → 252
234+
```
235+
236+
Features:
237+
- Multiple index variables with `variables: ['n', 'k']`
238+
- Pattern-based base cases: `'n,0'` matches any (n, 0), `'n,n'` matches diagonal
239+
- Per-variable domain constraints
240+
- Constraint expressions (e.g., `'k <= n'`)
241+
- Composite key memoization (e.g., `'5,2'`)
242+
- Full introspection support with `isMultiIndex` flag
243+
244+
Pattern matching for base cases:
245+
- Exact values: `'0,0'` matches only (0, 0)
246+
- Wildcards: `'n,0'` matches any value for n with k=0
247+
- Equality: `'n,n'` matches when both indices are equal
248+
- Priority: exact matches are checked before patterns
249+
219250
#### Special Functions
220251

221252
- **Special Function Definitions**: Added type signatures for special mathematical

package-lock.json

Lines changed: 1 addition & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"jest-silent-reporter": "^0.6.0",
8080
"open": "^10.1.2",
8181
"prettier": "^3.6.2",
82-
"prettier-2": "npm:prettier@^2",
82+
"prettier-2": "npm:prettier@^2.8.8",
8383
"serve-http": "^1.0.7",
8484
"ts-jest": "^29.4.0",
8585
"ts-node": "^10.9.2",

0 commit comments

Comments
 (0)