At Georgia Tech, the labs associated with Physics I and II have a large programming portion. They had us use VPython [1], which is a strange package which includes a version of python and a graphics library. It worked pretty well, and I got a good kick out of it. They had us model gravitation of planets (using discrete time steps). In Physics II one of the assignments was to create vector field displaying a magnetic…
Note that this is only for modern physics 1 and 2, which I think roughly half of the students take, the rest taking the classical physics 1 and 2.
Learn Physics by Programming in Haskell [pdf]
21–30 of 56 posts
Re: Learn Physics by Programming in Haskell [pdf]
#22Re: Learn Physics by Programming in Haskell [pdf]
#23Man, do I feel old. Back in undergraduate school, we were taught to learn programming (FORTRAN) through physics, not the other way around. The idea that the process could be turned around really hammers home how much things have changed due to the access to computers at a young age that most kids have nowadays.
Physics isn't just about punching numbers into a computer or solving math problems, and I think a shift toward more programming centered learning of physics needs to be heavily tempered with that understanding.
Re: Learn Physics by Programming in Haskell [pdf]
#24Man, do I feel old. Back in undergraduate school, we were taught to learn programming (FORTRAN) through physics, not the other way around. The idea that the process could be turned around really hammers home how much things have changed due to the access to computers at a young age that most kids have nowadays.
I really think that you want the curriculum to go in this order: (1) teach a high-schooler to program via games; (2) leverage that programming knowledge to build up some abstract mathematics and love of patterns; (3) start into Newton's equations with a programming background.
Haskell is actually a pretty good choice for this process because it is functional. I wouldn't tell the student that it's a "functional language" but rather that it is "based on a simpler model of computation". You start with the idea of "expressions reduce", the naming of things, and backslash-function literals. Once you understand that, then there are data structures and pattern matching -- you expand slowly outwards this way.
The syntax is surprisingly simple if you explain it top-down, but is often "lighter" than Lisp's parentheses. Curried functions and operator sections let you easily speak about high-level functions really early on without a mess of syntax. Haskell guards and pattern matching really embodies the SICP value that "every good program starts with a case dispatch." And, you can still do SICP's trick of implementing a Scheme dialect in Haskell pretty easily (in the context of games this allows them to be "scriptable").
The value that you get is that in the mathematics courses, you are sneakily starting a student off in a proof-centric environment; you can start calculus with the discrete calculus
delta list@(x : xs) = x : zipWith (-) xs list
sigma = scanl1 (+)
...and you swiftly get an inductive proof that sigma and delta are inverse functions.Because computers are stupid, you really break every idea down to the lowest common denominator, which makes it really easy to incrementally learn.
Re: Learn Physics by Programming in Haskell [pdf]
#25Earlier quoted context omitted.
That book absolutely blew me away the first time I worked through it. Great stuff!
I've yet to finish my way through. But it is amazingly precise and thorough. There are a few mistakes that the reader catches easily if they've been paying attention. The authors are really onto something with programming as a means to learn other subjects. I know there is a very recent book on differential geometry topics from them also! Would you happen to have proof of property d of exercise 1.33 lying around? (Th…
I think this is because of the precision that programming demands. You have to really nail down every edge case, and think about things down to their essence.
This is one reason why programmers can succeed in jumping the fence to work in their customer's jobs, even when it's an unrelated field. (I've seen many programmers make swaps from fields as diverse as brand management, telecom customer support and bond trading)
Re: Learn Physics by Programming in Haskell [pdf]
#26If you're into physics I'd recommend solving some problems using whatever language, but especially functional languages (i.e. Lisps, Haskell, etc.) because you have some big "A-ha!" moments as to what the math really means. Like when you program an integral from scratch for a mechanics problem and you go "Oh that's why we use an integral here!" There are also many problems (i.e. n-body orbital dynamics) where brute-f…
Re: Learn Physics by Programming in Haskell [pdf]
#27I'm a physics sophomore, and I would be very glad to see more programming, especially FP, integrated to physics courses. During my studies, I've programmed some simulations related to the physics courses I've taken. My main purpose has been to gain a deeper, more practical insight on the subject which would've otherwise remained quite theoretical and distant. For example, I made a little rollercoaster simulation to d…
Re: Learn Physics by Programming in Haskell [pdf]
#28If you're into physics I'd recommend solving some problems using whatever language, but especially functional languages (i.e. Lisps, Haskell, etc.) because you have some big "A-ha!" moments as to what the math really means. Like when you program an integral from scratch for a mechanics problem and you go "Oh that's why we use an integral here!" There are also many problems (i.e. n-body orbital dynamics) where brute-f…
Interestingly, the second edition of the book will be published next Friday.
Re: Learn Physics by Programming in Haskell [pdf]
#29If you're into physics I'd recommend solving some problems using whatever language, but especially functional languages (i.e. Lisps, Haskell, etc.) because you have some big "A-ha!" moments as to what the math really means. Like when you program an integral from scratch for a mechanics problem and you go "Oh that's why we use an integral here!" There are also many problems (i.e. n-body orbital dynamics) where brute-f…
Re: Learn Physics by Programming in Haskell [pdf]
#30Earlier quoted context omitted.
I've yet to finish my way through. But it is amazingly precise and thorough. There are a few mistakes that the reader catches easily if they've been paying attention. The authors are really onto something with programming as a means to learn other subjects. I know there is a very recent book on differential geometry topics from them also! Would you happen to have proof of property d of exercise 1.33 lying around? (Th…
The authors are really onto something with programming as a means to learn other subjects. I think this is because of the precision that programming demands. You have to really nail down every edge case, and think about things down to their essence. This is one reason why programmers can succeed in jumping the fence to work in their customer's jobs, even when it's an unrelated field. (I've seen many programmers make…
That is, in programming you learn a small set of abstractions (programming language syntax), and the actual coursework in applying that is in how they combine, how to fit them to problems.
In math, you learn a large number of abstractions (notation), that can vary and have new ones across different domains, and which doesn't tell you what it is doing unless you learn all the abstractions.
The latter you can kinda get, if you think about it, but forcing you to actually turn it into something expressed in the former means it is synthesized into something applicable, rather than just abstraction that may or may not be.
That is,
http://upload.wikimedia.org/math/d/f/1/df17b3410e58ac4c285bc...
is harder to understand when you come across it than
total = 0;
for(i = 0; i
or sum([1..100])
You have to convert the first from a symbol that does not describe its action, to an action; the code describes the action. That extra translation step leads to additional cognitive load when learning, at least for me.