Book description
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
Table of contents
- Cover Page
- Title Page
- Copyright Page
- Dedication
- About the Author
- About the Technical Reviewer
- Brief Contents
- Contents in Detail
- ACKNOWLEDGMENTS
- INTRODUCTION
- PART I A HASKELL PRIMER FOR PHYSICISTS
- 1 CALCULATING WITH HASKELL
- 2 WRITING BASIC FUNCTIONS
- 3 TYPES AND ENTITIES
- 4 DESCRIBING MOTION
- 5 WORKING WITH LISTS
- 6 HIGHER-ORDER FUNCTIONS
- 7 GRAPHING FUNCTIONS
- 8 TYPE CLASSES
- 9 TUPLES AND TYPE CONSTRUCTORS
- 10 DESCRIBING MOTION IN THREE DIMENSIONS
- 11 CREATING GRAPHS
- 12 CREATING STAND-ALONE PROGRAMS
- 13 CREATING 2D AND 3D ANIMATIONS
- PART II EXPRESSING NEWTONIAN MECHANICS AND SOLVING PROBLEMS
-
14 NEWTON’S SECOND LAW AND DIFFERENTIAL EQUATIONS
- Newton’s First Law
- Newton’s Second Law in One Dimension
- Second Law with Constant Forces
- Second Law with Forces That Depend Only on Time
- Air Resistance
- Second Law with Forces That Depend Only on Velocity
- The State of a Physical System
- Second Law with Forces That Depend on Time and Velocity
- Example: Pedaling and Coasting with Air Resistance
- Summary
- Exercises
- 15 MECHANICS IN ONE DIMENSION
- 16 MECHANICS IN THREE DIMENSIONS
- 17 SATELLITE, PROJECTILE, AND PROTON MOTION
- 18 A VERY SHORT PRIMER ON RELATIVITY
- 19 INTERACTING PARTICLES
- 20 SPRINGS, BILLIARD BALLS, AND A GUITAR STRING
- PART III EXPRESSING ELECTROMAGNETIC THEORY AND SOLVING PROBLEMS
- 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 THE LORENTZ FORCE LAW
- 29 THE MAXWELL EQUATIONS
- APPENDIX: INSTALLING HASKELL
- BIBLIOGRAPHY
- INDEX
Product information
- Title: Learn Physics with Functional Programming
- Author(s):
- Release date: January 2023
- Publisher(s): No Starch Press
- ISBN: 9781718501669
You might also like
book
Learning Functional Programming
Learn how to think and write code like a functional programmer. With this practical guide, software …
book
Grokking Functional Programming
There’s no need to fear going functional! This friendly, lively, and engaging guide is perfect for …
book
Programming Scala, 3rd Edition
Get up to speed on Scala--the JVM, JavaScript, and natively compiled language that offers all the …
book
Get Programming with Haskell
Get Programming with Haskell introduces you to the Haskell language without drowning you in academic jargon …