Simple integral calculator in Haskell
Calcigral is a simple command-line utility for approximating the value of definite integrals with one variable over a real line.
- Three approximation strategies:
Rectangle
,Trapezoid
,Paraboloid
- Can approximate up to any absolute error
- Supports
$-\infty$ ,$+\infty$ approximation bounds - Function input: any haskell function using
Prelude
- Command-line interface
Evaluate
$ calcigral 0 1 sin
Strategy: Rectangle
IntegralResult {value = 0.459997112932708, steps = 15}
===
Strategy: Trapezoid
IntegralResult {value = 0.45954804321221476, steps = 62}
===
Strategy: Paraboloid
IntegralResult {value = 0.45970774492731087, steps = 18}
===
Note: Default max absolute error is 1e-3
Evaluate
$ calcigral MinusInfinity PlusInfinity '\x -> exp (-x * x)' 0.001 1000 -s Paraboloid
Strategy: Paraboloid
IntegralResult {value = 1.7724624243349956, steps = 276}
===
Evaluate
$ calcigral 0 1 '\x -> 1 / x' -s Rectangle
Strategy: Rectangle
Diverging
===
This utility is a educational project for the JetBrains Functional Programming course (Fall 2022) at Constructor University. Hence, the goals of this project are educational.
This project is BSD-3-Clause licensed