1CALCULATING WITH HASKELL

Image

In this chapter, we’ll see how Haskell can be used as a scientific calculator. Multiple scientific functions are available by default in this calculator. In Chapter 2, we’ll write functions of our own that we can load and use. This chapter introduces some features and details of the language that will be useful later. Let’s start with a kinematics problem.

A Kinematics Problem

Suppose we have a car on an air track. The car accelerates at a rate of 0.4 m/s2. At time t = 0, the car is stationary. How much time will it take for this car to travel 2 meters?

The acceleration is constant, so we can use the position-time equation. ...

Get Learn Physics with Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.