Learn Physics with Functional Programming

by Scott N. Walck

Programming

Book Details

Book Title

Learn Physics with Functional Programming

Author

Scott N. Walck

Publisher

No Starch Press

Publication Date

2023

ISBN

9781718501669

Number of Pages

824

Language

English

Format

PDF

File Size

5MB

Subject

programming

Table of Contents

  • Cover Page
  • Title Page
  • Copyright Page
  • Dedication
  • About the Author
  • About the Technical Reviewer
  • Brief Contents
  • Contents in Detail
  • Acknowledgments
  • Introduction
  • I A Haskell Primer For Physicists
  • Chapter 1 CALCULATING WITH HASKELL
  • A Kinematics Problem
  • The Interactive Compiler
  • Numeric Functions
  • Operators
  • Functions with Two Arguments
  • Numbers in Haskell
  • Approximate Calculation
  • Errors
  • Getting Help and Quitting
  • More Information
  • Summary
  • Exercises
  • Chapter 2 WRITING BASIC FUNCTIONS
  • Constants, Functions, and Types
  • How We Talk About Functions
  • Anonymous Functions
  • Composing Functions
  • Variable Not in Scope Error
  • Summary
  • Exercises
  • Chapter 3 TYPES AND ENTITIES
  • Basic Types
  • Function Types
  • Summary
  • Exercises
  • Chapter 4 DESCRIBING MOTION
  • Position and Velocity on an Air Track
  • Types for Physical Quantities
  • Introducing Derivatives
  • Derivatives in Haskell
  • Modeling the Car’s Position and Velocity
  • Modeling Acceleration
  • Approximate Algorithms and Finite Precision
  • Summary
  • Exercises
  • Chapter 5 WORKING WITH LISTS
  • List Basics
  • Type Variables
  • Type Conversion
  • The Length of Lists
  • A String Is a List of Characters
  • List Comprehensions
  • Infinite Lists
  • List Constructors and Pattern Matching
  • Summary
  • Exercises
  • Chapter 6 HIGHER-ORDER FUNCTIONS
  • How to Think About Functions with Parameters
  • Mapping a Function Over a List
  • Iteration and Recursion
  • Anonymous Higher-Order Functions
  • Operators as Higher-Order Functions
  • Combinators
  • Predicate-Based Higher-Order Functions
  • Numerical Integration
  • Summary
  • Exercises
  • Chapter 7 GRAPHING FUNCTIONS
  • Using Library Modules
  • Plotting
  • Summary
  • Exercises
  • Chapter 8 TYPE CLASSES
  • Type Classes and Numbers
  • Type Classes from the Prelude
  • Exponentiation and Type Classes
  • Sections
  • Example of Type Classes and Plotting
  • Summary
  • Exercises
  • Chapter 9 TUPLES AND TYPE CONSTRUCTORS
  • Pairs
  • Currying a Function of Two Variables
  • Triples
  • Comparing Lists and Tuples
  • Maybe Types
  • Lists of Pairs
  • Tuples and List Comprehensions
  • Type Constructors and Kinds
  • Numerical Integration Redux
  • Summary
  • Exercises
  • Chapter 10 DESCRIBING MOTION IN THREE DIMENSIONS
  • Three-Dimensional Vectors
  • Coordinate Systems
  • Kinematics in 3D
  • Making Your Own Data Type
  • Defining a New Data Type for 3D Vectors
  • Summary
  • Exercises
  • Chapter 11 CREATING GRAPHS
  • Title and Axis Labels
  • Other Labels
  • Plotting Data
  • Multiple Curves on One Set of Axes
  • Controlling the Plot Ranges
  • Making a Key
  • Summary
  • Exercises
  • Chapter 12 CREATING STAND-ALONE PROGRAMS
  • Using GHC to Make a Stand-Alone Program
  • Using Cabal to Make a Stand-Alone Program
  • Using Stack to Make a Stand-Alone Program
  • Summary
  • Exercises
  • Chapter 13 CREATING 2D AND 3D ANIMATIONS
  • 2D Animation
  • 3D Animation
  • Summary
  • Exercises
  • IΙ EXPRESSING NEWTONIAN MECHANICS AND SOLVING PROBLEMS
  • Chapter 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
  • Chapter 15 MECHANICS IN ONE DIMENSION
  • Introductory Code
  • Forces That Depend on Time, Position, and Velocity
  • A Damped Harmonic Oscillator
  • Euler-Cromer Method
  • Solving Differential Equations
  • Summary
  • Exercises
  • Chapter 16 MECHANICS IN THREE DIMENSIONS
  • Introductory Code
  • Newton’s Second Law in Three Dimensions
  • The State of One Particle
  • Solving Newton’s Second Law
  • One-Body Forces
  • State Update for One Particle
  • Preparing for Animation
  • Summary
  • Exercises