
r/3Blue1Brown

An interactive mod8/mod24 Collatz Graph visualizer
In a previous post I discussed the notion of a Collatz overlay built from 5 mod 8 and 0 mod 3 nodes. One refinement here is that there are nodes of in-degree 2 that are not 5 mod 8 (they are relatively rare - the exceptions I see are 1,23 mod 24)
This visualization allows you to see all 4, odd mod 8 nodes and in fact classifies them according to mod 24 too.
You give it a starting point with the ?a= parameter and then you can extend the graph is you like by clicking on a node.
This a fantastic way to develop an intuitive understanding of mod 8 and mod 24 Collatz dynamics.
https://wildducktheories.github.io/collatz/apps/collatz-graph/dist/?a=27
A fun game to play is greedily clicking on the red dots and then on 1,2 mod 3 nodes that result from such a clicking.
Does that game ever end? I think not.
H64LM: A 249M-parameter Mixture-of-Experts Transformer built from scratch in PyTorch
Hi everyone,
I built H64LM, a research project to better understand modern LLMs by implementing one from scratch in PyTorch.
Instead of relying on high-level training frameworks, I implemented the core components myself attention, MoE routing, normalization, and the training loop.
Features
- 249M-parameter Transformer
- Grouped Query Attention (GQA)
- Sparse Mixture-of-Experts (8 experts, Top-2 routing) with 3 auxiliary routing losses
- SwiGLU, RoPE, RMSNorm
- Sliding-window attention
- Mixed-precision training, gradient accumulation
- Custom training loop (no Trainer abstractions)
- Checkpointing and resume support
The included checkpoint was trained on a subset of WikiText-103 to validate the pipeline end-to-end, not to be a strong model it's visibly overfit past epoch 10 (best val PPL ~40.5).
Known limitations are documented in the README, including batch-size-1-only generation and no true DDP (falls back to DataParallel).
GitHub: https://github.com/Haiderkhan64/H64LM
Feedback on the implementation or architecture is very welcome.
TPP: The Obscure Matrix Multiplication Algorithm That Deserves More Attention
leetarxiv.substack.comMath Videos for Kids (Elementary): Multiplication Using Split Grids
A visual, bite-sized mini-lesson for elementary school kids that bridges the gap between counting and algebra.
Videos also available at:
Code available at https://github.com/zombimann/Mathematical-video-animations-and-visualization/blob/main/Kids_Elementary_Multiplication_Using_Circle_Grids.ipynb
You might also like https://np.reddit.com/r/3Blue1Brown/s/syRS2ZK39H
Control Systems: Block Diagram Simplification
This visualizes the reduction of control systems block diagrams into their equivalent transfer functions.
Videos also available at:
Instagram
Youtube
Github
Whatsapp
Tiktok
Code available at https://github.com/zombimann/Mathematical-video-animations-and-visualization/blob/main/Control_Systems_Block_Diagram_Simplification.ipynb
You might also like https://np.reddit.com/r/3Blue1Brown/s/hK6CRW5aLe
How many cones does it take to cover a unit sphere, and how far away are their vertices?
This is a fun problem that I am realizing I don't have the geometry for. I was thinking about it the context of a teleporting spaceship surveying a idealized spherical planet.
- How many points would it need to survey from to get a complete map of the planet's surface?
- How far away from the planet's surface would they be?
Put more mathematically, if x is the distance from the surface of the unit sphere, f(x) = # of tangent cones required to cover the sphere with minimal overlap.
The answer to question 1 already partly exists, but it's not as trivial as it seems. Cones tangent to a sphere ultimately just describe some circle on the sphere's surface, so another way to phrase question 1 is 'how many circles of equal size does it take to cover a sphere?' It turns out this is a covering problem related to the Tammes packing problem, there's a 1991 paper on it here. Obviously the maximum number of cones you can have is functionally infinite as x approaches the limit of 0, but the minimum number of cones is 3.
As for question 2, the linked paper gives us solid figures for n circles covering a sphere, but not for every value of n. We know 2<n<15 except for n = {8,9,11,13}, and for 15 and above we don't have proofs, just conjecture. The figures for circle density on the surface of the sphere could be reverse engineered to give the vertex distance of the corresponding tangent cones, but that's where I get lost. I'd be curious what the values are though, and what they look like as a graph of f(x) as laid out earlier.
Another way to phrase the problem is "How many cones does it take to cover the unit sphere if all their vertices originate on a larger concentric sphere, and how does the number of cones change as the size of the larger sphere changes?"
I hope someone else finds this interesting, I've been fascinated by it since I concocted the problem. It's fun to find out that a thought experiment you came up with listening to an audiobook doesn't have a complete solution available in modern mathematics!
Three geometric routes to QR decomposition in 2D: Gram–Schmidt, Givens and Householder
We previously posted separate 3D animations of QR decomposition by Gram–Schmidt, Givens rotations and Householder reflections.
Here is a 2D comparison of the same three geometric routes.
The goal is to show that all three methods reach the same kind of result, A = QR, but by very different geometric actions:
- Gram–Schmidt: subtract projections and normalize
- Givens rotations: rotate selected components to zero
- Householder reflections: reflect vectors across chosen lines or planes
In 2D, the Givens case is almost trivial: only one rotation is needed to zero the lower-left entry. In higher dimensions, Givens QR proceeds by many such rotations, one entry at a time.
One detail worth noticing: Gram–Schmidt, in its standard form, produces positive diagonal entries in R. Givens and Householder versions may produce different signs depending on rotation/reflection sign choices. This is normal: QR is unique only after an extra sign convention is imposed, such as requiring positive diagonal entries in R.
More explanation and the 3D versions are here:
https://www.graphmath.com/la/visuals/qr/qr-three-geometric-routes.html
We will also add these 2D animations to that page.
We welcome feedback on clarity and presentation.
Magnus Effect 2D CFD Visualization
This video demonstrates a high-fidelity 2D simulation of the Magnus effect by modelling the trajectories of spinning spheres falling through a fluid medium.
Videos also available at
For code click https://github.com/zombimann/Mathematical-video-animations-and-visualization/blob/main/Bernoulli_Equations_Magnus_Effect.ipynb
You might also like https://np.reddit.com/r/3Blue1Brown/s/qxXGRIK2m2
Generative 3D space-filling curve (Hilbert curve, order 5) : Python and Manim
A recursive algorithm, iterated as the curve winds through the entire volume of a cube.
Each step replicates the previous shape 8 times : order 5 already generates 32,767 connected segments, all from a single continuous line.
Full video : Generative 3D space-filling curve
Eigenvectors and eigenvalues across 2D transformations — three animated comparisons
We made three animated comparisons showing how eigenvectors and eigenvalues behave across different families of 2D linear transformations.
- Non-symmetric matrices with real eigenvalues, where the eigenvector directions need not be perpendicular
- Symmetric matrices with real eigenvalues, where the eigenvector directions are orthogonal
- Real matrices with complex eigenvalues, where no nonzero real direction remains on the same line
In each animation, the transformation develops continuously from the identity matrix to the displayed matrix. The goal is to make the difference between these three cases visible rather than only algebraic.
Full-size animations and explanations:
https://www.graphmath.com/la/visuals/eigenvectors-eigenvalues-2d-transformations.html
As always, we welcome feedback on clarity and presentation.
Gravitational Waves and Spacetime
The simulation focuses on the geometric nature of gravity, illustrating how mass distorts the fabric of spacetime and how accelerating masses generate ripples known as gravitational waves
More videos available on
Instagram
Youtube
Tiktok
Whatsapp
Github
For code click https://github.com/zombimann/Mathematical-video-animations-and-visualization/blob/main/Gravitational_waves_3D_Space.ipynb
You might also like https://np.reddit.com/r/3Blue1Brown/s/jpzFVtaZrE
Abstraction vs Reality
in radians, an angle is defined by θ =S/R). So if two circles have the same ratio. Do they really have same "angle"?
Or is it just mathematically same "angle"
For example
A circle s=1, r=1, θ=1 radian
B circle s=100, r=100, θ=1 radian
Mathematically they are indeed same "angle" but in real world they have very different physical separation.
How to Make a 2D Floorplan
Drop a ball, and the Earth moves too — here's the visual proof
Newton's third law says the ball pulls Earth with exactly the same force Earth pulls the ball. So when you drop something, Earth genuinely accelerates upward to meet it — not a metaphor, an actual motion.
The reason nobody's ever felt it isn't that the force is smaller. It's identical. It's that acceleration is force divided by mass (a = F/m). The ball's tiny mass turns that shared force into ~9.8 m/s². Earth's mass turns the exact same force into about 10⁻²⁴ m/s² — real, just far too small to ever register.
Made a short trying to visualize that asymmetry with the two force vectors side by side. Curious if there's a cleaner way to show "same force, different consequence" than what I went with.
Made a video in bevy using MotionGfx & Velyst!
A while ago I posted my progress on Velyst, on rendering Typst in realtime game engine bevy. This time I want to show you something I made using it, combined with motiongfx, my motion graphics engine!
Link to YouTube (if u care to like & subscribe!): https://youtu.be/\_OGOaunoqMU?si=FdNhB16KqYBXJEqE
The Oddness of HD, a bizarre linear system
A bizarre linear system for neural networks applications:
https://archive.org/details/the-oddness-of-hd
One softwarez is:
https://archive.org/details/hd-dh-hd-dh-graph-viewer which we looked at before.
Another softwarez is: https://archive.org/details/h-12-d-dynamics
but that is for the atypical H₁₂ system, but you can still see the oscillations in some configurations. If you switch configurations you can see transitory oscillations as well. That is not due to dissipative effect, it is due to energy only slowly draining out of the old oscillation modes into the new one.
I keep getting banned on physics and neural network forums about this, where it might more properly be discussed. They really are incapable of absorbing information from "orthogonal" channels.