1.0.1 • Published 7 years ago

math-intervals v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

MIT License

TypeScript/JavaScript library for working with intervals of real numbers, including intersections, joins, disjoint sets etc

Install

$ npm install --save math-intervals

Usage

import intervals from 'math-intervals';

// [2, 10)
const interval1 = intervals.leftClosedRightOpen(2, 10)

// [10, 20)
const interval2 = intervals.leftClosedRightOpen(10, 20)

console.log(intervals.intersect(interval1, interval2)) // false
console.log(intervals.continuous(interval1, interval2)) // true

const partitionedInterval = intervals.partitioned(interval1, interval2)
console.log(intervals.intersect(partitionedInterval, interval1)) // true
console.log(intervals.intersect(partitionedInterval, interval2)) // true
console.log(intervals.intersect(partitionedInterval, partitionedInterval)) // true

Constructors

TODO

Functions

TODO

License

math-intervals is freely distributable under the terms of the MIT license.