Are there languages that emphasize the single-datu...
# thinking-together
b
Are there languages that emphasize the single-datum <=> collection-of-data duality? E.g. making loop-with-
if
<=>
filter
-on-the-whole look very similar? But that's just a programming curiousity; I'm more interested if there are any mind bicycles that help one think about local vs. global rules? Physics is rich with examples where seeing both perspectives is insightful: • local F = ma <=> conservation of potential energy independent of specific path (for certain forces) • Gauss's laws relating single-point "differential" <=> volume/surface "integral" formulations of Maxwell equationsNoether's theorem is certainly up there, relating shapes of laws with conserved stuff, but I'll admit over my head... Example task: For a while now I've dreamed of making a model of weather that's simple enough for paper+pen+tokens, or generally something "board game-ish". Lies-to-children are fine, but would like it to demonstrate at least basic mechanics: (A) wind caused by hotter air rising and leaving a vacuum; (B) evaporation over sea => rain over land (C) "rain shadow" beyond a mountain (my country has this). It's not easy to discretize continuous-quantity equations into something like a cellular automaton... I'm leaning towards representing conserved quantities like water with tokens you can move, rather than per-cell state. And I don't want some huge "simulation"—I'd love to find rules that can demonstrate these processes in few enough steps to follow by hand. Hmm say I have air that wants to go up + right, and it holds just 1 water token—which way do I move it? Well I suppose I want a bit larger numbers so quantization won't matter that much... And I probably want alternating horizontal vs. vertical game phases (also dealing with 1D slice at a time can reduce previous-vs-next-state confusions). Any advice for tools to help think about rules/mechanics and what can emerge from them, beyond "try and see what what happens"? (But I guess I really should play with large "sand" style models, then try to scale down! try-and-see is more powerful than merely keeping in my head.)
k
Technicalities first: • Maude comes to mind as a language in which items are treated as equivalent to a list of one item. Howver, this happens by convention rather than as a language features. Lists are not built-in constructs. Still worth a look for examples of how this equivalence plays out in practice. • The integral version of F = m a is Lagrangian mechanics, which roughly says "a mechanical system follows the path that minimizes the action integral". The equivalence with Newton's version is very much in the spirit of Gauss' laws. • Noether's theorem is one level of abstraction above, it's about relations between invariants.
@Beni Cherniavsky-Paskin The closest I know to your weather game is Lattice gas automata and the Lattice-Boltzmann methods building on them. They are similar to cellular automata, but have rules derived from mechanics and thermodyanmics. I am pretty sure that they could be used for making toy models for the weather. Their main weakness is related to Noether's theorem: they have too many symmetries and thus too many conserved quantities. That's mostly an issue for simple systems. Make the geometry complex enough, as in weather, and those problems shouldn't matter any more (because your geometry removes all the symmetries).
Another interesting technique in this space is agent-based modeling. It also describes "stuff" as discrete pieces that move around and change, but doesn't confine them to a lattice. NetLogo is a popular environment for defining and running such simulations (completely unrelated to Logo BTW).
j
I'll pitch in Emoji Simulator as a CA prototyping tool that really likes for you to make rules that are 'small enough to follow by hand'. Exactly, there's enough design space for pattern-forming behaviors that it's hard to characterize without 'playing around', even on a smallish lattice. https://ncase.me/sim/ NetLogo is absolutely the next step. It's got enough built-in plotting tools to see if you're really reproducing the behavior of the global model. I did this with predator-prey at one point, and learned why the modelling approach splits into either metapopulation modelling (so that local extinctions are recoverable) or modelling the time-to-extinction (i.e. accidentally encountering the absorbing steady state). If you go into implementing a lattice gas automata I'm sure you'll get into similar nuances of advection models pretty quickly.
Speaking of falling sand, I don't have a good engine to suggest, but I think the observation of the Noita devs that 'some constraints are necessary' (or else the game-world literally destroys itself) is a nice philosophy of modelling. By starting from the continuous equations, you have the advantage of a well-formed molar behavior, that may or may not get ruined by the randomness of individual molecules.

https://www.youtube.com/watch?v=prXuyMCgbTc