@@ -1693,3 +1693,57 @@ e3.solve(['x', 'y']); // → null (discriminant < 0)
16931693- ` test/compute-engine/solve.test.ts ` - Added 8 new tests for non-linear systems
16941694- Updated documentation in CHANGELOG.md, doc/changelog.md, and
16951695 doc/17-guide-linear-algebra.md
1696+
1697+ ---
1698+
1699+ ### 30. Linear Inequality Systems ✅
1700+
1701+ ** IMPLEMENTED:** The ` solve() ` method now handles systems of linear inequalities
1702+ in 2 variables, returning the vertices of the feasible region (convex polygon).
1703+
1704+ ** Supported inequality operators:**
1705+
1706+ - ` < ` (Less), ` <= ` (LessEqual), ` > ` (Greater), ` >= ` (GreaterEqual)
1707+
1708+ ** Examples that now work:**
1709+
1710+ ``` typescript
1711+ // Triangle: x >= 0, y >= 0, x + y <= 10
1712+ const e = ce .parse (' \\ begin{cases}x\\ geq 0\\\\ y\\ geq 0\\\\ x+y\\ leq 10\\ end{cases}' );
1713+ e .solve ([' x' , ' y' ]);
1714+ // → [{ x: 0, y: 0 }, { x: 10, y: 0 }, { x: 0, y: 10 }]
1715+
1716+ // Square: 0 <= x <= 5, 0 <= y <= 5
1717+ const square = ce .parse (' \\ begin{cases}x\\ geq 0\\\\ x\\ leq 5\\\\ y\\ geq 0\\\\ y\\ leq 5\\ end{cases}' );
1718+ square .solve ([' x' , ' y' ]);
1719+ // → [{ x: 0, y: 0 }, { x: 5, y: 0 }, { x: 5, y: 5 }, { x: 0, y: 5 }]
1720+
1721+ // Pentagon with multiple constraints
1722+ const pentagon = ce .parse (' \\ begin{cases}x\\ geq 0\\\\ y\\ geq 0\\\\ x\\ leq 4\\\\ y\\ leq 4\\\\ x+y\\ leq 6\\ end{cases}' );
1723+ pentagon .solve ([' x' , ' y' ]);
1724+ // → 5 vertices in counterclockwise order
1725+ ```
1726+
1727+ ** Algorithm:**
1728+
1729+ 1 . Extract linear constraints from each inequality (normalize to ` ax + by + c <= 0 ` )
1730+ 2 . Find all pairwise intersections of constraint boundary lines
1731+ 3 . Filter to vertices that satisfy all original constraints
1732+ 4 . Order vertices in counterclockwise convex hull order
1733+ 5 . Return as array of coordinate objects
1734+
1735+ ** Limitations:**
1736+
1737+ - Only supports 2-variable systems
1738+ - Returns ` null ` for infeasible regions (no valid vertices)
1739+ - Returns ` null ` for non-linear constraints
1740+
1741+ ** Files modified:**
1742+
1743+ - ` src/compute-engine/boxed-expression/solve-linear-system.ts ` - Added
1744+ ` solveLinearInequalitySystem() ` and supporting functions (` extractLinearConstraint() ` ,
1745+ ` findLineIntersection() ` , ` satisfiesConstraint() ` , ` orderConvexHull() ` )
1746+ - ` src/compute-engine/boxed-expression/boxed-function.ts ` - Updated ` solve() ` to
1747+ detect and dispatch to inequality solver
1748+ - ` test/compute-engine/solve.test.ts ` - Added 8 new tests for inequality systems
1749+ - ` doc/17-guide-linear-algebra.md ` - Added documentation for linear inequality systems
0 commit comments