← home

$ cat blog/engineering-cell-part-3

Turning Cells into Matrices

Part 3 of Engineering a Cell · 2026-03-20

Turning Cells into Matrices

The final step was figuring out how to mathematically force the cell out of the aggressive Mesenchymal state.

This is where Boolean networks hit a wall. Logic gates (AND, OR, NOT) and IF/THEN rules are great for programming a simulation, but they are terrible for control theory. You can't easily do calculus or calculate optimal control paths on a bunch of discrete logic gates. I needed a way to translate those Boolean rules into standard linear algebra.

Enter the Semi-Tensor Product (STP).

Standard matrix multiplication requires the inner dimensions to match. STP throws that constraint out the window, allowing you to multiply matrices of arbitrary dimensions. By applying STP to the Boolean logic tables, I converted the entire network's ruleset into a massive, algebraic state-space representation.

Suddenly, the messy biological network was reduced to a clean, discrete linear system defined by a global structure matrix, L:

x(t+1) = L ⋉ x(t)

From Predictive to Prescriptive

This equation changed the entire scope of the project. It wasn't just a predictive model anymore; it was a prescriptive control engine.

With the structure matrix L established, I could treat the locked independent genes not just as static inputs, but as explicit control variables. By applying Boolean Control Network theory, I could systematically calculate the exact sequence of node perturbations (simulated drug targets) required to push the matrix x(t) out of the Mesenchymal attractor.

I wasn't guessing which genes to target based on biological intuition. The linear algebra was literally handing me the optimal control path.

Conclusion

Whether you are building an anomaly detection LSTM for vehicle telemetry, standing up an agentic API gateway, or mapping a Markov process for a cancer cell, the core engineering principles remain exactly the same: clean your data, constrain your variables, and trust the math.