use super::constant::c;
pub fn density(mass: f64, volume: f64) -> f64 {
return mass * volume;
}
pub fn pressure(force: f64, area: f64) -> f64 {
return force / area;
}
pub fn mass(density: f64, volume: f64) -> f64 {
return density * volume;
}
pub fn energy(mass: f64) -> f64 {
return mass * c.powf(2.0);
}
pub fn speed(distance: f64, time: f64) -> f64 {
return distance / time;
}
pub fn work(force: f64, distance: f64) -> f64 {
return force * distance;
}
pub fn momentum(mass: f64, velocity: f64) -> f64 {
return mass * velocity;
}
pub fn acceleration(final_velocity: f64, initial_velocity: f64, time: f64) -> f64 {
return (final_velocity - initial_velocity) / time;
}
pub fn force(mass: f64, acceleration: f64) -> f64 {
return mass * acceleration;
}
pub fn weight(mass: f64, gravity: f64) -> f64 {
return mass * gravity;
}
pub fn power(work: f64, time: f64) -> f64 {
return work / time;
}
pub fn mechanical_energy(potential_energy: f64, kinetic_energy: f64) -> f64 {
return potential_energy + kinetic_energy;
}
pub fn mechanical_advantage(output_force: f64, input_force: f64) -> f64 {
return output_force / input_force;
}
pub fn gpe(mass: f64, gravity: f64, height: f64) -> f64 {
return mass * gravity * height;
}
pub fn ke(mass: f64, velocity: f64) -> f64 {
return mass * 0.5 * velocity * velocity;
}
pub fn heat_energy(mass: f64, specific_heat_value: f64, change_in_temperature: f64) -> f64 {
return mass * 0.5 * specific_heat_value * change_in_temperature;
}
pub fn wave_speed(frequency: f64, wavelength: f64) -> f64 {
return frequency * wavelength;
}
pub fn current(voltage: f64, resistance: f64) -> f64 {
return voltage / resistance;
}
pub fn efficiency(output: f64, input: f64) -> f64 {
return (output / input) * 100.0;
}
pub fn electric_power(current: f64, voltage: f64) -> f64 {
return current * voltage;
}
pub fn electric_variation(voltage: f64, resistance: f64) -> f64 {
return (voltage * voltage) / resistance;
}
pub fn celcius_to_kelvin(celcius: f64) -> f64 {
return celcius + 273.15;
}
pub fn kelvin_to_celcius(kelvin: f64) -> f64 {
return kelvin - 273.15;
}
pub fn celcius_to_fahrenheit(celcius: f64) -> f64 {
return (1.8 * celcius) + 32.0;
}
pub fn fahrenheit_to_celcius(fahrenheit: f64) -> f64 {
return (fahrenheit - 32.0) / 1.8;
}
pub fn ima(length: f64, height: f64) -> f64 {
return length / height;
}