Class: Linear::PointSlope

Inherits:
Function
  • Object
show all
Defined in:
lib/linear/point_slope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, slope) ⇒ PointSlope



6
7
8
9
# File 'lib/linear/point_slope.rb', line 6

def initialize x, y, slope
  @slope, @x1, @y1 = slope, x, y
  super @slope, @x1 - @y1
end

Instance Attribute Details

#x1Object (readonly)

Returns the value of attribute x1



4
5
6
# File 'lib/linear/point_slope.rb', line 4

def x1
  @x1
end

#y1Object (readonly)

Returns the value of attribute y1



4
5
6
# File 'lib/linear/point_slope.rb', line 4

def y1
  @y1
end

Instance Method Details

#to_slope_interceptObject Also known as: to_si



10
11
12
13
# File 'lib/linear/point_slope.rb', line 10

def to_slope_intercept
  require "linear/slope_intercept"
  SlopeIntercept.new slope, y_intercept
end

#to_standardObject



15
16
17
# File 'lib/linear/point_slope.rb', line 15

def to_standard
  to_si.to_standard
end