Method: Joules.energy_v1

Defined in:
lib/joules/thermodynamics.rb

.energy_v1(mass, specific_heat_capacity, temperature_change) ⇒ Float

Note:

There are two other methods for calculating energy.

Calculates the energy given mass, specific heat capacity, and temperature change.

Examples:

Joules.energy_v1(500, 2.46, 3.6) #=> 4428.0

Parameters:

  • mass (Int, Float)

    mass >= 0; mass is in kilograms

  • specific_heat_capacity (Int, Float)

    specific_heat_capacity >= 0; specific_heat_capacity is in joules per kilogram celcius

  • temperature_change (Int, Float)

    temperature_change is in celcius

Returns:

  • (Float)

    return value is in joules



28
29
30
# File 'lib/joules/thermodynamics.rb', line 28

def energy_v1(mass, specific_heat_capacity, temperature_change)
  return mass * specific_heat_capacity * temperature_change.to_f
end