I woke up this morning thing about the mechanics (?!) of creating trolley diagrams and the like using TikX / LaTeX:
These diagrams can be made up from single blocks, or multiple blocks…
In the experiments I tried creating these documents, the LaTex is a bit fiddly and still too hard to “just write”.
I quickly discounted trying to come up with a graphical editor to assemble blocks and generate the LaTex (GUI / canvas coding is still one of the things I don’t know really know how to do at all) and then pondered an object model. Perhaps writing something like:
wall.add('trolley', by=['spring','damper']).add('right_arrow'), orient='LR'
that would build up a list of assets (wall, spring, damper, trolley) to include in the diagram, construct a Tikz script based on the assets and how they join together (the hard part…) then maybe generate a
__repr_html__ output to render the output in a notebook.
But I think the wiring the blocks together sensibly using an arbitrary number of connections could be challenging.
This all got me thinking about the grammar of the diagram, in part in the sense of Leland Wilkinson’s The Grammar of Graphics, but also in the sense of grammars that can be used to write electrical circuit diagrams and then reason about them (that is, generate mathematical systems that can be calculated as well as graphical ones that can be displayed). Things like the
lcapy package for creating a
Circuit, for example.
In turn, this got me thinking that the trolley diagrams are graphs. For example, probably abusing Graphviz dot notation, we could write something like:
T = trolley[label=m] W = wall[vertical] S = spring[horizontal] D = damper[horizontal] A = arrow[right] #Or should that be: F = force[right] W - S - T W - D - T T - A
In terms of layout, there’ d still be the issue of locating the registration points of the connectors, but assembling the equations should be straightforward. For example, cribbing some notes on the Free vibration of a damped, single degree of freedom, linear spring mass system from an Introduction to Dynamics and Vibrations course from the School of Engineering at Brown University:
we see how the mathematical model can be built up from the graphical model: each connection, each edge in the diagram graph, represents a separate component in the mathematical model.
This is good for teaching and learning too, because learning to read (and write) the diagram also helps us learn to read (and write) the mathematical model.
I think learners often underappreciate that in many cases what look like complex mathematical models are actually constructed from smaller parts (grouped terms and +/- signs are often a giveaway that the equation comprises multiple components and that you can often read the equation as a statement of what physical components each corresponds to). If you can see an equation as an assembly of component parts, it often makes it easier to read.
may look scary but it follows from the diagram:
in which we model the spring as:
which is to say, a constant () times the amount the spring has stretched (), which is to say the difference () between the distance between the wall and the trolley () and the original length of the spring ().
And the damper as:
You can also read into the component parts of that too, of course: presumably reads as something like the rate at which the distance between the wall and the trolley changes or the speed with which the trolley moves towards and away from the wall. And (greek symbol, pronounced as lambda) is another constant material property of the damper.
People know this stuff… They get the idea of constants, but they don’t realise it. Rubber balls are squeezy in the way that bricks aren’t. Squeeziness is a constant, and the ball and the brick have different values, peculiar to them, that are both associated with that same notion, that same constant, same property, of squeeziness. Similarly, folk know speed is something to do with the relationship between distance and time, and may even know that speed is distance over time, but they don’t know how to see it and read it (don’t know how to spot it or recognise it) as such when presented with an equation…
We don’t teach people how to read equations…
…nor do we teach them how to read diagrams and charts…
[Scurries away quickly in case I read the spring-damper equation incorrectly…!;-)]
Anyway, like I said, I need to think about representing stuff as graphs a bit more… A lot more…
PS I hadn’t appreciated before now that WordPress lets you write simple LaTex, albeit at the non-accessible expense of generating a PDF of the resulting expression… h/t @econproph for pointing that out…