chemart / analog-function-crn
View on GitHubAnalog computation of algebraic functions with concentrations — Concentrations used as analog numbers. Pick reactions whose steady state satisfies the algebraic relation you want, then read the answer off the output species once it settles: X -> X + Y together with 2Y -> nothing bala…
How it works
Concentrations used as analog numbers. Pick reactions whose steady state satisfies the algebraic relation you want, then read the answer off the output species once it settles: X -> X + Y together with 2Y -> nothing balances at y = sqrt(k1 x / 2 k2), so a square root falls out of mass action. The idea is elegant and its limits are honest ones - no negative numbers, you must wait for equilibrium, not every network has one, and composing two such circuits is awkward.
- S
- one species per input (X1, X2) and the output Y; values are concentrations · explicit
- R
- sqrt: X --k1--> X + Y ; 2Y --k2--> (nothing), giving y = sqrt(k1 x / (2 k2)); k1 = 2 k2 gives y = sqrt(x) · arity 1, 2
- A
- ode · the result is read at steady state
Parameters
| name | default | meaning |
|---|---|---|
| function enum · structural |
"sqrt" | the function computed at steady state as [Y] sqrt | square | add | multiply | divide |
| x1 float · population |
4.0 | first input concentration [0, ∞] |
| x2 float · population |
2.0 | second input concentration (add, multiply, divide) [0, ∞] |
Analog computation of algebraic functions with concentrations
One of the artificial chemistries of Banzhaf & Yamamoto, Artificial Chemistries (MIT Press, 2015), §17.4.3; first proposed by Hjelmfelt et al.; Deckard & Sauro; Dittrich et al..
Its generator ships with the chemart library, so loading it runs no code from the hub and needs no trust_remote_code.
import chemart
net = chemart.generate_network("chemart/analog-function-crn", seed=0) # same as "analog-function-crn"
print(net.summary())
Implementation decisions
- sqrt is the book's network with k1 = 2, k2 = 1 (eqs. 17.18-17.24).
- The other functions are not in the book. They are the analogous mass-action networks, each checked against its steady state in the tests: square 2X1 -> 2X1 + Y, Y -> ; add X1 -> X1 + Y, X2 -> X2 + Y, Y -> ; multiply X1 + X2 -> X1 + X2 + Y, Y -> ; divide X1 -> X1 + Y, X2 + Y -> X2.
- extras.readout names the output species and its expected steady state.
Banzhaf & Yamamoto, Artificial Chemistries (2015), §17.4.3
Preview at default parameters
2 species · 2 reactions · status complete · seed 1
X1 -> X1 + Y [mass-action k=2.0] 2 Y -> ∅ [mass-action k=1.0]
Generated by the uploader with chemart push; the hub never runs uploaded code.