dimensional alternatives and similar packages
Based on the "Math" category.
Alternatively, view dimensional alternatives based on common mentions on social networks and blogs.
-
vector
An efficient implementation of Int-indexed arrays (both mutable and immutable), with a powerful loop optimisation framework . -
statistics
A fast, high quality library for computing with statistics in Haskell. -
HerbiePlugin
GHC plugin that improves Haskell code's numerical stability -
hgeometry
HGeometry is a library for computing with geometric objects in Haskell. It defines basic geometric types and primitives, and it implements some geometric data structures and algorithms. The main two focusses are: (1) Strong type safety, and (2) implementations of geometric algorithms and data structures that have good asymptotic running time guarantees. -
computational-algebra
General-Purpose Computer Algebra System as an EDSL in Haskell -
matrix
A Haskell native implementation of matrices and their operations. -
mwc-random
A very fast Haskell library for generating high quality pseudo-random numbers. -
numhask
A haskell numeric prelude, providing a clean structure for numbers and operations that combine them. -
vector-space
Vector & affine spaces, linear maps, and derivatives -
poly
Fast polynomial arithmetic in Haskell (dense and sparse, univariate and multivariate, usual and Laurent) -
cf
"Exact" real arithmetic for Haskell using continued fractions (Not formally proven correct) -
optimization
Some numerical optimization methods implemented in Haskell -
rampart
:european_castle: Determine how intervals relate to each other. -
equational-reasoning
Agda-style equational reasoning in Haskell -
safe-decimal
Safe and very efficient arithmetic operations on fixed decimal point numbers -
sbvPlugin
Formally prove properties of Haskell programs using SBV/SMT. -
monoid-subclasses
Subclasses of Monoid with a solid theoretical foundation and practical purposes -
polynomial
Haskell library for manipulating and evaluating polynomials -
eigen
Haskel binding for Eigen library. Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. -
manifold-random
Coordinate-free hypersurfaces as Haskell types -
modular-arithmetic
A useful type for working with integers modulo some constant.
Collect and Analyze Billions of Data Points in Real Time
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of dimensional or a related project?
README
dimensional
This library provides statically-checked dimensional arithmetic for physical quantities, using the 7 SI base dimensions.
Data kinds and closed type families provide a flexible, safe, and discoverable implementation that leads to largely self-documenting client code.
Usage
Simply importing Numeric.Units.Dimensional.Prelude
provides access to dimensional arithmetic opertors, SI units and other common units
accepted for use with the SI, and convenient aliases for quantities with commonly used dimensions.
The Unit d a
type represents a unit with dimension d
, whose conversion factor to the coherent SI base unit of the corresponding dimension
is represented by a value of type a
. a
is commonly chosen to be Double
, but can be any Floating
type. Where possible, support is also
provided for Fractional
or Num
values.
Similarly, the Quantity d a
type represents a quantity with dimension d
, whose numeric value is of type a
. Aliases allow the use of, e.g.,
Length Double
to mean Quantity DLength Double
. A complete list of available aliases is given in the haddock documentation for the
Numeric.Units.Dimensional.Quantities
.
In the example below, we will solve a simple word problem.
A car travels at 60 kilometers per hour for one mile, at 50 kph for one mile, at 40 kph for one mile, and at 30 kph for one mile. How many minutes does the journey take? What is the average speed of the car? How many seconds does the journey take, rounded up to the next whole second?
{-# LANGUAGE NoImplicitPrelude #-}
module ReadmeExample where
import Numeric.Units.Dimensional.Prelude
import Numeric.Units.Dimensional.NonSI (mile)
leg :: Length Double
leg = 1 *~ mile -- *~ combines a raw number and a unit to form a quantity
speeds :: [Velocity Double]
speeds = [60, 50, 40, 30] *~~ (kilo meter / hour)
-- *~~ does the same thing for a whole Functor at once
-- Parentheses are required around unit expressions that are comingled with *~, /~, *~~, or /~~ operations
timeOfJourney :: Time Double
timeOfJourney = sum $ fmap (leg /) speeds
-- We can use dimensional versions of ordinary functions like / and sum to combine quantities
averageSpeed :: Velocity Double
averageSpeed = _4 * leg / timeOfJourney
-- _4 is an alias for the dimensionless number 4
wholeSeconds :: Integer
wholeSeconds = ceiling $ timeOfJourney /~ second
-- /~ lets us recover a raw number from a quantity and a unit in which it should be expressed
main :: IO ()
main = do
putStrLn $ "Length of journey is: " ++ showIn minute timeOfJourney
putStrLn $ "Average speed is: " ++ showIn (mile / hour) averageSpeed
putStrLn $ "If we don't want to be explicit about units, the show instance uses the SI basis: " ++ show averageSpeed
putStrLn $ "The journey requires " ++ show wholeSeconds ++ " seconds, rounded up to the nearest second."
Contributing
For project information (issues, updates, wiki, examples) see: https://github.com/bjornbm/dimensional