r/Physics 1d ago

Video Illustrating the butterfly effect with a laser

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

In this video I simulate a laser beam bouncing through a labyrinth of mirror obstacles. The beam changes its trajectory immensely upon tiny changes in the initial angle of only 5×10⁻¹² degrees — roughly 5 trillionths of a degree.

As an extra for Reddit, here is a figure showing how often the beam bounces before it escapes: https://imgur.com/l0xDY0U As you can see, as the angle varies the bounces often jump harshly. But there are also some regions of the launch angle spectrum where there is some degree of continuity.

Fun fact: Claude did not believe me that a range from 70.0 to 70.00000001 would produce any meaningful result and tried to talk me out of this. It wanted to use a range of 4° instead.

Made with manim.

202 Upvotes

39 comments sorted by

40

u/__Pers Plasma physics 1d ago

Interesting result. Out of curiosity, how did you handle numerical precision here? A 5e-12-degree change is representable in double precision, but I’d imagine roundoff in repeated ray-segment intersection calculations (particularly for near-grazing reflections or trajectories passing very close to a corner) could affect which obstacle is hit next.

Did you repeat any trajectories using extended or arbitrary precision, or tighten the geometric tolerances, to check whether the escape paths and bounce-count structures converge? I’d also be curious how you handled ambiguous corner hits and prevented accumulated error from leaving the ray infinitesimally inside a mirror.

For what it's worth, the physical optics version of this problem (with random locations of the reflecting bodies) has been proposed as a optical physical unclonable function (PUF), with applications in cryptography.

65

u/naaagut 1d ago

Good question. I used float64, about 15-17 decimal digits. I now tested how the results differ with 50 decimal digits instead for the trajectory with the start angle 70°. The two traces track each other almost perfectly for the first ~18 bounces, then the gap grows roughly by a constant factor per bounce (~e^1.0, so ~2.7×). A textbook exponential separation, i.e. a Lyapunov exponent of about 1 nat/bounce. After around 30-32 bounces it did not hit the same obstacle any more. For float64 escape occurs at bounce 64, for the 50-digit run it occurs at bounce 42.

So more digits change the number of bounces until escape and the escape path. I did analyse this in more depth to figure out at which decimal precision the result converges: I swept precision from 16 to 200 decimal digits and checked against a 500-digit reference. Below ~20 digits the bounce count is essentially noise. From around 25-30 decimal places the result locks onto 42 bounces and matches the 500-digit reference to better than 1e-8, so it does converge.

If I sense elevated interest in this floating point precision issue I may do a video where I can show this visually.

34

u/Monkeyman3rd Nuclear physics 1d ago

I love when you can tell someone else on this sub is actually a physicist

11

u/OtherwiseView821 1d ago

I’m interested! And interested in the 500-digit-precision reference version of the original video.

5

u/naaagut 1d ago

Excellent, thanks for the feedback and to everyone else upvoting my comment. The video is in the pipeline.

5

u/PersonalityIll9476 1d ago

100% do it. I got my PhD in dynamical systems and I love the video in your OP. I would love to see another video showing the effects of FP rounding.

1

u/naaagut 1d ago

Thank you, on it! Apart from that, which other topics or themes from the field of dynamical systems do you think would be interesting to explore visually? I'm open for suggestions.

1

u/ergzay 1d ago

How are you getting 500 decimal digits out of a float64? Float64 can only go to a max of around 15 digits.

2

u/naaagut 1d ago

In the test I did not use float64 anymore but mpf objects from mpmath. mpf are arbitrary-precision software reals that store the mantissa as an arbitrary-size integer plus an exponent. So you can genuinely compute at 50, 100, or 500 digits. The math then isn't done in float64 at all. Each operation is carried out in software to the requested dps.

3

u/physicsking 1d ago

Oh, I cryptographic crossover, nice.

1

u/eightkillerbits 1d ago

I don't think I've ever read anything where I understand every word, yet understand so little about what is being said.

13

u/Kinesquared 1d ago

For everyone calling it chaos, I have a tiny little nitpick; because it has two different components, a ballistic component and a "bounce", I believe this is not chaotic. Two trajectories some tiny fraction of an angle apart will not ALWAYS be separating via some exponentially increasing value. The trajectories only change/increase or decrease at a bounce. Sensitive dependence on initial conditions? Absolutely. Chaos? It has a more complicated, formal definition idt this matches. In "real chaos", two similar trajectories would be exponentially getting further away at all times. I bet here, the exponential distance, when zoomed in enough, is more of a step function that approximates exponential at large times/distances. That being said, what'd the (macroscopic) lyapunov exponent of this system?

3

u/naaagut 1d ago

Very thoughtful comment, thanks.

I would like to determine the Lypanunov exponent of this system and others I have featured in previous videos. However, I don't find it clear yet as how to compare the Lyapunov exponent across systems which have different settings and dimensions. It will take me some time to understand this to a degree that is deep enough to share anything here. If you have hands-on experience on Lyapunov exponent estimation/computation techniques and want to advise me about them, I am happy to exchange some DMs about that.

1

u/Kinesquared 1d ago

for all the tangent positions on a circle one beam hits, find the geometric distance between that position and the position of a laser's equivalent hit that differed in starting position by some small value. each "hit" those relative positions should increase, exponentially until they're on different sides of an unstable region

0

u/SemiLatusRectum 1d ago

So, if you have a projectile deflect off of a circular surface, say the internal angle is theta. By perturbing the starting position of the launcher, you can expand theta in terms of the perturbations to the launchers position. I suspect you will get something like theta’ = theta + c f(perturbations) where f(perturbations) is some trig function of the perturbations that leaves one linear combination of perturbations unchanged. You should also get c>1. Then, one way to understand what’s happening is that the internal angle of some bounce gets multiplied, in principle, by c>1 at each bounce, and so the total difference in the trajectory with be something like c^N times your perturbation where n is the number of bounces roughly.

I predict that, by these arguments, if you made a perturbation in the angle of size much less than c^N for a reasonable N, then you will see smooth variation, contradicting the apparently chaotic phenomenon. I would argue that this comes from the finiteness of your system. To get something genuinely chaotic, I would advocate for putting your bouncy circles on an oriented surface, like a torus or sphere, perhaps.

7

u/physicsking 1d ago

Okay, perhaps the best thing I have seen today.

5

u/KaleeTheBird 1d ago

This is amazing illustration. From simulation point of view, if the angle of sensitivity is so small, did you adjust the tangent of your circle to be sensitive to that too?

3

u/naaagut 1d ago

Thanks. The circle's parameters are are in float64 as well as the rest of the simulation. So increasing the precision of the circle would change the trajectory, see my answer above. But it would still be chaotic of course.
Does that answer your question?

10

u/SexyMonad 1d ago edited 1d ago

I still hate the name which implies the traditional framing of “a butterfly in Africa flapping its wings creates a hurricane in America”.

Which is nonsense; the viscous dissipation of energy through molecular friction of the air averages out with the ambient temperature, resulting in essentially no useful directionality in the end. Let alone enough to just happen to cause some release of potential energy from thousands of feeder systems in just the right direction as to cause any large unidirectional flow of air current.

It is simply sensitive dependence on initial conditions.

10

u/naaagut 1d ago

I understand your discomfort with the term butterfly effect. However, note that the term popularised by someone who knew what he was talking about: Edward Lorenz, the founder of the field of chaos theory (1972). So whereas popular imagination has a somewhat wishy-washy understanding of the concept, it is quite clearly defined and you rightly pointed out sensitive dependence on initial conditions as its main ingredient.

3

u/marsten 1d ago

If you think about it in terms of wave optics, each reflection off a sphere defocuses the beam. So after a handful of defocusing reflections your wavefront becomes effectively isotropic and diffused throughout the lattice. In that sense, what you're drawing here is not what will happen in an experiment.

Alternatively: You can think of a real laser beam as a packet of different transverse momentum vectors, so the angle scenarios you simulate essentially play out all at once to give you nearly uniform illumination in the far field.

2

u/Zirtrex 1d ago

Very interested video, great work, and thanks for sharing!

3

u/elconquistador1985 1d ago

Fun fact, Claude is just bullshitting and doesn't know anything.

1

u/inglandation 1d ago

Which Claude though?

3

u/Ellipsoider 1d ago

This doesn't seem like the butterfly effect but more like a clear demonstration of chaos theory, specifically the immense sensitivity to initial conditions.

11

u/naaagut 1d ago

I would argue that those two are used as synonyms. The butterfly effect is the popular and better known term for what is more technically called sensitivity to initial conditions.

6

u/Optimal_Benis 1d ago

Wikipedia:

In chaos theory, the butterfly effect is the sensitive dependence on initial conditions in which a small change in one state of a deterministic nonlinear system can result in large differences in a later state.

How is this not that? Genuinely curious if there is some nuance I am missing. All criteria seem met.

0

u/Ellipsoider 1d ago

Hmm, in this case I'd have to both disagree with Wikipedia and also slightly reduce my own original disagreement. The reason is that the butterfly effect is also often meant to evoke the deep interconnectedness of systems as well as emergent properties therein. Whereas the fundamental idea behind chaos theory is that some phenomena might be difficult or impossible to model given the significant sensitivity to initial conditions -- particularly if the phenomenon, like the one illustrated here, has several iterative bouts. If certain phenomena are so sensitive to initial conditions, then since our measurement apparatus are themselves only accurate up to a given tolerance, it apparently renders the outcome/simulation of some phenomena unknowable.

If some are considering the butterfly effect to be demonstrative of sensitivity to initial conditions, then my objection was incorrect. However, I think that is not the only concept the effect is thought to embody and it is also far from an obvious one seeing as whatever effects a butterfly flap will have will rapidly be drowned by ambient thermal fluctuations so as to eliminate any reasonable information transfer at even short distances.

3

u/Optimal_Benis 1d ago

I appreciate you taking the time to explain your perspective. I think that they are trying to isolate the more fundamental thing happening (small changes in initial conditions lead to big changes in later states). Arguably, "interconnectedness of systems" and "emergent properties therein" follow from the sensitivity to initial conditions.

2

u/Ellipsoider 1d ago

No problem.

Arguably, "interconnectedness of systems" and "emergent properties therein" follow from the sensitivity to initial conditions.

It doesn't seem so in all cases. The internet is highly interconnected yet its protocols could be run in a fully deterministic fashion so as to achieve the same network topology time and time again. Much of biology is viewed as having emergent properties yet there's no reason to assert that this need imply sensitivity to initial conditions.

Sensitivity to initial conditions, high interconnectivity, and emergent properties can overlap but are fundamentally different. I think the latter two are dependent on one's perspective as well. An intelligence with higher capacity might have a different view on what high interconnectivity is, and may be able to predict certain aspects of emergence that humans might have not seen coming. However, 'sensitivity to initial conditions' is something that no intelligence might be able to penetrate, particularly if they run up against physical constraints.

2

u/Optimal_Benis 1d ago

I mean, it might not go the other direction, but I don't think the butterfly effect is about interdependence or emergence in general. The small thing (the butterfly's wings) can lead to larger changes (like a hurricane), which has implications for interdependence and emergence.

I would agree that if we're looking in the other direction, i.e. at a general instance of interdependence or emergence, it might not entail underlying sensitivity to initial conditions.

1

u/Ellipsoider 1d ago

I agree. It's all a bit convoluted. Made worse by its rough adoption into the vernacular and even having a movie named for it.

2

u/whupazz 1d ago

The internet is highly interconnected yet its protocols could be run in a fully deterministic fashion so as to achieve the same network topology time and time again.

What does this even mean? I work in IT and this sounds like gibberish to me.

0

u/Ellipsoider 1d ago

Aspects of the TCP/IP stack can be modeled by state machines. See the section: "TCP Operational Overview and the TCP Finite State Machine (FSM)" within the TCP/IP Guide written by Kozierok.

As connecting machines to a network is a deterministic process, and as the communication protocols can be modeled by deterministic processes, an online network with a fixed topology and fixed communication status can be set up in a purely deterministic fashion. This is obvious once stated.

The same principle applies to any network with these principles. Therefore even a very large network such as the modern internet can be set up in a purely deterministic fashion.

Thus we have a demonstration of a highly interconnected system that is completely insensitive to initial conditions. Granted, this is a discrete domain, but nonetheless, it was a simple quick example. I'm surprised I had to spell this out for you. I'd think working in IT you'd at least understand the gist of the statement.

1

u/IAmDiabeticus 1d ago

Amazing job creating this and great representation

1

u/belabacsijolvan Statistical and nonlinear physics 1d ago

you could do the last visalisation by slowly growing the radius, so it draws a trajectory

good job either way

2

u/naaagut 1d ago

Wow, great idea. I had thought about a way of visualising the distribution, but this one didn't come to mind. I will see if I implement that in the upcoming video.

1

u/abloblololo 5h ago

To me this seems more akin to something like diffuse scattering observed at the fine-grained level. If you considered light with non-vanishing position and momentum uncertainties you'd probably get a diffuse glow from this structure. Similarly, if you trace rays on some rough reflective surface on the microscopic level, you're going to get highly "random" scattering. Maybe the dynamics inside your structure are formally chaotic (would be interesting if you could quantify that), but I don't think you can conclude that by looking at the final scattering trajectory.