Learn Physics by Programming in Haskell

Scott N. Walck
(Lebanon Valley College, Annville, Pennsylvania, USA)

We describe a method for deepening a student's understanding of basic physics by asking the student to express physical ideas in a functional programming language. The method is implemented in a second-year course in computational physics at Lebanon Valley College. We argue that the structure of Newtonian mechanics is clarified by its expression in a language (Haskell) that supports higher-order functions, types, and type classes. In electromagnetic theory, the type signatures of functions that calculate electric and magnetic fields clearly express the functional dependency on the charge and current distributions that produce the fields. Many of the ideas in basic physics are well-captured by a type or a function.

In James Caldwell, Philip Hölzenspies and Peter Achten: Proceedings 3rd International Workshop on Trends in Functional Programming in Education (TFPIE 2014), Soesterberg, The Netherlands, 25th May 2014, Electronic Proceedings in Theoretical Computer Science 170, pp. 67–77.
Published: 12th December 2014.

ArXived at: https://dx.doi.org/10.4204/EPTCS.170.5 bibtex PDF
References in reconstructed bibtex, XML and HTML format (approximated).
Comments and questions to: eptcs@eptcs.org
For website issues: webmaster@eptcs.org