Learn Physics with Functional Programming Cover

Learn Physics with Functional Programming

A Hands-on Guide to Exploring Physics with Haskell
by Scott N. Walck
October 2022, 616 pp.
ISBN-13: 
9781718501669
Use coupon code PREORDER to get 25% off!

Download Chapter 14: NEWTON’S SECOND LAW

This book teaches you to solve physics problems using the functional programming paradigm. Ideal for first-time programmers and science aficionados alike, it introduces the Haskell programming language and encourages the writing of beautiful code to match the elegant ideas of theoretical physics.

Early chapters cover the basics of coding in Haskell, which has a powerful system of types capable of encoding important mathematical structures in physics, like vectors, derivatives, integrals, scalar fields, vector fields, and differential equations. Later sections of the book explore Newtonian mechanics and electromagnetics—two central pillars of theoretical physics. In addition, you’ll get a deep look into source code, and discover why Haskell’s high-order functions and referential transparency serve physics so well. Along the way, you’ll learn:

  • How to write beautiful code that expresses fundamental physical principles
  • How to make graphs and animations of interesting situations
  • How to program in a language that looks like mathematics
  • How types, high order functions, and referential transparency serve physics well
Author Bio 

Scott Walck has a PhD in Physics from Lehigh University. He has taught physics, including computational physics, to undergraduates (physics majors and non-majors) for 20 years at Lebanon Valley College, where he has been recognized with a Distinguished Teaching Award. Walck is a 3-time NSF grant recipient for research in quantum information and is the author of 30+ peer-reviewed research articles in physics.

Table of contents 

Introduction
Part I: The Haskell Language
1 Haskell as a Calculator
2 Functions
3 Types
4 Describing Motion
5 Lists
6 Higher-order Functions
7 Quick Plotting
8 Type Classes
9 Tuples and Type Constructors
10 Motion in Three Dimensions
11 Presentation Plotting
12 Producing Stand-Alone Programs
13 Animation
Part II: Newtonian Mechanics
14 Newton's Second Law
15 Mechanics in One Dimension
16 The Theory of Mechanics in Three Dimensions
17 Examples of Mechanics in Three Dimensions
18 A Very Short Primer on Relativity
19 The Theory of Interacting Particles
20 Examples of Interacting Particles
Part III: Electromagnetic Theory
21 Electricity
22 Coordinate Systems and Fields
23 Curves, Surfaces, and Volumes
24 Electric Charge
25 Electric Field
26 Electric Current
27 Magnetic Field
28 Lorentz Force Law
29 The Maxwell Equations
Appendix A Installing Haskell

The chapters in red are included in this Early Access PDF.