Skip to content

Commit d9422dd

Browse files
committed
lint
1 parent 2507dbf commit d9422dd

1 file changed

Lines changed: 81 additions & 185 deletions

File tree

SIMPLIFY.md

Lines changed: 81 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,271 +1,167 @@
11
# Remaining Skipped Simplification Tests
22

3-
There are **42 skipped tests** remaining in `test/compute-engine/simplify.test.ts`
3+
There are **19 skipped tests** remaining in `test/compute-engine/simplify.test.ts`
44
(down from 93 originally). This document lists only the items that still need
55
resolution.
66

77
---
88

9-
## 1. Logarithm Rules (14 tests)
9+
## 1. Logarithm Rules (3 tests)
1010

11-
### 1a. Power rule for general log bases
11+
### 1a. ~~Power rule for general log bases~~ DONE
1212

13-
| Line | Test | Expected |
14-
| ---- | --------------------- | -------------------- |
15-
| 578 | `log_3(x^sqrt(2))` | `sqrt(2)*log_3(x)` |
16-
| 587 | `log_4(x^{7/4})` | `7/4*log_4(x)` |
13+
`log_c(x^n) → n*log_c(x)` — already works for irrational and non-integer
14+
rational exponents. Even exponents now correctly produce `log_c(|x|)`.
1715

18-
The `ln(x^n) → n*ln(x)` rule works but the analogous `log_c(x^n) → n*log_c(x)`
19-
does not fire for arbitrary base `c`.
16+
### 1b. ~~Ln cancellation~~ MOSTLY DONE
2017

21-
### 1b. Power rule with even exponent (absolute value needed)
18+
`ln(sqrt(x))-ln(x)/2 = 0` and `ln(3)+ln(1/3) = 0` now pass.
19+
`ln(p/q) → ln(p) - ln(q)` rule added for positive rationals.
2220

23-
| Line | Test | Expected |
24-
| ---- | ----------------- | -------------------- |
25-
| 583 | `log_4(x^2)` | `2*log_4(\|x\|)` |
26-
| 585 | `log_4(x^{2/3})` | `2/3*log_4(\|x\|)` |
27-
28-
When the exponent makes `x^n ≥ 0`, the result should use `|x|`.
29-
30-
### 1c. Change of base / ratio
31-
32-
| Line | Test | Expected |
33-
| ---- | --------------- | -------- |
34-
| 283 | `ln(9)/ln(3)` | `2` |
35-
36-
Needs: `ln(a)/ln(b) → log_b(a)`, then evaluate when both are known constants.
37-
38-
### 1d. Ln cancellation / collection
39-
40-
| Line | Test | Expected |
41-
| ---- | ------------------------------- | ---------------- |
42-
| 531 | `ln(x^{2/3}) - 4/3*ln(x)` | `-2/3*ln(x)` |
43-
| 536 | `ln(pi^{2/3}) - 1/3*ln(pi)` | `1/3*ln(pi)` |
44-
| 541 | `ln(sqrt(x)) - ln(x)/2` | `0` |
45-
| 543 | `ln(3) + ln(1/3)` | `0` |
46-
47-
Lines 531/541 may have wrong expected values — verify LaTeX parsing.
48-
Line 543 may involve floating-point error (`ln(1/3)` is not exact `-ln(3)`).
49-
50-
### 1e. Exponential of log difference
51-
52-
| Line | Test | Expected |
53-
| ---- | ------------------- | ---------------- |
54-
| 553 | `e^{ln(x) - y^2}` | `x / e^{y^2}` |
55-
56-
The existing `e^{ln(x) + f}` rule doesn't handle arbitrary non-ln addends.
57-
58-
### 1f. Log of quotient involving e
21+
### 1c. Log of quotient involving e
5922

6023
| Line | Test | Expected |
6124
| ---- | ------------------------ | ----------------- |
62-
| 564 | `ln((x+1)/e^{2x})` | `ln(x+1) - 2x` |
63-
64-
The `ln(a/b)` rule exists but may not fire in this context.
65-
66-
### 1g. Reciprocal base
67-
68-
| Line | Test | Expected |
69-
| ---- | --------------- | -------------- |
70-
| 574 | `log_{1/2}(x)` | `-log_2(x)` |
25+
| 498 | `ln((x+1)/e^{2x})` | `ln(x+1) - 2x` |
7126

72-
New rule: `log_{1/b}(x) = -log_b(x)`.
27+
Operand simplification expands the fraction before the log quotient rule fires.
28+
Deep ordering issue.
7329

74-
### 1h. Mixed log identities with arbitrary base
30+
### 1d. Mixed log product identity
7531

7632
| Line | Test | Expected |
7733
| ---- | -------------------- | ------------------- |
78-
| 611 | `log_c(c^x * y)` | `x + log_c(y)` |
79-
| 613 | `log_c(c^x / y)` | `x - log_c(y)` |
80-
| 615 | `log_c(y / c^x)` | `log_c(y) - x` |
81-
| 629 | `log_c(a) * ln(a)` | `ln(c)` |
82-
83-
Generalize the `ln(e^x * y)` family to `log_c(c^x * y)`.
84-
85-
---
86-
87-
## 2. Absolute Value Identities (5 tests)
34+
| 548 | `log_c(a) * ln(a)` | `ln(c)` |
8835

89-
| Line | Test | Expected |
90-
| ---- | -------------------------- | ------------- |
91-
| 647 | `\|x\|^{4/3}` | `x^{4/3}` |
92-
| 649 | `\|xy\| - \|x\|*\|y\|` | `0` |
93-
| 654 | `\|2/x\| - 1/\|x\|` | `1/\|x\|` |
94-
| 656 | `\|1/x\| - 1/\|x\|` | `0` |
95-
| 658 | `\|x\|\|y\| - \|xy\|` | `0` |
96-
97-
Missing rules:
98-
- `|a*b| → |a|*|b|` (multiplicative identity)
99-
- `|a/b| → |a|/|b|`
100-
- `|x|^{p/q} → x^{p/q}` when the result is always non-negative (needs care
101-
with branch conventions)
102-
103-
---
104-
105-
## 3. Powers with Negative Bases / Odd Roots (2 tests)
106-
107-
| Line | Test | Expected | Notes |
108-
| ---- | -------------- | -------------- | ----------------------------------- |
109-
| 452 | `(-x)^{3/4}` | `x^{3/4}` | **Questionable** — complex for x>0 |
110-
| 454 | `cbrt(-2)` | `-cbrt(2)` | Sign extraction for odd roots |
111-
112-
For `cbrt(-a) = -cbrt(a)`: add rule `Root(n, -a) → -Root(n, a)` when `n` is
113-
odd and `a ≥ 0`.
36+
**NOTE**: This test is mathematically wrong. `log_c(a)*ln(a) = ln(a)²/ln(c)`,
37+
not `ln(c)`. Likely intended: `log_a(c)*ln(a) = ln(c)`.
11438

115-
For `(-x)^{3/4}`: review domain — this is complex for positive `x`. May be a
116-
test bug.
39+
### 1e. ~~Change of base / ratio~~ DONE
11740

118-
---
119-
120-
## 4. Double Powers (1 test)
121-
122-
| Line | Test | Expected |
123-
| ---- | --------------- | -------- |
124-
| 146 | `(x^3)^{1/3}` | `x` |
41+
### 1f. ~~Reciprocal base~~ DONE
12542

126-
`(x^n)^{1/n} → x` when `n` is odd. The existing rule requires `baseNonNeg ||
127-
innerIsOddInteger`, but the combination `3 * 1/3 = 1` may not simplify to
128-
`x^1 → x`. Needs debugging.
43+
### 1g. ~~Mixed log identities~~ DONE (except product)
12944

13045
---
13146

132-
## 5. Power of Quotient (1 test)
133-
134-
| Line | Test | Expected |
135-
| ---- | ----------------- | ----------------- |
136-
| 485 | `x/(pi/y)^3` | `x*y^3/pi^3` |
137-
138-
`(a/b)^n → a^n/b^n` may not fire when the powered quotient is in a denominator.
139-
140-
---
141-
142-
## 6. Power Combination with Symbolic Exponents (1 test)
143-
144-
| Line | Test | Expected |
145-
| ---- | --------------------- | ---------------------- |
146-
| 492 | `x^{sqrt(2)} / x^3` | `x^{sqrt(2) - 3}` |
47+
## 2. Absolute Value (0 remaining)
14748

148-
The `x^a * x^b → x^{a+b}` rule works for numeric exponents but not symbolic.
49+
All abs tests now pass:
50+
- `|x|^{4/3} = x^{4/3}` — fixed by handling Rational exponents in
51+
`simplifyAbsPower`
52+
- `|xy| = |x||y|` — multiplicative identity added
53+
- `|x/y| = |x|/|y|` — quotient identity added
14954

15055
---
15156

152-
## 7. Root Simplification (2 tests)
57+
## 3. Powers and Roots (3 tests)
15358

154-
| Line | Test | Expected |
155-
| ---- | --------------- | -------------- |
156-
| 499 | `root4(16*b^4)` | `2\|b\|` |
157-
| 503 | `root4(x^6)` | `sqrt(x^3)` |
158-
159-
Factor numeric coefficients out of roots and reduce `root(n, x^m) → x^{m/n}`
160-
to simplest radical form.
59+
| Line | Test | Expected | Notes |
60+
| ---- | -------------- | -------------- | ----------------------------------- |
61+
| 404 | `(-x)^{3/4}` | `x^{3/4}` | **Wrong test** — complex for x > 0 |
62+
| 441 | `x^{sqrt(2)}/x^3` | `x^{sqrt(2)-3}` | sqrt(2).sub(3) evaluates to float |
63+
| 447 | `root4(16b^4)` | `2\|b\|` | Factor numeric coefficients from roots |
16164

16265
---
16366

164-
## 8. Common Denominator (2 tests)
67+
## 4. Common Denominator (2 tests)
16568

16669
| Line | Test | Expected |
16770
| ---- | ----------------- | ---------------- |
168-
| 513 | `1/(x+1) - 1/x` | `-1/(x^2+x)` |
169-
| 515 | `1/x - 1/(x+1)` | `1/(x^2+x)` |
71+
| 458 | `1/(x+1) - 1/x` | `-1/(x^2+x)` |
72+
| 460 | `1/x - 1/(x+1)` | `1/(x^2+x)` |
17073

17174
Requires finding a common denominator for fractions with polynomial
17275
denominators — a significant new capability.
17376

17477
---
17578

176-
## 9. Multi-Variable Expansion (1 test)
79+
## 5. Multi-Variable Expansion (1 test)
17780

17881
| Line | Test | Expected |
17982
| ---- | ----------------------- | ---------------- |
180-
| 522 | `2*(x+h)^2 - 2*x^2` | `4xh + 2h^2` |
83+
| 466 | `2*(x+h)^2 - 2*x^2` | `4xh + 2h^2` |
18184

182-
Single-variable `(x+1)^2 - x^2 = 2x+1` works. Debug why two variables fail.
85+
Single-variable `(x+1)^2 - x^2 = 2x+1` works. Multi-variable expansion
86+
(`(x+h)^2`) does not expand.
18387

18488
---
18589

186-
## 10. Inverse Hyperbolic ↔ Logarithm Rewrites (6 tests)
90+
## 6. Float / Mixed Arithmetic (2 tests)
18791

188-
| Line | Test | Expected |
189-
| ---- | ------------------------------ | ------------- |
190-
| 968 | `1/2*ln((x+1)/(x-1))` | `arccoth(x)` |
191-
| 973 | `ln(x + sqrt(x^2+1))` | `arsinh(x)` |
192-
| 978 | `ln(x + sqrt(x^2-1))` | `arcosh(x)` |
193-
| 983 | `1/2*ln((1+x)/(1-x))` | `artanh(x)` |
194-
| 988 | `ln((1+sqrt(1-x^2))/x)` | `arsech(x)` |
195-
| 993 | `ln(1/x + sqrt(1/x^2+1))` | `arcsch(x)` |
92+
| Line | Test | Expected |
93+
| ---- | ---------------- | ---------------------------------- |
94+
| 43 | `sqrt(3.1)` | `1.76068168616590091458` (decimal) |
95+
| 58 | `sqrt(3) + 0.3` | `2.0320508075688772` (decimal) |
19696

197-
Complex structural pattern-matching. Low priority / niche.
97+
`simplify()` should trigger numeric evaluation when floats are present.
19898

19999
---
200100

201-
## 11. Inverse Trig Rewrite (1 test)
101+
## 7. Inequality Simplification (1 test)
202102

203-
| Line | Test | Expected |
204-
| ---- | ----------------------------- | ------------- |
205-
| 1001 | `arctan(x/sqrt(1-x^2))` | `arcsin(x)` |
103+
| Line | Test | Expected |
104+
| ---- | -------------------------- | ------------- |
105+
| 113 | `(2*pi + 2*pi*e) < 4*pi` | `1 + e < 2` |
206106

207-
Structural pattern-matching rewrite.
107+
Extend inequality GCD-factor-out to handle sums with common factors.
208108

209109
---
210110

211-
## 12. Float / Mixed Arithmetic (2 tests)
111+
## 8. Inverse Hyperbolic ↔ Logarithm Rewrites (6 tests)
212112

213-
| Line | Test | Expected |
214-
| ---- | ---------------- | ---------------------------------- |
215-
| 43 | `sqrt(3.1)` | `1.76068168616590091458` (decimal) |
216-
| 58 | `sqrt(3) + 0.3` | `2.0320508075688772` (decimal) |
113+
| Line | Test | Expected |
114+
| ---- | ------------------------------ | ------------- |
115+
| 822 | `1/2*ln((x+1)/(x-1))` | `arccoth(x)` |
116+
| 827 | `ln(x + sqrt(x^2+1))` | `arsinh(x)` |
117+
| 829 | `ln(x + sqrt(x^2-1))` | `arcosh(x)` |
118+
| 831 | `1/2*ln((1+x)/(1-x))` | `artanh(x)` |
119+
| 833 | `ln((1+sqrt(1-x^2))/x)` | `arsech(x)` |
120+
| 835 | `ln(1/x + sqrt(1/x^2+1))` | `arcsch(x)` |
217121

218-
`simplify()` should trigger numeric evaluation when floats are present.
122+
Complex structural pattern-matching. Low priority / niche.
219123

220124
---
221125

222-
## 13. Inequality Simplification (1 test)
126+
## 9. Inverse Trig Rewrite (1 test)
223127

224-
| Line | Test | Expected |
225-
| ---- | -------------------------- | ------------- |
226-
| 125 | `(2*pi + 2*pi*e) < 4*pi` | `1 + e < 2` |
128+
| Line | Test | Expected |
129+
| ---- | ----------------------------- | ------------- |
130+
| 843 | `arctan(x/sqrt(1-x^2))` | `arcsin(x)` |
227131

228-
Extend inequality GCD-factor-out to handle sums with common factors.
132+
Structural pattern-matching rewrite.
229133

230134
---
231135

232-
## 14. Fu Trig Simplification — Phase 14 (1 test)
136+
## 10. Fu Trig Simplification — Phase 14 (1 test)
233137

234138
| Line | Test | Expected |
235139
| ---- | ----------------------------------------------- | ---------------------- |
236-
| 1446 | `1 - (1/4)*sin^2(2x) - sin^2(y) - cos^4(x)` | `sin(x+y)*sin(x-y)` |
140+
| 1279 | `1 - (1/4)*sin^2(2x) - sin^2(y) - cos^4(x)` | `sin(x+y)*sin(x-y)` |
237141

238142
Requires extending the Fu algorithm implementation.
239143

240144
---
241145

242146
## Priority Order
243147

244-
### Medium effort, broadly useful
245-
246-
1. **Log power rule for arbitrary base** (1a) — generalize existing ln rule
247-
2. **Reciprocal log base** (1g) — new rule `log_{1/b}(x) = -log_b(x)`
248-
3. **Abs multiplicative identity** (2) — `|ab| = |a||b|`
249-
4. **cbrt(-a) = -cbrt(a)** (3) — sign extraction for odd roots
250-
5. **Ln cancellation** (1d) — verify parsing, extend collection
251-
6. **Mixed log identities** (1h) — generalize ln(e^x*y) to log_c(c^x*y)
252-
253148
### Medium effort, moderate value
254149

255-
7. **Double powers** (4) — debug (x^3)^{1/3} = x
256-
8. **Power of quotient** (5) — (a/b)^n in denominator
257-
9. **Symbolic exponent combination** (6) — x^a / x^b with symbolic a, b
258-
10. **Root simplification** (7) — factor coefficients out of radicals
259-
11. **Exp of log difference** (1e) — e^{ln(x) - f}
260-
12. **Log of quotient** (1f) — ln((x+1)/e^{2x})
261-
13. **Change of base ratio** (1c) — ln(a)/ln(b)
150+
1. **Root factoring** (3) — `root4(16b^4) = 2|b|`
151+
2. **Multi-variable expansion** (5) — `2*(x+h)^2 - 2*x^2`
152+
3. **Log of quotient** (1c) — `ln((x+1)/e^{2x})`
262153

263154
### High effort / niche
264155

265-
14. **Common denominator** (8) — partial fraction / rational expression
266-
15. **Multi-variable expansion** (9) — debug two-variable case
267-
16. **Float arithmetic** (12) — N() integration in simplify
268-
17. **Inverse hyp ↔ log rewrites** (10) — complex pattern matching
269-
18. **Inverse trig rewrite** (11) — structural pattern matching
270-
19. **Inequality GCD** (13) — extend to sums
271-
20. **Fu Phase 14** (14) — advanced trig
156+
4. **Float arithmetic** (6) — N() integration in simplify
157+
5. **Common denominator** (4) — partial fraction / rational expression
158+
6. **Symbolic exponent** (3) — `x^{sqrt(2)}/x^3` (float loss)
159+
7. **Inequality GCD** (7) — extend to sums
160+
8. **Inverse hyp ↔ log rewrites** (8) — complex pattern matching
161+
9. **Inverse trig rewrite** (9) — structural pattern matching
162+
10. **Fu Phase 14** (10) — advanced trig
163+
164+
### Bug / Questionable
165+
166+
- `(-x)^{3/4} = x^{3/4}` — complex for real x > 0, test likely wrong
167+
- `log_c(a)*ln(a) = ln(c)` — mathematically incorrect expected value

0 commit comments

Comments
 (0)