Hacker News new | past | comments | ask | show | jobs | submit login
Structure and Interpretation of Classical Mechanics (mitpress.mit.edu)
294 points by dennybritz on May 12, 2020 | hide | past | favorite | 40 comments

This is a great book but a bit dense first. At a high level it goes through physics with an optimization viewpoint, as in find the actions that minimize a system's energy to figure out how a system will evolve.

I would strongly suggest you learn Lagrangian and Hamiltonian Mechanics from this book first [1] since it comes with many more illustrations and simple arguments that'll make reading SICM much easier. If you don't have time to read a whole book and want to get the main idea I've written a blog post about Lagragian mechanics myself [2] which has made it to the front page of Hacker News before. The great thing about SICM is that it's a physics textbook where the formulas are replaced by code [3] which you means you can play around with your assumptions to gain intuition for how everything works.

IMO I believe in introductory physics we overemphasize formalism over intuition and playing around with simulators is a truer way to explore physics since most physical laws were derived via experimentation not derivation. Another book that really drives this point home is [4]

[1] https://www.amazon.com/Jakob-Schwichtenberg/dp/1096195380/re...

[2] https://blog.usejournal.com/how-to-turn-physics-into-an-opti...

[3] https://github.com/hnarayanan/sicm

[4] https://natureofcode.com/

"find the actions that minimize a system's energy" That sounds incorrect.

The path taken by the system between times t1 and t2 and configurations q1 and q2 is the one for which the action is stationary (no change) to first order. https://en.wikipedia.org/wiki/Principle_of_least_action

The reason for this is quantum mechanics https://en.wikipedia.org/wiki/Path_integral_formulation

Yes you're correct, I'm just giving the intuition that I found helpful to understand the Principle of Least Action.

> The reason for this is quantum mechanics https://en.wikipedia.org/wiki/Path_integral_formulation

This is incorrect. You dont need QM to formulate, derive or use the LAP. This makes even less sense in the context of the book.

"Its classical mechanics and electromagnetic expressions are a consequence of quantum mechanics, but the stationary action method helped in the development of quantum mechanics."

That is a direct quote from the article in Wikipedia which refers to Feynman's popular book "The character of the physical law". In that book Feynman DID NOT claim that the theory of Quantum Mechanics implies the PLA for classical mechanics, relativity or EM. The closest statement Feynman wrote in that book is this: "In fact it turns out that in quantum mechanics neither is right in exactly the way I have stated them, but the fact that a minimum principle exists turns out to be a consequence of the fact that on a small scale particles obey quantum mechanics." This is a very different statement and it shows a misunderstanding from the Wikipedia editor (and it seems you too). Here Feynman explicitly claims that the fact that there is a PLA in QM is a consequence of small particles obeying QM , that is , they are equivalent.Same way as the fact that particles obey Newton's Laws imply the existence of a principle of least action in classical mechanics, as formulated originally by Lagrange.

This has nothing to do with Feynman. The deep mystery is always why does nature work the way it does. The QM phase answer provides a deep explanation for why least action occurs at a classical level. I am not sure what your educational background is but QM and Classical are far from equivalent. QM looks like classical under many macro situations.

The quote you wrote exclusively referenced a Feynman book (I suggest you to check your sources), so it was you who brought up Feynman.

> The QM phase answer provides a deep explanation for why least action occurs at a classical level.

No, it does not. The phase in a QM state provides the intereference of the probabilities, which is an integral part in the calculations on the many-paths formulation of QM, it has NOTHING to do in the classical sense.If that is true, please derive the GR action from QM, if you do so a Nobel prize and a seat along Newton and Einstein are waiting for you.

> QM and Classical are far from equivalent. QM looks like classical under many macro situations.

These two statements are contradictory.Maybe you are misremembering the Ehrenfest theorem. If that is the case you are confusing the expectation value of a physical quantity in QM with an actual physical measurement.

Great intro. Your link #2 leads into the rabbit-hole CS treatment of classical physics (via automatic differentiation, and, less obviously, type theory). Here's that HN thread accompanying your blog post from 6 months ago


On the matter of automatic differentiation, if you check out the scmutils source code, there's been an ongoing effort spanning ~a decade to fix a very subtle bug...

Is there a way to get a better preview of Schwichtenberg's book than what Amazon offers? "Surprise Me" is completely useless these days, it just alternates between the first and last few pages.

He has a pretty good blog you can check out http://jakobschwichtenberg.com/

But honestly the book is very cheap relative to how good it is IMO

[2] is pretty cool article. It might be the first time I have understood optimization from a mechanics perspective correctly. Thanks for sharing. PS: there are still some errors in the blog I found (Theta, M (not m) in moving cart figure)

Thank you, that means a lot - you are right there are still some small errors that I need to go through and I'd be very grateful if you let me know of any more you find

I love what I've read of this book, but found reading the HTML version on the MIT website a bit of a chore. Here's my attempt at applying Andres Raba's wonderful SICP layout (https://sarabander.github.io/sicp) to SICM: https://tgvaughan.github.io/sicm

Do you have a PDF export using this lovely theme? I found the SICP Epub and PDF versions (with that theme) to be the most readable version to date.

Thanks ... that looks great! I always preferred Sara Bander's HTML version of SICP to the PDF version that is available for free download at everyone's favorite online bookstore.

If someone is looking for the PDF format of SICM, that's available now too for the second edition.

Where would that be?

SICM has been on my list of things to study for years, but I haven't made it much past the delightful preface:

> When we started we expected that using this approach to formulate mechanics would be easy. We quickly learned that many things we thought we understood we did not in fact understand. Our requirement that our mathematical notations be explicit and precise enough that they can be interpreted automatically, as by a computer, is very effective in uncovering puns and flaws in reasoning. The resulting struggle to make the mathematics precise, yet clear and computationally effective, lasted far longer than we anticipated. We learned a great deal about both mechanics and computation by this process. We hope others, especially our competitors, will adopt these methods, which enhance understanding while slowing research.

This second edition is from 2015, following the 2001 first edition.

Unfortunately, unlike SICP, it does not seem to be under a free license, so it is not legal to translate it into Spanish or produce a reformatted digital version that incorporates an actual Scheme interpreter.

The second edition is CC-BY-NC-SA. (This is indicated inside the cover of the print edition.)

[Edited to add NC.]

Oh interesting! Do you have the print edition? The copy on Library Genesis does indeed seem to contain that license, but someone could have added that when they uploaded it to libgen: https://libgen.lc/ads.php?md5=968F60C358A99A61A2A0FD7502F476...

The Google Books copy that MIT Press links to as the "Preview" includes the CC license:



So it does! Thank you very much!

There's a ton to learn from this book, especially if both Scheme (or functional programming in general) and the Lagrangian and Hamiltonian formulations of mechanics are new to you as they were to me when I first came across the text online. I ended up taking the class in person and seriously enjoyed it. It was a big reason I switched my major from CS to physics, which I mean in the best way possible! I think the authors were right in their assessment that Lisps are really well suited to mathematics, and especially the type of math you see in working with Lagrangians: function composition and partial application. Plus there's the cool benefit of being able to write code that looks at other code and writes its derivative as a new program!

The two small warnings I would share with someone starting this book are

1) they introduce some of their own notation to clarify, i.e., what various derivatives mean, but this notation is different than what is found in other texts

2) it ramps up pretty quickly from solving a double pendulum to much higher-level stuff like Lie transforms and perturbation theory - it's a lot to keep in your head all at once. Don't get discouraged if you hit a wall and need to come a couple days or weeks or months later - I definitely did, and it is still fun to try to go back and make it through the harder parts. Highly recommend!

This book's amazing. I've only tried to understand the first few chapters so far but I found the basic idea -- reformulating the Euler-Lagrange equations in lisp, and using Spivak's alternative notation for differential calculus -- to be extremely illuminating and even inspiring when going back and trying to really make sense of (advanced) undergrad calculus.

OK, so here's my question: the scheme is great and all, but wouldn't this really benefit from a statically typed language with a rich type system? I think it would be really interesting to try to make the computations at the type level correct as well as at the runtime level. Obvious candidates I guess are Haskell/OCaml etc, or one of the theorem-proving languages (out of my depth here, but Lean/Coq etc).

I have said this before...another HN thread on SICM: https://news.ycombinator.com/item?id=21460106

I have been interested in doing this for a long time, and have thought about doing it in Haskell. It would be a lot of work, and some of the type decisions that would be needed would probably complicate the UX of the software (the automatic differentiation of functions of various shapes would make typing the D operator interesting; I think it would force all real-valued functions of a real variable to look like they were working in a vector space of dimension 1, or the inconsistency would be maddening). SICM's software also does a lot of "lowering" of types, so 0 (zero) is kind of a universal additive identity, but in a strongly typed system you'd need zeros of many different kinds and it might be that once all this was finished there was too much "wrapping" left visible and the scientific investigations in the SICM spirit would lose some of their charm. I guess that's a long-winded way of saying that there are lots of type puns in mathematical notation that are useful affordances even if they are slightly abusive.

Thanks that was very interesting to hear your thoughts. If you do ever decide to work on this again, I'd be interested to know and probably in helping. Others in these threads have expressed interest too. But yes, it does sound like rather a lot of work for a slightly esoteric cause. My contact details are in my profile.

Making the computations type-level correct would be really neat! That'd be a huge improvement!

I don't think the language needs to be statically-typed to do that. I could easily extend Scheme or Python to support that. All you need to do is make sure that if you add 5 meters to 5 seconds, you raise an exception. There's no reason that exception has to happen at compile-time.

Going Scheme -> typed Scheme is a manageable step which I could envision taking a few weeks of hard work. Changing languages would be an incredible amount of work (especially with things like the JIT compiling MIT-Scheme does for SICM, where you can symbolically derive equations of motion, compile them, and run them as high-performance native code).

I've been using programming to teach kids math and physics, and the lack of units IS a serious pedagogical problem. I think that's doubly true here.

I think you're really onto something.

I have done the translation from Scheme to Clojure which raises the possibility that some of the typing could be done gradually with spec; I haven't worked with typed scheme. There's a lot of code in the simplifier which is designed to work with S-expressions containing symbols. Changing them to work with an enriched type carrying unit information would be a big undertaking

I have been thinking about doing it in OCaml for a while, but it will take an insane amount of work and this always put me off

If you are more mathematically inclined, there's also "Functional Differential Geometry" by the same authors, and in the same spirit, but much shorter. The goal of the book is essentially to write the Euler-Lagrange equations in lisp, which is a breathtakingly beautiful thing.

Which is also especially beautiful, and open access as well: https://mitpress.mit.edu/books/functional-differential-geome...

I posted this because it was recommended to me several times in [0], together with several other "computational approaches to Physics" books, and thought it would be interesting to HN users. If you're looking for more books like this, the whole Twitter thread is worth a read. It's full of good recommendations.

[0] https://twitter.com/dennybritz/status/1260137814982787073

I have a hard copy of the first edition. The dedication says: "dedicated to the principle of least action"

I have an educational resource for introduction to Hamilton's stationary action. The title is "Least action visualized".


The diagrams on the page have a slider for active exploration. Moving the slider sweeps out a range of trial trajectories. As you change the trial trajectory the diagram shows how the graphs of the energies come out accordingly.

In this resource Hamilton's stationary action is introduced in a two-stage process.

First stage: We have the Work-Energy theorem, which we can apply with equal validity in infinitisimal form. The true trajectory has the following obvious property: at every instant in time the rate of change of potential energy matches the rate of change of kinetic energy. Demanding this match as a condition we identify the true trajectory among the range of trial trajectories. That is, this initial stage is already variational approach, but it doesn't yet use the concept of action.

Second stage: Demonstration of moving in a single step from the first stage to Hamilton's stationary action.

The demonstration is for the simplest case: a uniform force, hence a linear potential. The reasoning generalizes to all cases.

I did a read through last year and thought it was great. Having to actually tell a computer how to do Langrangian and Hamiltonian mechanics makes you learn it really well. Pointed out some of the interesting reasons behind why we choose or Langarangians/Hamiltonians the way we do that I didn't appreciate during undergrad.

One of the good things I felt about the book, though I have read only a few chapters is that, the use the Scheme-based system, has made the notation more concrete and lucid. No vague and confusing notations like the traditional treatment.

Amazingly, this book has the same author as SICP, i.e , Structure and Interpretation of Computer Programs.

Gerry Sussman is truly one of a kind. He designed the Scheme language and Scheme chips, designed professional telescopes and founded the field of synthetic biology. He's a bonded locksmith and an expert watchmaker as well.

One of the three SCIP authors you mean.

Not so incredible; Gerry has always loved physics and in the 80s built a digital orrery in scheme shortly after SCIP was written. I believe this book had its earliest inklings in that work.

Around March 2019, I walked up to Gerry at the end of a class he taught (I was sitting in) and he mentioned that he was actually a physics major at MIT when he was an undergrad (in addition to math) but was one course short. The course he was missing? Junior lab (now 8.13 / 8.14)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact