1392 points · by robin_reala · 3y ago · 237 comments
Any piece able to freely rotate is considered the same structure. For example, for 2 1X2 legos the arrangement count is 2: top connected to bottom with both nubs, top connected to bottom with one nub because if you analyze legos you will find that such an arrangement can freely rotate over 270 degrees, and left vs right nubs result in the same structure when taking rotational symmetry into account.
For the problem I assume an 'ideal' lego with 0 manufacturing tolerance, no illegal building techniques are allowed.
Is there a name for the above combinatorics question? Is it well-posed?
Is there a closed-form solution? If not is there a generator program?
I should say that with a high enough N any generator would be very complex - imagine how degrees of rotational freedom give rise to the possibility of further structures hidden from other rotational orientations.
https://arxiv.org/abs/math/0504039
https://www.tandfonline.com/doi/abs/10.4169/amer.math.monthl...
(for the latter: use sci-hub)
Then there is also work for the 2D case by Tricia Muldoon Brown:
https://www.sciencedirect.com/science/article/pii/S0012365X1...
https://arxiv.org/abs/1608.01562
as well as by Alexander M. Haupt:
1. Write a Python script to brute force the first values of the sequence.
2. Search oeis for that sequence.
3. If (2) fails, simplify the problem and repeat.
Sometimes you get a completely unexpected connection that you would never have come up with yourself just by thinking.
It's a similar problem (restricted attachment points, 3d double-counting).
E.g. https://math.stackexchange.com/questions/237998/p%C3%B3lya-s...
> imagine how degrees of rotational freedom give rise to the possibility of further structures hidden from other rotational orientations.
That sounds like a basically continuous question, not discrete. But maybe I misunderstood.
It's beside a machine molding 1x4 bricks and packing 6 of them into a bag which you can take for free.
Straight sections are mostly ignorable since you can always add them in pairs on opposite sides of the loop if they are parallel. (although there are some interesting triangle-shapes that can be made that break that pattern)
My friend even went so far as to code up a solver for it which mostly worked and generated some interesting layouts. We never got around to adding switches into it.
It eventually led us to the math behind necklace problems because it was often hard to tell if 2 track layouts were identical: https://en.wikipedia.org/wiki/Necklace_problem
And: https://techcrunch.com/wp-content/uploads/2010/01/picture-29...
No idea what the 3rd picture was.
Processing code is here: https://blog.jgc.org/2010/01/ikea-lillabo-processing-code.ht...
I mention that to people more often than most would think.
As my kids got older, we upgraded to Lego system track and I was initially very disappointed in it. The math for Lego track is quite different and there is something very satisfying about the Duplo system.
The key difference is that switches in Duplo are equivalent to two oppositely curved tracks overlaid on each other. This means you can pop a switch in anywhere that there is a curve piece. In the Lego system track, it is a straight piece with a curve out and back in slightly. If you place two switches together you can connect two parallel tracks, but it has the disadvantage of being harder to place (you end up needing substantial straight sections to use switches)
Happy to elaborate further if it is valuable to the discourse!
https://www.cailliau.org/Alphabetical/L/Lego/Duplo/Train/Rai...
I owned both "new-type" and "old-type" (black) Duplo rails as a kid. I remember that even as a 4-year-old, I was annoyed with the old-type black rails and greatly preferred the new ones.
I bet I'm not the only person here who can read it – rather haltingly – without decoding it first.
What I like about brio tracks is that they don't trash up the house like plastic tracks from other sets. They just look nice, feel good to the touch. The slow speed but high torque of the trains also feel like it gives "mass" (not sure how to phrase it) to the experience, unlike a lot of remote controlled toys, which go way too fast for their size but struggle with carpets, edges, ...
This makes me want to get a CNC machine and start spitting out train tracks! I already know when I retire in 30 years I'm gonna be one of those guys that has a train room.
However, it's quite easy to find second hand Brio tracks.
That is to say, in the overall system, only a _small_ integer number of different straight track lengths are required.
In comparison, TrackMaster requires many more.
Curious if anyone has milled their own brio tracks. (Maybe to allow some unusual shapes not afforded by standard types)
I’ve made a single brio track compatible banana car but haven’t had a go at making any track yet.
Nowadays one of my nephews ended up with lots of generic track (gifts from uncle: me) and some very specialized custom switches cast out of resin by his maternal grandfather. There are multiple ways to solve the problem!
View each track piece as a 2d vector. Add up the vectors. In a zero-tension setup, the sum is (0, 0).
As a metric for tension, assume any mismatch in position is evenly distributed. Model this as the average of all the vectors. (Thus the same displacement is more meaningful when we have fewer pieces.)
___
That's the full idea. It might seem that it is ignoring rotation, because it doesn't explicitly mention rotations, but they are included because the effective vector that a track piece provides is both a current direction as well as the displacement contributed by that piece. If we wrote some code to model this, a cursor would consist of a direction (an angle) along with an (x, y) position.
___
Some related math concepts:
* The exterior angles of a polygon sum to 360. So we could have another measure which is how far we are away from 360.
* Not useful in this case, but this also reminds me of winding numbers from complex analysis, which is a way to locally walk along a curve to understand which side is the "inside" or how many times a curve goes around a given point.
I think these two things could be improved from that answer:
* I'm suggesting a general approach to measuring track tension, which is the average of the vectors. I didn't see that idea in the answer.
* I think the answer could be communicated a little more simply. For example, we don't need to think in terms of Q[sqrt(3)]; I see that as a distraction.
Except for replacing Q[sqrt(3)] by a suitable ring extension of Z, I see no possibiliy to simplify the argument. So what kind of simplification do you have in mind?
a metric for tension = [ norm(sum(piece_vectors)) + abs(angle_displacement) ] / n
where
angle_displacement = sum(angles) - 360
and the angles are signed accordingly.
But (for me), the same is no longer true for stackoverflow. I used to participate on it both as an asker and an answerer. But something happened. It felt like it was a takeover by ever pedantic moderators. Now I participate there only rarely.
So when under severe misalignment, one side of the key would be pushed with extra lateral pressure and may deform or break.
However, this sort of severe tension is likely to be in effect while attempting to link/lock the last joint. It's likely to be done by the child when the parent is not there to supervise the feasibility of such forced link. The parent will be alerted when it's either too late or when it succeeded and there's no need to fix it.
Thus, if it were to snap a key neck, then it's just meant to be... No drama. The second key is still there to maintain the joint. Though caution, if no lesson is drawn, such section would become even weaker link!
If it somehow coerced into a loop, then Yay! here comes the locomo. If the train cars don't tip over the forced link gaps or warped sections, then the ride goes on. Otherwise, a tuneup/rebuild is due.
Every time you use a piece turning the other way, you need to add an extra piece turning the way you want to complete the circle, so the difference between the directions has to be 12.
Note, however, that not every track with exactly 12 more pieces turning one way than the other necessarily makes a complete circle, straight pieces can cause the ends not to match up.
That would be my puzzle solution to:
1. Assign each piece type it's end offset and next piece connection angle
2. Start at 0,0 coordinate and iterate through pieces, advancing last piece position
3. Check the offset between the start and end pieces
And the result would look like images in the answer.
Updating the track to minimize offset is harder, though.
Our experience - which include track layouts that occupy a good proportion of the ground floor of our house, a la Wallace and Gromit's The Wrong Trousers Train Chase - is that if you open a section under tension, wiggle the entire track back and forth a bit, even on a solid wood floor it tends to settle into a "more relaxed" state, at which point you can adjust the relevant pieces to close the (often larger) gap...
Then there's not enough tension to break any pieces either.
> I know I could just take one piece out, and put it back in to feel it myself
Assemble it on the air hockey table?
Assemble it on a smooth, flat floor and sprinkle some shuffleboard powder?
https://lamington.wordpress.com/2011/12/02/laying-train-trac...
Except for the simplest of tracks, I often wonder if the misalignment of a complex track is not stressing the pieces. Of course, instead of asking in stackexchange I dismiss the thought and just play -- er, my daughter plays -- with the train.
I just had my mind blown by this a few days ago, you're one of today's 10,000: https://bricknerd.com/home/every-type-of-plastic-used-by-leg...
nice insider joke :)
One piece of flex track bent and cut to length.
Don't the track pieces fit together loosely?
And aren't most Lego/Duplo pieces made of such hard and rigid plastic that they don't effectively bend at all?
So while it's still an interesting math problem about angles and lengths, I'm not sure the premise of "tension" is correct here.
Some amazing "illegal" Lego creations there.
But the sound of those bending Lego bricks made my teeth hurt, I had to mute the video. :-|
My 3yo son usually ends up with really "tense" tracks if he manages to build a circle. The lever torque of the track length makes them bend a tiny bit, so there should be tension in the outer rail. The fittings are quite close fits.
"I would first check for track flatness"
This thread is a great example of how engineering is often NOT a solution to problems, classic "hammer and nail" territory here. And how engineers often ofterthink things unnecessarily ;)
Then, what’s the issue? “Too much tension” is the question. A reasonable definition of “too much” is possible damage or that it affects performance.
Having experience with these, if it’s sitting on the ground flat, and it’s not being help there, then it’s about an order of magnitude away from “too much”, for damage.
“No tension” is a different question.
I'm afraid it is not accurate at all because it is not answering the question as asked. It verifies that the track is under tension, but it doesn't attempt to answer if that tension is "too much". Which is what the question asks.
Spoiler alert: it didn't. Nowhere does the mathematical answer address the question of "too much".
And what do you mean by "progressed from stress to strain?" Stress doesn't turn into strain, they exist simultaneously. You're probably trying to say progressed from elastic deformation to plastic deformation.
I think you (and many others in this thread) are confused because you read the title but not the body of the OP. Quoted:
> 1. Is there any way to quickly see if there is any tension, and why? (I know I could just take one piece out, and put it back in to feel it myself, but I am looking for a more logical way, so I am able to reason it.)
> 2. Suppose I want to update the track in the picture to have less tension. If you have to take away exactly 1 rail piece (straight or curved), which one is the best, and why? If you have to add exactly 1 rail piece (straight or curved), what is the optimal place to insert one?
The accepted answer attempts to address these questions.
Edit: Re-reading the rest of the "look for track flatness" comment; the second and third sentences about tolerances and bowed joints are spot on. For example, looking at the final track layout for the "mathematical" approach, I can tell you that I'd have no problem shifting that track down an inch and snapping it in place.
As an aside, these articles are the gems that keep me coming back to HN.
Now because I work in a textile mill, the tolerance I usually get is 0.125 inches which is huge. I usually go all the way down to 0.0001 inches because I think it's funny, and also I do have aspirations beyond just working with textiles.
Several days and derivations later, the theorist reports the volume, after which the experimentalist tosses the shape into a volumetric flask and determines the volume by looking at the difference in flask volume levels. (I am unable to track this story down to its original)
You can scroll to the bottom of the comments to see a few of them.
However if I’m any guide, a basic game ends up with me fighting a broken soldering iron or a bug in some language I don’t understand while the kid asks if we are there yet.
Märklin C-track is sectional too, but has rather tight tolerances for assembly. There is no flex C-track. A computational method for solving parts lists and connection plans would be fantastic.
Currently people do it "by hand (virtually)" with a variety of apps, but that is labor-intensive.
Where is the combinatorial algebra?
I have a lot of Duplo, some are new, some are 20 years old and went through a few toddlers. I can feel difference in tightness. The new ones are much better. Maybe Lego did improve the quality of the Duplo overtime, or they are simply less used.
In my case, I also find the old transparent bricks to not hold so well. They don’t handle much load before detaching.
https://bricks.stackexchange.com/questions/38/are-duplo-bloc...
Interestingly you can build things that incorporate Primo, Duplo and regular Lego bricks!
Same manufacturing quality. Or even stronger design and QA checks as it is expected that toddlers will play with them.
Does this indicate any sort of predilection for math or for engineering ? Or is it just a usual sort of kid behavior ?
However the question is false in its initial assumption, i think: if theres too much tension anywhere in the string that joint will separate. These pieces are designed to do that.
Perhaps a better way of stating it would've involved the gaps between sections where there might be too much space and lead to derailment.
The maximum gap should then be in theory be around 2-3 mm, if this drawing is accurate:
https://www.eurobricks.com/forum/index.php?/forums/topic/193...
https://i.servimg.com/u/f13/17/36/35/47/geom110.jpg
But in practice due to the interlocking design, see here:
https://www.onemetre.net/OtherTopics/Duplo/Track%20dims/Dupl...
there won't be any added gap (besides the ones due to the tolerance in the interlock), the pieces will deform along their length making no gaps capable of derailing at the juctions.
Probably need to define "too much tension". Is a bit of tension that enables you to build the thing you want and couldn't otherwise, a good or a bad thing? (e.g. maybe I want a spiral)
I'd have thought if overly tensioned, once tolerances were overcome, the track would develop a camber. Maybe build on a perfectly flat, frictionless surface and then if your track isn't perfectly level you know there's tension.
the stack overflow answers are math.
Try thinking for a few seconds before posting such a meritless dismissal.
That gives you the impression that goldcd fully comprehended the scope of the inquiry?
I suppose if the track is big enough then you would be able to insert a "wrong" piece without necessarily using up all the slack, so the pieces would still be somewhat loose. But in that case there would be no mechanical concern to worry about.
Actually I suspect that it suffices to check one piece. If any piece is in tension then they all will be, assuming friction with the floor is not too large. Unless you have intersections in the track, then you have to check each loop separately, or maybe you could just check the switch pieces. Might be an interesting math problem there to minimize the number of pieces to check in complex tracks.
I'll also point out that bending Lego pieces isn't always bad: https://youtube.com/@BrickBending
> I know I could just take one piece out, and put it back in to feel it myself, but I am looking for a more logical way
Since that's the "puzzling" stack exchange, I think they were looking at this more as a logic problem than a real practical problem they needed to solve.
I am sure this could be calculated mathematically, but I prefer a more quick, practical way.
Jiggling is way more practical than having to do many additions against a lookup table.The asker severely underestimates the amount of force it takes to break a Duplo piece.
...my foot on the other-hand...
We can also observe this (to a lesser degree) when they build two story Lego statues like at the Mall of America.
I'll admit I've never seen a huge Duplo statue, but I assume the load limits are similar.
Thus an adult human male (who sleeps, say, 10pm to 6am) is less likely to break a lego brick at 2am than at midnight and more likely than at 4am.
https://stepinmath.wordpress.com/2016/08/27/logic-with-the-c...
A quick but incomplete algo is to ensure an even number of curves and straights. With them even, a bent track needs to be very bent so as to be immediately obvious.
Due to economy of scales, Lego can manufacture those at consistently high quality and relatively reasonable prices. Competition aiming for same quality would be at least similarly priced. Also, its incredibly sturdy. So far I haven't seen a single one crack or break in past 2 years. My kids are not psychos but they for sure have no idea yet about treating their toys with care.
> Not really an answer to the question as posted — but I think the premise needs some good parenting advice: let your kids break bricks. They are pretty darn durable anyway and fabulously cheap to replace. So when they break one they will begin to learn about over-stressing materials through their own experiences
Duplo, while expensive, is a consumable, if you look at it through this old man's eyes.
Now that that's out of the way, I love all the answers here.
Even less convoluted: the tracks must be assembled in a shape, and so are a sort of puzzle. The asker is asking a question about the geometry of the puzzle.