interval

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interval

type Interval[Real constraints.Real] interface {
	fmt.Stringer

	// List represents this Interval as an ordered array, from start to end,
	// containing all numbers distanced by a given step size.
	List(Real) []Real

	// Contains checks if this interval contains the given number.
	Contains(Real) bool

	// Iterator returns an iterator that can be used to iterate over all numbers
	// in this interval.
	Iterator(Real) iterator.Iterator[Real]
	// contains filtered or unexported methods
}

Interval is a set of real numbers that contains all real numbers lying between any two numbers of the set.

Notation:
• Open:                (𝑎,𝑏) = { 𝑥 ∈ ℝ | 𝑎 < 𝑥 < 𝑏 }
• LeftClosedRightOpen: [𝑎,𝑏) = { 𝑥 ∈ ℝ | 𝑎 ≤ 𝑥 < 𝑏 }
• LeftOpenRightClosed: (𝑎,𝑏] = { 𝑥 ∈ ℝ | 𝑎 < 𝑥 ≤ 𝑏 }
• Closed:              [𝑎,𝑏] = { 𝑥 ∈ ℝ | 𝑎 ≤ 𝑥 ≤ 𝑏 }

Graphical Representation:
• Open:                𝑎 ○————○ 𝑏
• LeftClosedRightOpen: 𝑎 ●————○ 𝑏
• LeftOpenRightClosed: 𝑎 ○————● 𝑏
• Closed:              𝑎 ●————● 𝑏

func Closed

func Closed[Real constraints.Real](start, end Real) Interval[Real]

Closed creates a closed interval, where both start and end are included.

  • Graphical: 𝑎 ●————● 𝑏
  • Notation: [𝑎,𝑏] = { 𝑥 ∈ ℝ | 𝑎 ≤ 𝑥 ≤ 𝑏 }

See also: Open, LeftClosedRightOpen, LeftOpenRightClosed.

func LeftClosedRightOpen

func LeftClosedRightOpen[Real constraints.Real](start, end Real) Interval[Real]

LeftClosedRightOpen creates a left-closed, right-open interval, where start is included and end is excluded.

  • Graphical: 𝑎 ●————○ 𝑏
  • Notation: [𝑎,𝑏) = { 𝑥 ∈ ℝ | 𝑎 ≤ 𝑥 < 𝑏 }

See also: Open, LeftOpenRightClosed, Closed.

func LeftOpenRightClosed

func LeftOpenRightClosed[Real constraints.Real](start, end Real) Interval[Real]

LeftOpenRightClosed creates a left-open, right-closed interval, where start is excluded and end is included.

  • Graphical: 𝑎 ○————● 𝑏
  • Notation: (𝑎,𝑏] = { 𝑥 ∈ ℝ | 𝑎 < 𝑥 ≤ 𝑏 }

See also: Open, LeftClosedRightOpen, Closed.

func Open

func Open[Real constraints.Real](start, end Real) Interval[Real]

Open creates an open interval, where both start and end are excluded.

  • Graphical: 𝑎 ○————○ 𝑏
  • Notation: (𝑎,𝑏) = { 𝑥 ∈ ℝ | 𝑎 < 𝑥 < 𝑏 }

See also: LeftClosedRightOpen, LeftOpenRightClosed, Closed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL