Skip to content

Commit 7529ab5

Browse files
authored
Merge branch 'main' into claude/complete-task-18-NewVw
2 parents 92a100b + d86e53d commit 7529ab5

3 files changed

Lines changed: 416 additions & 508 deletions

File tree

PLAYGROUND.md

Lines changed: 72 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ This document summarizes the status of various test snippets from
55

66
## Summary
77

8-
| Category | Fixed | Issues Remaining |
9-
| ----------------- | ----- | ---------------- |
10-
| Parsing | 14 | 6 |
11-
| Simplification | 18 | 0 |
12-
| Evaluation | 17 | 1 |
13-
| Solve | 4 | 1 |
14-
| Matrix Operations | 6 | 0 |
15-
| Pattern Matching | 0 | 2 |
16-
| Formatting | 3 | 0 |
17-
| Other | 4 | 1 |
8+
| Category | Fixed | Issues Remaining |
9+
| ---------------- | ----- | ---------------- |
10+
| Parsing | 14 | 6 |
11+
| Simplification | 18 | 0 |
12+
| Evaluation | 17 | 1 |
13+
| Solve | 4 | 1 |
14+
| Pattern Matching | 0 | 2 |
15+
| Formatting | 3 | 0 |
16+
| Other | 4 | 1 |
1817

1918
---
2019

@@ -41,14 +40,14 @@ This document summarizes the status of various test snippets from
4140

4241
### Issues Remaining
4342

44-
| Test | Line | Expected | Actual | Notes |
45-
| ------------------------------------- | ------- | ---------------------- | ------------------------------------- | ----------------------------------- |
46-
| `\textcolor{red}{=}` | 11-12 | Styled equals | `Error('expected-closing-delimiter')` | Cannot style delimiters |
47-
| Double integral parsing | 27-31 | Nested integrals | Complex nested structure | Parses but N() times out |
48-
| `\mathrm{x+\alpha}` | 188 | Symbol with operators | `"xplusalpha"` (loses plus) | Characters merged |
49-
| `\mathrm{\oplus}` | 189 | Valid symbol | Error: invalid-first-char | Cannot use operators in mathrm |
50-
| `\gamma(2, 1)` | 430 | `Gamma(2, 1)` function | `"EulerGamma" * (2, 1)` | Should be incomplete gamma |
51-
| `\sin\left(x\right.` | 645 | Graceful handling | Multiple errors | Missing matchfix handling |
43+
| Test | Line | Expected | Actual | Notes |
44+
| ----------------------- | ----- | ---------------------- | ------------------------------------- | ------------------------------ |
45+
| `\textcolor{red}{=}` | 11-12 | Styled equals | `Error('expected-closing-delimiter')` | Cannot style delimiters |
46+
| Double integral parsing | 27-31 | Nested integrals | Complex nested structure | Parses but N() times out |
47+
| `\mathrm{x+\alpha}` | 188 | Symbol with operators | `"xplusalpha"` (loses plus) | Characters merged |
48+
| `\mathrm{\oplus}` | 189 | Valid symbol | Error: invalid-first-char | Cannot use operators in mathrm |
49+
| `\gamma(2, 1)` | 430 | `Gamma(2, 1)` function | `"EulerGamma" * (2, 1)` | Should be incomplete gamma |
50+
| `\sin\left(x\right.` | 645 | Graceful handling | Multiple errors | Missing matchfix handling |
5251

5352
---
5453

@@ -79,8 +78,8 @@ This document summarizes the status of various test snippets from
7978

8079
### Notes
8180

82-
- **Distribution/Expansion**: `simplify()` does NOT automatically distribute. Use
83-
`.expand()` to distribute: `a*(c+d)``ac + ad`. This is by design.
81+
- **Distribution/Expansion**: `simplify()` does NOT automatically distribute.
82+
Use `.expand()` to distribute: `a*(c+d)``ac + ad`. This is by design.
8483
- **Assumptions**: Simplifications that depend on assumptions (like `x > 0`) now
8584
work correctly. Use `ce.assume()` before simplifying.
8685

@@ -109,29 +108,30 @@ This document summarizes the status of various test snippets from
109108

110109
### Issues Remaining
111110

112-
| Test | Line | Expected | Actual | Notes |
113-
| -------------------- | ------- | --------------- | ------ | --------------------------------- |
114-
| `.replace()` bug | 61-72 | `2*x + b` | `2` | Single-char symbols auto-wildcard |
111+
| Test | Line | Expected | Actual | Notes |
112+
| ---------------- | ----- | --------- | ------ | --------------------------------- |
113+
| `.replace()` bug | 61-72 | `2*x + b` | `2` | Single-char symbols auto-wildcard |
115114

116-
**Note:** `.replace({match: 'a', replace: 2})` on `a*x + b` returns `2` instead of `2*x + b`.
117-
The bug is in `parseRulePart` (rules.ts:350) which auto-converts all single-character symbols
118-
to wildcards. So `'a'` becomes `'_a'`, matching ANY expression rather than the literal symbol `a`.
119-
See TODO.md #23.
115+
**Note:** `.replace({match: 'a', replace: 2})` on `a*x + b` returns `2` instead
116+
of `2*x + b`. The bug is in `parseRulePart` (rules.ts:350) which auto-converts
117+
all single-character symbols to wildcards. So `'a'` becomes `'_a'`, matching ANY
118+
expression rather than the literal symbol `a`. See TODO.md #23.
120119

121120
### Expected Behavior (Not Bugs)
122121

123-
| Test | Line | Behavior | Workaround |
124-
| ------------------------------- | ------- | --------------------------- | -------------------------------- |
125-
| `D(\sin(x), x)` via LaTeX | 52-56 | Parses `D` as user symbol | Use `ce.box(['D', ...])` instead |
126-
| Power `.value` | 229-230 | `undefined` before evaluate | Use `.evaluate().value` instead |
122+
| Test | Line | Behavior | Workaround |
123+
| ------------------------- | ------- | --------------------------- | -------------------------------- |
124+
| `D(\sin(x), x)` via LaTeX | 52-56 | Parses `D` as user symbol | Use `ce.box(['D', ...])` instead |
125+
| Power `.value` | 229-230 | `undefined` before evaluate | Use `.evaluate().value` instead |
127126

128127
**Notes:**
129-
- In LaTeX, `D` is parsed as a predicate/symbol. For derivatives, use `ce.box(['D', expr, var])`
130-
or LaTeX notation like `\frac{d}{dx}`.
131-
- `.value` returns the numeric value only for already-evaluated expressions. For symbolic
132-
expressions like `Power(2, 3)`, call `.evaluate()` first.
133-
- For simple variable substitution, use `.subs()` not `.replace()`. The `.replace()` method
134-
is for pattern-based rule replacement.
128+
129+
- In LaTeX, `D` is parsed as a predicate/symbol. For derivatives, use
130+
`ce.box(['D', expr, var])` or LaTeX notation like `\frac{d}{dx}`.
131+
- `.value` returns the numeric value only for already-evaluated expressions. For
132+
symbolic expressions like `Power(2, 3)`, call `.evaluate()` first.
133+
- For simple variable substitution, use `.subs()` not `.replace()`. The
134+
`.replace()` method is for pattern-based rule replacement.
135135

136136
---
137137

@@ -148,63 +148,46 @@ See TODO.md #23.
148148

149149
### Issues Remaining
150150

151-
| Test | Line | Expected | Actual | Notes |
152-
| ------------------------- | ---- | -------- | ------- | ---------------------------------------- |
151+
| Test | Line | Expected | Actual | Notes |
152+
| ------------------------- | ---- | -------- | ------- | ----------------------------------------------- |
153153
| `2x+1=0` isEqual `x=-1/2` || `true` | `false` | `isEqual` should recognize equivalent equations |
154154

155-
**Note:** `isEqual` is for mathematical equality (vs `isSame` for structural equality).
156-
For equations, `isEqual` should check if `(LHS1-RHS1)/(LHS2-RHS2)` simplifies to a
157-
non-zero constant, indicating the same solution set. See TODO.md #22.
158-
159-
---
160-
161-
## Matrix Operations
162-
163-
### Working Correctly
164-
165-
| Test | Line | Input | Result |
166-
| ----------------------- | ------- | ---------------------------------- | ------------------- |
167-
| `Shape(A)` | 532-534 | 2x2 numeric matrix | `(2, 2)` |
168-
| `Rank(A)` | 532-534 | 2x2 numeric matrix | `2` |
169-
| `Flatten(A)` | 532-534 | `[[1,2],[3,4]]` | `[1,2,3,4]` |
170-
| `Transpose(A)` | 532-534 | `[[1,2],[3,4]]` | `[[1,3],[2,4]]` |
171-
| `Determinant(A)` | 532-534 | Numeric matrix | `-2` |
172-
| `Determinant(X)` symbolic | 536-549 | `[[a,b],[c,d]]` | `-b*c + a*d` |
173-
174-
### Notes
175-
176-
All matrix operations now work correctly, including symbolic matrices assigned via `ce.assign()`.
155+
**Note:** `isEqual` is for mathematical equality (vs `isSame` for structural
156+
equality). For equations, `isEqual` should check if `(LHS1-RHS1)/(LHS2-RHS2)`
157+
simplifies to a non-zero constant, indicating the same solution set. See TODO.md
158+
#22.
177159

178160
---
179161

180162
## Pattern Matching
181163

182164
### Issues Remaining
183165

184-
| Test | Line | Expected | Actual | Notes |
185-
| --------------------- | ------- | ------------------ | ------ | --------------------------- |
166+
| Test | Line | Expected | Actual | Notes |
167+
| --------------------- | ------- | ------------------ | ------ | --------------------------------------------- |
186168
| Match with variation | 135-148 | Substitution found | `null` | Match `0` against `_a*x` with `a=0` variation |
187-
| Complex pattern match | 153-165 | Substitution | `null` | Match `2x-√5√x` against complex Add pattern |
169+
| Complex pattern match | 153-165 | Substitution | `null` | Match `2x-√5√x` against complex Add pattern |
188170

189-
**Note:** Pattern matching with `useVariations: true` has known limitations. The system
190-
doesn't fully handle all algebraic variations (like matching `0` as `0*x`).
171+
**Note:** Pattern matching with `useVariations: true` has known limitations. The
172+
system doesn't fully handle all algebraic variations (like matching `0` as
173+
`0*x`).
191174

192175
---
193176

194177
## Formatting / Serialization
195178

196179
### Working Correctly
197180

198-
| Test | Line | Input | Result |
199-
| ------------------------- | ------- | -------------------------------- | ------------------------------ |
200-
| Scientific notation | 40-44 | `1000` | `1\cdot10^{3}` |
201-
| Fraction canonical | 298 | `\frac{2}{-3222233}+\frac{1}{3}` | Uses `Rational` not `Subtract` |
202-
| `1/(2\sqrt{3})` canonical | 617 | Rationalized | `\frac{\sqrt{3}}{6}` |
181+
| Test | Line | Input | Result |
182+
| ------------------------- | ----- | -------------------------------- | ------------------------------ |
183+
| Scientific notation | 40-44 | `1000` | `1\cdot10^{3}` |
184+
| Fraction canonical | 298 | `\frac{2}{-3222233}+\frac{1}{3}` | Uses `Rational` not `Subtract` |
185+
| `1/(2\sqrt{3})` canonical | 617 | Rationalized | `\frac{\sqrt{3}}{6}` |
203186

204187
### Expected Behavior
205188

206-
| Test | Line | Behavior | Notes |
207-
| -------------------- | ---- | --------------- | --------------------------------------- |
189+
| Test | Line | Behavior | Notes |
190+
| -------------------- | ---- | --------------- | -------------------------------------------------------------------------------- |
208191
| `3\times3` canonical | 59 | Returns `3 * 3` | `.simplify()` returns `9`. Converting to `3^2` would be a separate optimization. |
209192

210193
---
@@ -213,25 +196,25 @@ doesn't fully handle all algebraic variations (like matching `0` as `0*x`).
213196

214197
### Working Correctly
215198

216-
| Test | Line | Feature | Result |
217-
| ------------- | ------- | ---------------------------- | --------------------------------- |
218-
| Filter | 573-577 | `Filter([1,2,3,4,5], IsOdd)` | `[1,3,5]` |
219-
| Expand | 467-475 | `4x(3x+2)-5(5x-4)` | `12x^2 - 17x + 20` |
220-
| Negate i | 405-406 | `-i` | `-i` |
221-
| Hold | 232-234 | `Add(1, Hold(2))` | `1 + Hold(2)` |
199+
| Test | Line | Feature | Result |
200+
| -------- | ------- | ---------------------------- | ------------------ |
201+
| Filter | 573-577 | `Filter([1,2,3,4,5], IsOdd)` | `[1,3,5]` |
202+
| Expand | 467-475 | `4x(3x+2)-5(5x-4)` | `12x^2 - 17x + 20` |
203+
| Negate i | 405-406 | `-i` | `-i` |
204+
| Hold | 232-234 | `Add(1, Hold(2))` | `1 + Hold(2)` |
222205

223206
### Issues Remaining
224207

225-
| Test | Line | Expected | Actual | Notes |
226-
| ------------------------- | ------- | ---------------- | --------------------------------- | ----------------------------- |
227-
| `List(Filter).evaluate()` | 581-583 | Evaluated filter | Filter not evaluated inside List | Nested evaluation issue |
208+
| Test | Line | Expected | Actual | Notes |
209+
| ------------------------- | ------- | ---------------- | -------------------------------- | ----------------------- |
210+
| `List(Filter).evaluate()` | 581-583 | Evaluated filter | Filter not evaluated inside List | Nested evaluation issue |
228211

229212
### Expected Behavior
230213

231-
| Test | Line | Behavior | Notes |
232-
| ----------------- | ------- | ------------------ | -------------------------------------------------- |
233-
| Sum with data | 175-186 | `[50, 130]` | Element-wise multiplication is correct; use explicit indexing for dot product |
234-
| `Floor(Cos(n))` | 271-273 | `floor(cos(n))` | `n` is unknown, so expression stays symbolic |
214+
| Test | Line | Behavior | Notes |
215+
| --------------- | ------- | --------------- | ----------------------------------------------------------------------------- |
216+
| Sum with data | 175-186 | `[50, 130]` | Element-wise multiplication is correct; use explicit indexing for dot product |
217+
| `Floor(Cos(n))` | 271-273 | `floor(cos(n))` | `n` is unknown, so expression stays symbolic |
235218

236219
---
237220

@@ -263,8 +246,9 @@ These tests verify error handling for malformed input:
263246
4. **Pattern matching**: The pattern matching system has issues with variations
264247
and complex patterns.
265248

266-
5. **D operator syntax**: The `D` operator must be used via `ce.box(['D', ...])`,
267-
not LaTeX parsing. In LaTeX, `D` is parsed as a user symbol.
249+
5. **D operator syntax**: The `D` operator must be used via
250+
`ce.box(['D', ...])`, not LaTeX parsing. In LaTeX, `D` is parsed as a user
251+
symbol.
268252

269253
6. **Trig periodicity**: Trigonometric functions now reduce arguments by their
270254
period (e.g., `cos(5π + k)` simplifies to `-cos(k)`).

0 commit comments

Comments
 (0)