Sha256: ecbc005fcf6d3039da4e033b28d42aba7863eb17bd988f76dcee5a4fb15c621f

Contents?: true

Size: 600 Bytes

Versions: 3

Compression:

Stored size: 600 Bytes

Contents

# frozen_string_literal: true

module Danica
  class Function::Spatial < Function
    variables :time, :acceleration, :initial_space, :initial_velocity

    private

    def function_block
      @function_block ||= addition(parcels)
    end

    def parcels
      [
        initial_space,
        spatial_velocity,
        spatial_acceleration
      ]
    end

    def spatial_velocity
      multiplication(initial_velocity, time)
    end

    def spatial_acceleration
      division(multiplication(acceleration, time_squared), 2)
    end

    def time_squared
      power(time, 2)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.7.7 spec/support/models/function/spatial.rb
danica-2.7.6 spec/support/models/function/spatial.rb
danica-2.7.5 spec/support/models/function/spatial.rb