English

Learn Physics by Programming in Haskell

Computers and Society 2014-12-17 v1 Programming Languages Physics Education

Abstract

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.

Cite

@article{arxiv.1412.4880,
  title  = {Learn Physics by Programming in Haskell},
  author = {Scott N. Walck},
  journal= {arXiv preprint arXiv:1412.4880},
  year   = {2014}
}

Comments

In Proceedings TFPIE 2014, arXiv:1412.4738

R2 v1 2026-06-22T07:32:54.733Z