SimpleStatistics::Line
Inherits Struct < Value < Object
A struct representing a line in 2D space.
line = SimpleStatistics::Line.new(2, 3)
line.slope # => 2
line.intercept # => 3
line.at(5) # => 13
Constructors
new(m : Float64, b : Float64)
Creates a new Line with a slope and intercept.
line = SimpleStatistics::Line.new(4, 5)
line.slope # => 4
line.intercept # => 5
Instance methods
at(x : Float64) : Float64
The y at the given x.
line = SimpleStatistics::Line.new(2, 3)
line.at(0) # => 3
line.at(1) # => 5
line.at(1.2) # => 5.4
b
The intercept. Aliased as intercept.
SimpleStatistics::Line.new(99, 2).b
# => 2
intercept
The intercept. Alias of b.
SimpleStatistics::Line.new(99, 2).intercept
# => 2
m
The slope. Aliased as slope.
SimpleStatistics::Line.new(4, 99).m
# => 4
slope
The slope. Alias of m.
SimpleStatistics::Line.new(4, 99).slope
# => 4