Science
vphysics
Energy, momentum, collisions, forces and waves, as closed form formulas.
Released v1.0.0 · 2026-09-28use "stdlib/physics.ven"
print kinetic_energy(2.0, 3.0)
:: 9.0
Reference (11 functions)
API reference
kinetic_energy(mass, velocity)
Computes the classical kinetic energy of a moving mass.
kinetic_energy(2.0, 3.0)
:: 9.0potential_energy(mass, height, gravity)
Computes gravitational potential energy near a surface.
potential_energy(10.0, 5.0, 9.8)
:: 490.0elastic_collision_velocities(m1, v1, m2, v2)
elastic_collision_velocities(1.0, 2.0, 1.0, -2.0)
:: (-2.0, 2.0)projectile_range(initial_speed, angle_radians, gravity)
Computes the horizontal range of ideal projectile motion.
projectile_range(10.0, 0.7853981633974483, 9.8)
:: 10.204081632653061projectile_trajectory(initial_speed, angle_radians, gravity, steps)
Samples the parabolic path of ideal projectile motion.
projectile_trajectory(10.0, 0.7853981633974483, 9.8, 2)
:: [(0.0, 0.0), (5.1020408163265305, 2.5510204081632644), (10.204081632653061, -1.7763568394002505e-15)]coulomb_force(q1, q2, distance)
Computes the electrostatic force between two point charges.
coulomb_force(1.0, 1.0, 1.0)
:: 8987551792.3gravitational_force(m1, m2, distance)
Computes the gravitational force of attraction between two masses.
gravitational_force(5.0, 5.0, 1.0)
:: 1.6685e-09wave_speed(frequency, wavelength)
Computes a wave's propagation speed from its frequency and wavelength.
wave_speed(340.0, 0.5)
:: 170.0doppler_shift(source_frequency, source_speed, observer_speed, wave_speed_value)
Computes the observed frequency of a wave under the acoustic Doppler effect.
doppler_shift(440.0, 10.0, 0.0, 340.0)
:: 453.3333333333333physical_constant(name)
Looks up a named fundamental physical constant.
physical_constant("speed_of_light")
:: 299792458.0