MoonClmech

    MoonClmech - A comprehensive classical mechanics calculation library for MoonBit, inspired by SymPy Mechanics. Provides computational functions for particle dynamics, rigid body mechanics, Lagrangian and Hamiltonian formulations, constraint systems, multibody dynamics, and kinematic analysis. Suitable for modeling physical systems, robotics, and engineering applications.

    classical-mechanics
    physics
    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    44

    No dependencies

    #MoonClmech - Classical Mechanics Calculation Library

    MoonClmech is a comprehensive classical mechanics calculation library written in MoonBit. It provides functions for particle motion, rigid body mechanics, Lagrangian and Hamiltonian mechanics, fluid dynamics, orbital mechanics, and more.


    #Features

    #Core Kinematics

    • Uniform Motion: Displacement calculations for constant velocity
    • Accelerated Motion: Displacement, velocity, and acceleration calculations with constant acceleration
    • Projectile Motion: Horizontal and vertical displacement, maximum height, range, flight time, velocity components
    • Circular Motion: Centripetal acceleration and force, angular velocity conversions, period and frequency
    • Relative Motion: Velocity, displacement, and acceleration transformations between reference frames


    #Dynamics and Forces

    • Newton's Laws: Force, acceleration, and mass relationships
    • Momentum: Linear momentum, momentum change, and impulse
    • Energy: Kinetic energy, gravitational potential energy, elastic potential energy, mechanical energy
    • Work and Power: Work calculations from force and displacement, power from force and velocity
    • Friction: Static and kinetic friction, inclined plane forces and accelerations
    • Spring Forces: Hooke's law, spring constant calculations


    #Rigid Body Mechanics

    • Moments of Inertia: Point mass, rod, ring, disk, sphere, cylinder, cone, rectangular plate, and more
    • Angular Motion: Angular displacement, velocity, acceleration, and momentum
    • Torque: Torque calculations from force and lever arm
    • Rotational Dynamics: Rotational kinetic energy, rotational power, precession
    • Parallel Axis Theorem: Moment of inertia for shifted axes
    • Rolling Motion: Rolling velocity, kinetic energy, acceleration on inclined surfaces


    #Simple Harmonic Motion and Oscillations

    • Simple Harmonic Motion: Displacement, velocity, acceleration, angular frequency, period, frequency
    • Spring-Mass Systems: Natural frequency and period calculations
    • Pendulums: Simple and physical pendulum periods and frequencies
    • Damped Oscillations: Damping coefficients, critical damping, damped angular frequency
    • Forced Oscillations: Forced oscillation amplitude, resonance frequency
    • Coupled Oscillators: Normal mode frequencies, normal coordinates, beat frequency


    #Collisions and Conservation Laws

    • Elastic Collisions: One-dimensional and two-dimensional elastic collision calculations
    • Inelastic Collisions: Perfectly inelastic and partially inelastic collisions
    • Coefficient of Restitution: Restitution coefficient calculation
    • Kinetic Energy Loss: Energy loss calculations for inelastic collisions
    • Momentum Conservation: Verification of momentum conservation in collisions
    • Center of Mass: Center of mass position, velocity, and acceleration


    #Orbital Mechanics and Central Forces

    • Kepler's Laws: Orbital period from semi-major axis (Kepler's third law)
    • Orbital Velocities: Circular orbital velocity, velocities at periapsis and apoapsis
    • Escape Velocity: Escape velocity calculations
    • Cosmic Velocities: First and second cosmic velocities
    • Orbital Energy: Energy calculations for circular and elliptical orbits
    • Hohmann Transfer: Delta-v calculations for Hohmann transfer orbits
    • Areal Velocity: Areal velocity for orbital motion


    #Lagrangian and Hamiltonian Mechanics

    • Lagrangian Formulation: Lagrangian function from kinetic and potential energy
    • Generalized Forces: Generalized force calculations
    • Hamiltonian Formulation: Hamiltonian from kinetic and potential energy
    • Phase Space: Phase space volume calculations


    #Multi-body Systems

    • Center of Mass: One-dimensional center of mass calculations
    • Total Momentum: Total momentum for multiple objects
    • Total Kinetic Energy: Total kinetic energy for multiple objects
    • Center of Mass Motion: Center of mass velocity and acceleration


    #Fluid Mechanics

    • Buoyancy: Buoyant force (Archimedes' principle)
    • Hydrostatics: Hydrostatic pressure at depth
    • Bernoulli's Principle: Velocity and pressure calculations from Bernoulli's equation
    • Continuity Equation: Velocity calculations from continuity equation
    • Viscosity: Reynolds number, Stokes drag, viscous forces
    • Poiseuille Flow: Flow rate in cylindrical pipes
    • Surface Tension: Capillary rise, Laplace pressure
    • Drag Forces: Linear and quadratic drag, terminal velocity


    #Wave Mechanics

    • Wave Properties: Wave displacement, velocity, frequency, wavelength relationships
    • Standing Waves: Fundamental frequency, harmonic frequencies, node spacing
    • Doppler Effect: Frequency shifts for moving sources and observers
    • Wave Intensity: Wave intensity calculations
    • Wave Energy: Energy and power in waves


    #Extended Mechanics

    • Non-inertial Frames: Centrifugal force, Coriolis force, inertial forces
    • Special Relativity: Lorentz factor, relativistic mass, relativistic momentum, mass-energy equivalence
    • Continuum Mechanics: Stress (normal and shear), strain, Young's modulus
    • Acoustics: Sound intensity, sound intensity level, sound speed in ideal gases
    • Rocket Mechanics: Rocket equation, thrust force, variable mass systems


    #Physical Constants and Material Properties

    • Fundamental Constants: Speed of light, gravitational constant, Planck constant
    • Planetary Constants: Mass, radius, surface gravity for Earth, Moon, Sun, and other planets
    • Material Properties: Density, viscosity, surface tension, Young's modulus for common materials
    • Astronomical Constants: Astronomical unit, light-year, parsec, planetary distances


    #Utility Functions

    • Vector Operations: 3D vector creation, addition, subtraction, dot product, cross product, magnitude, normalization, projection, reflection
    • Unit Conversions: Speed (m/s ↔ km/h), force (N ↔ lbf), energy (J ↔ cal), power (W ↔ hp), temperature (°C ↔ K ↔ °F)
    • Numerical Tools: Maximum/minimum, interpolation, range mapping, range checking, averaging, RMS


    #Usage

    #Basic Kinematics

    test "basic kinematics" {
    // Uniform motion: displacement = velocity * time
    let displacement = uniform_motion_displacement(10.0, 5.0)
    assert_eq(displacement, 50.0)

    // Accelerated motion: displacement with constant acceleration
    let s = uniform_acceleration_displacement(0.0, 2.0, 5.0)
    assert_eq(s, 25.0)

    // Projectile motion: maximum height and range
    let v0 = 20.0 // m/s
    let angle = 3.14159 / 4.0 // 45 degrees
    let g = 9.8 // m/s²
    let max_h = projectile_max_height(v0, angle, g)
    let range = projectile_range(v0, angle, g)
    assert_eq(max_h > 0.0, true)
    assert_eq(range > 0.0, true)
    }


    #Dynamics and Energy

    test "dynamics and energy" {
    // Newton's second law: F = ma
    let force = force(5.0, 4.0) // mass = 5 kg, acceleration = 4 m/s²
    assert_eq(force, 20.0)

    // Momentum and impulse
    let p = momentum(2.0, 10.0) // mass = 2 kg, velocity = 10 m/s
    assert_eq(p, 20.0)
    let impulse_val = impulse(10.0, 5.0) // force = 10 N, time = 5 s
    assert_eq(impulse_val, 50.0)

    // Energy calculations
    let ke = kinetic_energy(2.0, 10.0) // mass = 2 kg, velocity = 10 m/s
    assert_eq(ke, 100.0)
    let pe = gravitational_potential_energy(5.0, 10.0, 9.8) // mass = 5 kg, height = 10 m
    assert_eq(pe, 490.0)

    // Work and power
    let work_done = work(10.0, 5.0, 0.0) // force = 10 N, displacement = 5 m, angle = 0°
    assert_eq(work_done, 50.0)
    let power_val = power(100.0, 5.0) // work = 100 J, time = 5 s
    assert_eq(power_val, 20.0)
    }


    #Rigid Body Mechanics

    test "rigid body mechanics" {
    // Moment of inertia for different shapes
    let i_disk = moment_of_inertia_disk(4.0, 2.0) // mass = 4 kg, radius = 2 m
    assert_eq(i_disk, 8.0)
    let i_sphere = moment_of_inertia_sphere(5.0, 2.0) // mass = 5 kg, radius = 2 m
    assert_eq(i_sphere, 8.0)

    // Angular motion
    let l = angular_momentum(10.0, 5.0) // I = 10 kg·m², ω = 5 rad/s
    assert_eq(l, 50.0)
    let ke_rot = rotational_kinetic_energy(8.0, 3.0) // I = 8 kg·m², ω = 3 rad/s
    assert_eq(ke_rot, 36.0)

    // Torque
    let tau = torque(10.0, 2.0, 3.14159 / 2.0) // force = 10 N, lever = 2 m, angle = 90°
    assert_eq((tau - 20.0).abs() < 0.0001, true)
    }


    #Collisions

    test "collisions" {
    // Elastic collision: equal masses
    let m1 = 1.0 // kg
    let v1i = 10.0 // m/s
    let m2 = 1.0 // kg
    let v2i = 0.0 // m/s

    let v1f = elastic_collision_v1(m1, v1i, m2, v2i)
    let v2f = elastic_collision_v2(m1, v1i, m2, v2i)
    assert_eq((v1f - 0.0).abs() < 0.0001, true)
    assert_eq((v2f - 10.0).abs() < 0.0001, true)

    // Verify momentum conservation
    let p_before = momentum(m1, v1i) + momentum(m2, v2i)
    let p_after = momentum(m1, v1f) + momentum(m2, v2f)
    assert_eq((p_before - p_after).abs() < 0.0001, true)

    // Inelastic collision
    let v_final = inelastic_collision_velocity(2.0, 10.0, 3.0, 0.0) // m1=2 kg, v1=10 m/s, m2=3 kg, v2=0 m/s
    assert_eq(v_final, 4.0)
    }


    #Orbital Mechanics

    test "orbital mechanics" {
    // Kepler's third law: orbital period
    let a = 1.496e11 // m (Earth-Sun distance)
    let m_sun = 1.989e30 // kg
    let g_const = 6.67430e-11
    let period = kepler_period(a, m_sun, g_const)
    assert_eq((period - 3.156e7).abs() < 0.1e7, true) // Approximately 1 year

    // Circular orbital velocity
    let v_orbital = orbital_velocity_circular(a, m_sun, g_const)
    assert_eq((v_orbital - 29780.0).abs() < 100.0, true)

    // Escape velocity
    let r_earth = 6.371e6 // m
    let m_earth = 5.972e24 // kg
    let v_escape = escape_velocity(r_earth, m_earth, g_const)
    assert_eq((v_escape - 11186.0).abs() < 200.0, true)
    }


    #Simple Harmonic Motion

    test "simple harmonic motion" {
    // Spring-mass system
    let k = 100.0 // N/m
    let m = 4.0 // kg
    let omega = shm_angular_frequency(k, m)
    assert_eq((omega - 5.0).abs() < 0.0001, true)

    // SHM displacement, velocity, acceleration
    let a = 5.0 // m (amplitude)
    let t = 0.0 // s
    let phi = 0.0 // initial phase
    let x = shm_displacement(a, omega, t, phi)
    let v = shm_velocity(a, omega, t, phi)
    assert_eq((x - 5.0).abs() < 0.0001, true)
    assert_eq((v - 0.0).abs() < 0.0001, true)

    // Pendulum
    let l = 1.0 // m
    let g = 9.8 // m/s²
    let period = pendulum_period(g, l)
    assert_eq((period - 2.0).abs() < 0.1, true)
    }


    #Fluid Mechanics

    test "fluid mechanics" {
    // Buoyant force (Archimedes' principle)
    let rho_fluid = 1000.0 // kg/m³ (water)
    let volume = 0.1 // m³
    let f_buoyant = buoyant_force(rho_fluid, volume, 9.8)
    assert_eq((f_buoyant - 980.0).abs() < 0.0001, true)

    // Hydrostatic pressure
    let depth = 10.0 // m
    let p_surface = 101325.0 // Pa
    let pressure = hydrostatic_pressure(rho_fluid, depth, 9.8, p_surface)
    assert_eq(pressure, 199325.0)

    // Bernoulli's principle
    let p1 = 200000.0 // Pa
    let p2 = 150000.0 // Pa
    let v1 = 5.0 // m/s
    let v2 = bernoulli_velocity(p1, p2, rho_fluid, v1)
    assert_eq(v2 > 0.0, true)

    // Continuity equation
    let a1 = 0.1 // m²
    let a2 = 0.05 // m²
    let v2_cont = continuity_equation_velocity(a1, v1, a2)
    assert_eq(v2_cont, 10.0)
    }


    #Vector Operations

    test "vector operations" {
    // Create 3D vectors
    let v1 = vec3(1.0, 2.0, 3.0)
    let v2 = vec3(4.0, 5.0, 6.0)

    // Vector operations
    let dot_product = vec3_dot(v1, v2)
    let magnitude = vec3_magnitude(v1)

    assert_eq(magnitude > 0.0, true)
    assert_eq(dot_product > 0.0, true)

    // Normalize vector
    let normalized = vec3_normalize(v1)
    let mag_norm = vec3_magnitude(normalized)
    assert_eq((mag_norm - 1.0).abs() < 0.0001, true)
    }


    #Unit Conversions

    test "unit conversions" {
    // Speed conversions
    let speed_mps = 10.0 // m/s
    let speed_kmph = mps_to_kmph(speed_mps)
    assert_eq(speed_kmph, 36.0)
    let speed_back = kmph_to_mps(speed_kmph)
    assert_eq((speed_back - speed_mps).abs() < 0.0001, true)

    // Force conversions
    let force_n = 100.0 // N
    let force_lbf = n_to_lbf(force_n)
    let force_back = lbf_to_n(force_lbf)
    assert_eq((force_back - force_n).abs() < 1.0, true)

    // Temperature conversions
    let temp_c = 25.0 // Celsius
    let temp_k = celsius_to_kelvin(temp_c)
    assert_eq((temp_k - 298.15).abs() < 0.01, true)
    let temp_f = celsius_to_fahrenheit(temp_c)
    assert_eq((temp_f - 77.0).abs() < 0.1, true)
    }


    #Parameter Ranges

    #Valid Input Ranges

    • Velocity: Any real number (typically 0 to ~10⁸ m/s for classical mechanics)
    • Acceleration: Any real number (typically -100 to 100 m/s² for most applications)
    • Mass: Positive values (typically 10⁻³⁰ to 10³⁰ kg)
    • Force: Any real number (typically -10⁶ to 10⁶ N for most applications)
    • Time: Non-negative values (typically 0 to 10¹⁸ s)
    • Distance/Length: Non-negative values (typically 10⁻¹⁵ to 10²⁶ m)
    • Angle: Any real number in radians (typically 0 to 2π for most applications)
    • Pressure: Positive values (typically 10³ to 10⁹ Pa)
    • Density: Positive values (typically 10⁻² to 10⁴ kg/m³)
    • Temperature: Any real number in Kelvin (typically 1 to 10⁶ K)


    #Typical Physical Values

    • Earth Surface Gravity: 9.80665 m/s²
    • Speed of Light: 2.998×10⁸ m/s
    • Gravitational Constant: 6.674×10⁻¹¹ m³/(kg·s²)
    • Earth Mass: 5.972×10²⁴ kg
    • Earth Radius: 6.371×10⁶ m
    • Solar Mass: 1.989×10³⁰ kg
    • Astronomical Unit: 1.496×10¹¹ m
    • Standard Atmospheric Pressure: 101325 Pa
    • Water Density: ~1000 kg/m³


    #Testing

    The project includes a comprehensive test suite covering all major functionalities:

    moon test

    #Test Coverage

    • Basic kinematics (uniform motion, accelerated motion, projectile motion)
    • Dynamics (forces, momentum, energy, work, power)
    • Rigid body mechanics (moments of inertia, angular motion, torque)
    • Simple harmonic motion and oscillations
    • Collisions (elastic, inelastic, conservation laws)
    • Orbital mechanics (Kepler's laws, orbital velocities, escape velocity)
    • Fluid mechanics (buoyancy, Bernoulli's principle, continuity equation)
    • Wave mechanics (wave properties, Doppler effect, standing waves)
    • Vector operations and unit conversions
    • Boundary conditions and edge cases
    • Conservation law verification


    #Technical Details

    #Standards and References

    • Classical Mechanics Textbooks: Goldstein, Marion & Thornton, Taylor
    • NIST Physical Constants Database: Fundamental physical constants
    • Standard Physics Formulas: Well-established formulas from physics literature
    • SI Units: All calculations use International System of Units


    #Mathematical Methods

    • Algebraic Calculations: Direct formula applications
    • Trigonometric Functions: For angles, projectile motion, vector operations
    • Exponential Functions: For damped oscillations, rocket equation
    • Numerical Integration: For some extended calculations (e.g., CAPE in meteorology-inspired applications)
    • Iterative Methods: For some complex calculations (where applicable)
    • Vector Mathematics: 3D vector operations using standard vector algebra


    #Notes

    1. Units: All calculations use SI units (meters, kilograms, seconds, Newtons, Joules, etc.)
    2. Precision: Floating-point calculations may have numerical precision limitations
    3. Boundary Conditions: Values outside typical physical ranges may yield unexpected results
    4. Angles: All angles must be in radians (use @math.pi or convert from degrees)
    5. Classical Mechanics: This library focuses on classical (non-relativistic) mechanics. For relativistic effects, some functions are provided (e.g., lorentz_factor, relativistic_mass), but the primary focus is on classical physics
    6. Coordinate Systems: Most functions assume standard Cartesian coordinate systems
    7. Conservation Laws: Functions verify conservation of momentum and energy where applicable
    8. Gravity: Default gravity value uses Earth's surface gravity (9.80665 m/s²), but can be specified for other planets


    #Application Scenarios

    • Physics education and teaching
    • Engineering calculations (mechanics, dynamics, structural analysis)
    • Simulation and modeling (projectile motion, orbital mechanics, collisions)
    • Game development (physics engines, collision detection)
    • Research in classical mechanics
    • Scientific computing and data analysis
    • Robotics (kinematics, dynamics, control systems)
    • Aerospace engineering (orbital mechanics, rocket dynamics)
    • Mechanical engineering (vibrations, rotating machinery, fluid systems)
    • Educational physics demonstrations and visualizations


    #Version Information

    The current version implements approximately 300+ classical mechanics functions, covering:

    • Core kinematics and dynamics
    • Rigid body mechanics (moments of inertia, angular motion)
    • Simple harmonic motion and oscillations
    • Collisions and conservation laws
    • Orbital mechanics (Kepler's laws, orbital velocities)
    • Fluid mechanics (buoyancy, Bernoulli's principle, viscosity)
    • Wave mechanics (wave properties, Doppler effect)
    • Lagrangian and Hamiltonian mechanics
    • Extended features (relativity, continuum mechanics, acoustics)
    • Physical constants and material properties
    • Utility functions (vectors, unit conversions, numerical tools)

    The library is actively developed and aims to provide comprehensive coverage of classical mechanics while being optimized for MoonBit.


    #License

    [Specify your license here]

    Vec3

    pub struct Vec3 {
    x : Double
    y : Double
    z : Double
    }

    3D vector structure
    let G : Double

    Common alias - gravitational constant

    abs_max

    fn abs_max(a : Double, b : Double) -> Double

    Absolute maximum value

    abs_min

    fn abs_min(a : Double, b : Double) -> Double

    Absolute minimum value

    acceleration

    fn acceleration(force : Double, mass : Double) -> Double

    Newton's second law: calculate acceleration f: force (N) m: mass (kg)

    acceleration_from_displacement

    fn acceleration_from_displacement(v0 : Double, v : Double, s : Double) -> Double

    Uniformly accelerated motion: calculate acceleration (given displacement, initial and final velocities) v0: initial velocity (m/s) v: final velocity (m/s) s: displacement (m)

    acceleration_from_thrust

    fn acceleration_from_thrust(thrust : Double, mass : Double, drag : Double) -> Double

    Variable mass: acceleration from thrust thrust: thrust force (N) mass: current mass (kg) drag: drag force (N)

    acceleration_inclined_plane_no_friction

    fn acceleration_inclined_plane_no_friction(gravity : Double, angle : Double) -> Double

    Acceleration on inclined plane (no friction) g: gravitational acceleration (m/s²) angle: inclination angle (radians)

    acceleration_inclined_plane_with_friction

    fn acceleration_inclined_plane_with_friction(gravity : Double, angle : Double, mu_k : Double) -> Double

    Acceleration on inclined plane (with friction) g: gravitational acceleration (m/s²) angle: inclination angle (radians) mu_k: coefficient of kinetic friction

    air_density_sea_level

    let air_density_sea_level : Double

    Density of air (kg/m³) at sea level, 20°C

    air_viscosity

    let air_viscosity : Double

    Dynamic viscosity of air (Pa·s) at 20°C

    aluminum_youngs_modulus

    let aluminum_youngs_modulus : Double

    Young's modulus of aluminum (Pa)

    angular_acceleration

    fn angular_acceleration(torque : Double, moment_of_inertia : Double) -> Double

    Angular acceleration tau: torque (N·m) I: moment of inertia (kg·m²)

    angular_acceleration_from_velocity

    fn angular_acceleration_from_velocity(omega0 : Double, omega : Double, time : Double) -> Double

    Angular acceleration (from angular velocity and time) omega0: initial angular velocity (rad/s) omega: final angular velocity (rad/s) t: time (s)

    angular_displacement

    fn angular_displacement(omega0 : Double, alpha : Double, t : Double) -> Double

    Angular displacement (uniform angular acceleration) omega0: initial angular velocity (rad/s) alpha: angular acceleration (rad/s²) t: time (s)

    angular_displacement_constant_acc

    fn angular_displacement_constant_acc(omega0 : Double, alpha : Double, t : Double) -> Double

    Angular displacement (uniform angular acceleration) omega0: initial angular velocity (rad/s) alpha: angular acceleration (rad/s²) t: time (s)

    angular_momentum

    fn angular_momentum(moment_of_inertia : Double, angular_velocity : Double) -> Double

    Angular momentum I: moment of inertia (kg·m²) omega: angular velocity (rad/s)

    angular_momentum_point_mass

    fn angular_momentum_point_mass(mass : Double, radius : Double, velocity : Double) -> Double

    Angular momentum (point mass) m: mass (kg) r: distance from rotation axis (m) v: linear velocity (m/s)

    angular_momentum_rate

    fn angular_momentum_rate(torque : Double) -> Double

    Angular momentum: rate of change tau: net torque (N·m) Returns: rate of change of angular momentum (N·m)

    angular_velocity

    fn angular_velocity(omega0 : Double, alpha : Double, t : Double) -> Double

    Angular velocity (uniform angular acceleration) omega0: initial angular velocity (rad/s) alpha: angular acceleration (rad/s²) t: time (s)

    angular_velocity_constant_acc

    fn angular_velocity_constant_acc(omega0 : Double, alpha : Double, t : Double) -> Double

    Angular velocity (uniform angular acceleration) omega0: initial angular velocity (rad/s) alpha: angular acceleration (rad/s²) t: time (s)

    angular_velocity_from_conservation

    fn angular_velocity_from_conservation(i1 : Double, omega1 : Double, i2 : Double) -> Double

    Angular momentum conservation: calculate final angular velocity i1: initial moment of inertia (kg·m²) omega1: initial angular velocity (rad/s) i2: final moment of inertia (kg·m²) Returns: final angular velocity

    angular_velocity_from_linear

    fn angular_velocity_from_linear(velocity : Double, radius : Double) -> Double

    Relationship between angular velocity and linear velocity v: linear velocity (m/s) r: radius (m)

    angular_velocity_squared_relation

    fn angular_velocity_squared_relation(omega0 : Double, omega : Double, alpha : Double) -> Double

    Angular velocity squared relation (uniform angular acceleration) omega0: initial angular velocity (rad/s) omega: final angular velocity (rad/s) alpha: angular acceleration (rad/s²)

    approx_eq

    fn approx_eq(a : Double, b : Double, epsilon : Double) -> Bool

    Check if two floating-point numbers are approximately equal (considering floating-point errors)

    approx_equal

    fn approx_equal(a : Double, b : Double) -> Bool

    Approximate equality check with default precision (epsilon = 1e-9)

    areal_velocity

    fn areal_velocity(radius : Double, v_perpendicular : Double) -> Double

    Kepler's second law: areal velocity r: distance (m) v_perp: velocity component perpendicular to radial direction (m/s)

    astronomical_unit

    let astronomical_unit : Double

    Astronomical unit (m) - average Earth-Sun distance

    atmospheric_pressure

    let atmospheric_pressure : Double

    Standard atmospheric pressure (Pa)

    average

    fn average(values : Array[Double]) -> Double

    Average value from array values: array of values

    average_power

    fn average_power(work : Double, time : Double) -> Double

    Average power (variable force) w: total work (J) t: total time (s)

    avogadro_number

    let avogadro_number : Double

    Avogadro's number (1/mol)

    beat_frequency

    fn beat_frequency(f1 : Double, f2 : Double) -> Double

    Beat frequency (difference of two close frequencies) f1: frequency 1 (Hz) f2: frequency 2 (Hz)

    beat_period

    fn beat_period(f1 : Double, f2 : Double) -> Double

    Beat period f1: frequency 1 (Hz) f2: frequency 2 (Hz)

    bernoulli_pressure

    fn bernoulli_pressure(p1 : Double, rho : Double, v1 : Double, v2 : Double) -> Double

    Bernoulli equation: calculate pressure (simplified, assuming constant height) p1: pressure 1 (Pa) rho: fluid density (kg/m³) v1: velocity 1 (m/s) v2: velocity 2 (m/s) Returns: pressure 2

    bernoulli_velocity

    fn bernoulli_velocity(p1 : Double, p2 : Double, rho : Double, v1 : Double) -> Double

    Bernoulli equation: calculate velocity (simplified, assuming constant height) p1: pressure 1 (Pa) p2: pressure 2 (Pa) rho: fluid density (kg/m³) v1: velocity 1 (m/s) Returns: velocity 2

    boltzmann_constant

    let boltzmann_constant : Double

    Boltzmann constant (J/K)

    bulk_modulus

    fn bulk_modulus(pressure_change : Double, volume_change : Double, original_volume : Double) -> Double

    Bulk modulus (compression modulus) delta_p: pressure change (Pa) delta_v: volume change (m³) v0: original volume (m³)

    buoyant_force

    fn buoyant_force(fluid_density : Double, displaced_volume : Double, gravity : Double) -> Double

    Buoyant force (Archimedes' principle) rho: fluid density (kg/m³) V: displaced fluid volume (m³) g: gravitational acceleration (m/s²)
    let c : Double

    Common alias - speed of light

    cal_to_j

    fn cal_to_j(calories : Double) -> Double

    Convert calories to joules

    capillary_rise

    fn capillary_rise(surface_tension : Double, density : Double, radius : Double, gravity : Double, contact_angle : Double) -> Double

    Surface tension: capillary rise gamma: surface tension (N/m) rho: liquid density (kg/m³) r: capillary radius (m) g: gravitational acceleration (m/s²) theta: contact angle (radians)

    celsius_to_fahrenheit

    fn celsius_to_fahrenheit(celsius : Double) -> Double

    Convert Celsius to Fahrenheit

    celsius_to_kelvin

    fn celsius_to_kelvin(celsius : Double) -> Double

    Convert Celsius to Kelvin

    center_of_mass_1d

    fn center_of_mass_1d(masses : Array[Double], positions : Array[Double]) -> Double

    Center of mass position (one-dimensional, multiple particles) masses: mass array (kg) positions: position array (m)

    center_of_mass_acceleration_1d

    fn center_of_mass_acceleration_1d(masses : Array[Double], accelerations : Array[Double]) -> Double

    Center of mass acceleration (one-dimensional, multiple particles) masses: mass array (kg) accelerations: acceleration array (m/s²)

    center_of_mass_velocity_1d

    fn center_of_mass_velocity_1d(masses : Array[Double], velocities : Array[Double]) -> Double

    Center of mass velocity (one-dimensional, multiple particles) masses: mass array (kg) velocities: velocity array (m/s)

    centrifugal_force

    fn centrifugal_force(mass : Double, angular_velocity : Double, radius : Double) -> Double

    Centrifugal force m: mass (kg) omega: angular velocity (rad/s) r: distance from rotation axis (m)

    centripetal_acceleration

    fn centripetal_acceleration(velocity : Double, radius : Double) -> Double

    Centripetal acceleration v: linear velocity (m/s) r: radius (m)

    centripetal_acceleration_angular

    fn centripetal_acceleration_angular(angular_velocity : Double, radius : Double) -> Double

    Centripetal acceleration (using angular velocity) omega: angular velocity (rad/s) r: radius (m)

    centripetal_force

    fn centripetal_force(mass : Double, velocity : Double, radius : Double) -> Double

    Centripetal force m: mass (kg) v: linear velocity (m/s) r: radius (m)

    centripetal_force_angular

    fn centripetal_force_angular(mass : Double, angular_velocity : Double, radius : Double) -> Double

    Centripetal force (using angular velocity) m: mass (kg) omega: angular velocity (rad/s) r: radius (m)

    circular_motion_frequency

    fn circular_motion_frequency(angular_velocity : Double) -> Double

    Frequency of circular motion omega: angular velocity (rad/s)

    circular_motion_period

    fn circular_motion_period(angular_velocity : Double) -> Double

    Period of circular motion omega: angular velocity (rad/s)

    clamp

    fn clamp(value : Double, min_val : Double, max_val : Double) -> Double

    Clamp value to [min, max] range

    coefficient_of_restitution

    fn coefficient_of_restitution(v1f : Double, v2f : Double, v1i : Double, v2i : Double) -> Double

    Coefficient of restitution: ratio of relative velocity after collision to before collision v1f: velocity of object 1 after collision (m/s) v2f: velocity of object 2 after collision (m/s) v1i: velocity of object 1 before collision (m/s) v2i: velocity of object 2 before collision (m/s)

    concrete_youngs_modulus

    let concrete_youngs_modulus : Double

    Young's modulus of concrete (Pa)

    continuity_equation_velocity

    fn continuity_equation_velocity(a1 : Double, v1 : Double, a2 : Double) -> Double

    Continuity equation: calculate flow velocity a1: cross-sectional area 1 (m²) v1: velocity 1 (m/s) a2: cross-sectional area 2 (m²) Returns: velocity 2

    coriolis_force

    fn coriolis_force(mass : Double, relative_velocity : Double, angular_velocity : Double) -> Double

    Coriolis force (one-dimensional simplified) m: mass (kg) v: relative velocity (m/s) omega: angular velocity (rad/s)

    critical_damping_coefficient

    fn critical_damping_coefficient(mass : Double, spring_constant : Double) -> Double

    Critical damping coefficient m: mass (kg) k: spring constant (N/m)

    damped_angular_frequency

    fn damped_angular_frequency(natural_frequency : Double, damping : Double) -> Double

    Angular frequency of damped oscillation (underdamped) omega0: natural angular frequency (rad/s) gamma: damping coefficient

    damping_coefficient

    fn damping_coefficient(b : Double, mass : Double) -> Double

    Damping coefficient for damped oscillation b: damping coefficient (kg/s) m: mass (kg)

    damping_ratio

    fn damping_ratio(damping_coefficient : Double, natural_frequency : Double) -> Double

    Damping ratio gamma: damping coefficient omega0: natural angular frequency (rad/s)

    deg_to_rad

    fn deg_to_rad(degrees : Double) -> Double

    Convert degrees to radians

    doppler_effect_observer_moving

    fn doppler_effect_observer_moving(source_frequency : Double, sound_speed : Double, observer_velocity : Double) -> Double

    Doppler effect: source stationary, observer moving f0: source frequency (Hz) v: sound speed (m/s) vo: observer velocity (m/s), positive toward source

    doppler_effect_source_moving

    fn doppler_effect_source_moving(source_frequency : Double, sound_speed : Double, source_velocity : Double) -> Double

    Doppler effect: observer stationary, source moving f0: source frequency (Hz) v: sound speed (m/s) vs: source velocity (m/s), positive toward observer

    double_pendulum_upper_frequency

    fn double_pendulum_upper_frequency(gravity : Double, upper_length : Double) -> Double

    Double pendulum: angular frequency under small angle approximation (upper pendulum) g: gravitational acceleration (m/s²) l1: upper pendulum length (m)

    earth_angular_velocity

    let earth_angular_velocity : Double

    Earth mean angular velocity (rad/s)

    earth_gravity

    let earth_gravity : Double

    Earth-related constants Earth surface gravitational acceleration g (m/s²)

    earth_mass

    let earth_mass : Double

    Earth mass (kg)

    earth_radius

    let earth_radius : Double

    Earth mean radius (m)

    earth_sun_distance

    let earth_sun_distance : Double

    Earth-Sun distance (semi-major axis) (m)

    elastic_collision_1d_v1f

    fn elastic_collision_1d_v1f(m1 : Double, m2 : Double, v1i : Double, v2i : Double) -> Double

    Perfectly elastic collision: 1D, velocity after collision of two objects m1: object 1 mass (kg) m2: object 2 mass (kg) v1i: object 1 initial velocity (m/s) v2i: object 2 initial velocity (m/s) Returns: object 1 final velocity (m/s)

    elastic_collision_1d_v2f

    fn elastic_collision_1d_v2f(m1 : Double, m2 : Double, v1i : Double, v2i : Double) -> Double

    Perfectly elastic collision: 1D, velocity after collision of two objects m1: object 1 mass (kg) m2: object 2 mass (kg) v1i: object 1 initial velocity (m/s) v2i: object 2 initial velocity (m/s) Returns: object 2 final velocity (m/s)

    elastic_collision_2d_v1x

    fn elastic_collision_2d_v1x(m1 : Double, m2 : Double, v1i : Double, v2i : Double, theta1 : Double, theta2 : Double) -> Double

    Two-dimensional elastic collision: final velocity component m1: mass 1 (kg) m2: mass 2 (kg) v1i: initial velocity 1 (m/s) v2i: initial velocity 2 (m/s) theta1: angle of approach 1 (radians) theta2: angle of approach 2 (radians) Returns: final velocity of object 1 in x-direction (simplified)

    elastic_collision_v1

    fn elastic_collision_v1(m1 : Double, v1 : Double, m2 : Double, v2 : Double) -> Double

    Elastic collision: velocity after one-dimensional perfectly elastic collision m1: mass of object 1 (kg) v1: initial velocity of object 1 (m/s) m2: mass of object 2 (kg) v2: initial velocity of object 2 (m/s) Returns: final velocity of object 1

    elastic_collision_v2

    fn elastic_collision_v2(m1 : Double, v1 : Double, m2 : Double, v2 : Double) -> Double

    Elastic collision: velocity after one-dimensional perfectly elastic collision Returns: final velocity of object 2

    elastic_potential_energy

    fn elastic_potential_energy(spring_constant : Double, displacement : Double) -> Double

    Elastic potential energy k: spring constant (N/m) x: displacement (m)

    energy_dissipation_rate

    fn energy_dissipation_rate(damping_coefficient : Double, energy : Double) -> Double

    Damped oscillation: energy dissipation rate gamma: damping coefficient energy: current energy (J)

    energy_efficiency

    fn energy_efficiency(energy_out : Double, energy_in : Double) -> Double

    Energy conversion efficiency energy_out: output energy (J) energy_in: input energy (J)

    equilibrium_net_force_1d

    fn equilibrium_net_force_1d(forces : Array[Double]) -> Bool

    Equilibrium condition: net force equals zero (1D) forces: force array (N)

    equilibrium_net_torque

    fn equilibrium_net_torque(torques : Array[Double]) -> Bool

    Equilibrium condition: net torque equals zero torques: torque array (N·m)

    escape_velocity

    fn escape_velocity(radius : Double, central_mass : Double, g_const : Double) -> Double

    Escape velocity r: distance from central body (m) M: central body mass (kg) g_const: gravitational constant

    fahrenheit_to_celsius

    fn fahrenheit_to_celsius(fahrenheit : Double) -> Double

    Convert Fahrenheit to Celsius

    first_cosmic_velocity

    fn first_cosmic_velocity(gravity : Double, radius : Double) -> Double

    First cosmic velocity (Earth's surface)

    force

    fn force(mass : Double, acceleration : Double) -> Double

    Newton's second law: calculate force m: mass (kg) a: acceleration (m/s²)

    forced_oscillation_amplitude

    fn forced_oscillation_amplitude(f0 : Double, mass : Double, omega0 : Double, omega_d : Double, gamma : Double) -> Double

    Forced oscillation amplitude (harmonic driving force) f0: driving force amplitude (N) m: mass (kg) omega0: natural angular frequency (rad/s) omega_d: driving angular frequency (rad/s) gamma: damping coefficient Returns: amplitude
    let g : Double

    Common alias - gravitational acceleration

    g_to_kg

    fn g_to_kg(grams : Double) -> Double

    Convert grams to kilograms

    gas_constant

    let gas_constant : Double

    Universal gas constant (J/(mol·K))

    generalized_force_1d

    fn generalized_force_1d(potential_energy : Double, generalized_coordinate : Double) -> Double

    Generalized force (1D, conservative) v: potential energy (J) q: generalized coordinate (m or rad)

    generalized_momentum_1d

    fn generalized_momentum_1d(generalized_velocity : Double) -> Double

    Generalized momentum (1D) l: Lagrangian (J) q_dot: generalized velocity (m/s or rad/s)

    gravitational_constant

    let gravitational_constant : Double

    Gravitational constant G (m³/(kg·s²))

    gravitational_force

    fn gravitational_force(m1 : Double, m2 : Double, r : Double, g_const : Double) -> Double

    Gravitational force m1: mass of object 1 (kg) m2: mass of object 2 (kg) r: distance (m) g_const: gravitational constant (m³/(kg·s²))

    gravitational_potential_energy

    fn gravitational_potential_energy(mass : Double, height : Double, g : Double) -> Double

    Gravitational potential energy m: mass (kg) h: height (m) g: gravitational acceleration (m/s²)

    gravity_component_along_incline

    fn gravity_component_along_incline(mass : Double, gravity : Double, angle : Double) -> Double

    Gravity component along inclined plane m: mass (kg) g: gravitational acceleration (m/s²) angle: inclination angle (radians)

    h_to_s

    fn h_to_s(hours : Double) -> Double

    Convert hours to seconds

    hamiltonian

    fn hamiltonian(kinetic_energy : Double, potential_energy : Double) -> Double

    Hamiltonian function H = T + V (for conservative systems) T: kinetic energy V: potential energy

    hamiltonian_from_lagrangian

    fn hamiltonian_from_lagrangian(momentum : Double, velocity : Double, lagrangian : Double) -> Double

    Hamiltonian function H = Σ(p_i * q_dot_i) - L For single degree of freedom system: H = p * q_dot - L p: generalized momentum q_dot: generalized velocity L: Lagrangian function

    hamiltonian_q_dot_1d

    fn hamiltonian_q_dot_1d(momentum : Double) -> Double

    Hamiltonian canonical equation: q_dot = ∂H/∂p (1D simplified) Note: This is a simplified version, assumes H = p^2/(2m) + V(q), where ∂H/∂p = p/m For simplicity, directly returns momentum value (divide by mass when needed) p: generalized momentum (kg·m/s)

    hohmann_transfer_dv1

    fn hohmann_transfer_dv1(r1 : Double, r2 : Double, central_mass : Double, g_const : Double) -> Double

    Hohmann transfer: delta-v for first burn r1: initial orbit radius (m) r2: target orbit radius (m) m_central: central mass (kg) g_const: gravitational constant

    hohmann_transfer_dv2

    fn hohmann_transfer_dv2(r1 : Double, r2 : Double, central_mass : Double, g_const : Double) -> Double

    Hohmann transfer: delta-v for second burn r1: initial orbit radius (m) r2: target orbit radius (m) m_central: central mass (kg) g_const: gravitational constant

    hookes_law_force

    fn hookes_law_force(spring_constant : Double, displacement : Double) -> Double

    Hooke's law: elastic restoring force k: spring constant (N/m) x: displacement (m)

    hp_to_w

    fn hp_to_w(horsepower : Double) -> Double

    Convert horsepower to watts

    hydrostatic_pressure

    fn hydrostatic_pressure(fluid_density : Double, depth : Double, gravity : Double, surface_pressure : Double) -> Double

    Hydrostatic pressure rho: fluid density (kg/m³) h: depth (m) g: gravitational acceleration (m/s²) P0: surface pressure (Pa), default is atmospheric pressure

    impulse

    fn impulse(force : Double, time : Double) -> Double

    Impulse f: force (N) t: time (s)

    in_range

    fn in_range(value : Double, min_val : Double, max_val : Double) -> Bool

    Check if value is within range [min, max]

    inelastic_collision_1d_v1f

    fn inelastic_collision_1d_v1f(m1 : Double, m2 : Double, v1i : Double, v2i : Double, e : Double) -> Double

    Inelastic collision: calculate final velocity using coefficient of restitution m1: object 1 mass (kg) m2: object 2 mass (kg) v1i: object 1 initial velocity (m/s) v2i: object 2 initial velocity (m/s) e: coefficient of restitution Returns: object 1 final velocity (m/s)

    inelastic_collision_velocity

    fn inelastic_collision_velocity(m1 : Double, v1 : Double, m2 : Double, v2 : Double) -> Double

    Perfectly inelastic collision: velocity after collision

    inertial_force

    fn inertial_force(mass : Double, acceleration : Double) -> Double

    Inertial force (accelerating reference frame) m: mass (kg) a: reference frame acceleration (m/s²)

    j_to_cal

    fn j_to_cal(joules : Double) -> Double

    Convert joules to calories

    jupiter_gravity

    let jupiter_gravity : Double

    Jupiter surface gravity (m/s²)

    jupiter_mass

    let jupiter_mass : Double

    Jupiter mass (kg)

    jupiter_radius

    let jupiter_radius : Double

    Jupiter radius (m)

    kelvin_to_celsius

    fn kelvin_to_celsius(kelvin : Double) -> Double

    Convert Kelvin to Celsius

    kepler_period

    fn kepler_period(semi_major_axis : Double, central_mass : Double, g_const : Double) -> Double

    Kepler's third law: orbital period a: semi-major axis (m) M: central body mass (kg) g_const: gravitational constant (m³/(kg·s²))

    kg_to_g

    fn kg_to_g(kilograms : Double) -> Double

    Convert kilograms to grams

    kinetic_energy

    fn kinetic_energy(mass : Double, velocity : Double) -> Double

    Kinetic energy m: mass (kg) v: velocity (m/s)

    kinetic_energy_com_frame

    fn kinetic_energy_com_frame(m1 : Double, m2 : Double, v1 : Double, v2 : Double) -> Double

    Collision: kinetic energy in center of mass frame m1: mass 1 (kg) m2: mass 2 (kg) v1: velocity 1 (m/s) v2: velocity 2 (m/s)

    kinetic_energy_from_work

    fn kinetic_energy_from_work(work : Double, ke_initial : Double) -> Double

    Kinetic energy from work work: work done (J) ke_initial: initial kinetic energy (J)

    kinetic_energy_loss_inelastic

    fn kinetic_energy_loss_inelastic(m1 : Double, v1 : Double, m2 : Double, v2 : Double) -> Double

    Kinetic energy loss in perfectly inelastic collision m1: mass of object 1 (kg) v1: initial velocity of object 1 (m/s) m2: mass of object 2 (kg) v2: initial velocity of object 2 (m/s) Returns: kinetic energy lost

    kinetic_energy_loss_partial

    fn kinetic_energy_loss_partial(m1 : Double, v1 : Double, m2 : Double, v2 : Double, e : Double) -> Double

    Kinetic energy loss in partially elastic collision m1: mass of object 1 (kg) v1: initial velocity of object 1 (m/s) m2: mass of object 2 (kg) v2: initial velocity of object 2 (m/s) e: coefficient of restitution Returns: kinetic energy lost

    kinetic_friction

    fn kinetic_friction(mu_k : Double, normal_force : Double) -> Double

    Kinetic friction mu_k: coefficient of kinetic friction N: normal force (N)

    km_to_m

    fn km_to_m(kilometers : Double) -> Double

    Convert kilometers to meters

    kmph_to_mps

    fn kmph_to_mps(kmph : Double) -> Double

    Convert kilometers per hour to meters per second

    lagrangian

    fn lagrangian(kinetic_energy : Double, potential_energy : Double) -> Double

    Lagrangian function L = T - V T: kinetic energy V: potential energy

    lagrangian_generalized_force

    fn lagrangian_generalized_force(dL_dq_dot_dt : Double, dL_dq : Double) -> Double

    Lagrangian equation: calculate generalized force (conservative system) For L = L(q, q_dot, t), generalized force Q = d/dt(dL/dq_dot) - dL/dq This is a simplified version assuming L does not explicitly depend on time

    Note: This is a simplified version; full implementation requires symbolic differentiation

    dL_dq_dot: time derivative of dL/dq_dot dL_dq: dL/dq

    laminar_drag_cylinder

    fn laminar_drag_cylinder(dynamic_viscosity : Double, length : Double, velocity : Double, diameter : Double) -> Double

    Laminar drag (cylinder) mu: dynamic viscosity (Pa·s) l: length (m) v: velocity (m/s) d: diameter (m)

    laplace_pressure

    fn laplace_pressure(surface_tension : Double, radius1 : Double, radius2 : Double) -> Double

    Surface tension: pressure difference across curved surface (Laplace's law) gamma: surface tension (N/m) r1: principal radius 1 (m) r2: principal radius 2 (m)

    lbf_to_n

    fn lbf_to_n(pounds : Double) -> Double

    Convert pounds-force to Newtons

    lerp

    fn lerp(a : Double, b : Double, t : Double) -> Double

    Linear interpolation

    lever_equilibrium

    fn lever_equilibrium(f1 : Double, r1 : Double, f2 : Double, r2 : Double) -> Bool

    Lever equilibrium condition: torque balance f1: force 1 (N) r1: lever arm 1 (m) f2: force 2 (N) r2: lever arm 2 (m) Returns: whether balanced (considering floating-point errors)

    lever_equilibrium_force

    fn lever_equilibrium_force(f1 : Double, r1 : Double, r2 : Double) -> Double

    Lever equilibrium: calculate unknown force f1: known force (N) r1: lever arm 1 (m) r2: lever arm 2 (m) Returns: force 2 required for equilibrium

    light_year

    let light_year : Double

    Light year (m)

    linear_velocity_from_angular

    fn linear_velocity_from_angular(angular_velocity : Double, radius : Double) -> Double

    Relationship between linear velocity and angular velocity omega: angular velocity (rad/s) r: radius (m)

    lorentz_factor

    fn lorentz_factor(velocity : Double, speed_of_light : Double) -> Double

    Lorentz factor (gamma) v: velocity (m/s) c: speed of light (m/s)

    m_to_km

    fn m_to_km(meters : Double) -> Double

    Convert meters to kilometers

    mach_number

    fn mach_number(velocity : Double, sound_speed : Double) -> Double

    Mach number (ratio of flow velocity to sound speed) v: flow velocity (m/s) c: sound speed (m/s)

    map_range

    fn map_range(value : Double, from_min : Double, from_max : Double, to_min : Double, to_max : Double) -> Double

    Map value from one range to another

    mars_gravity

    let mars_gravity : Double

    Mars surface gravity (m/s²)

    mars_mass

    let mars_mass : Double

    Mars mass (kg)

    mars_radius

    let mars_radius : Double

    Mars radius (m)

    mass_energy_equivalence

    fn mass_energy_equivalence(mass : Double, speed_of_light : Double) -> Double

    Mass-energy equivalence: E = mc² m: mass (kg) c: speed of light (m/s)

    mass_flow_rate

    fn mass_flow_rate(density : Double, velocity : Double, area : Double) -> Double

    Mass flow rate rho: density (kg/m³) v: velocity (m/s) a: area (m²)

    max_height_from_energy

    fn max_height_from_energy(v0 : Double, h0 : Double, g : Double) -> Double

    Mechanical energy conservation: calculate maximum height v0: initial velocity (m/s) h0: initial height (m) g: gravitational acceleration (m/s²) Returns: maximum height

    max_value

    fn max_value(values : Array[Double]) -> Double

    Maximum value in array

    mechanical_efficiency

    fn mechanical_efficiency(output_power : Double, input_power : Double) -> Double

    Mechanical efficiency output_power: useful output power (W) input_power: total input power (W)

    mechanical_energy

    fn mechanical_energy(kinetic : Double, potential : Double) -> Double

    Mechanical energy (kinetic + potential)

    mercury_gravity

    let mercury_gravity : Double

    Mercury surface gravity (m/s²)

    mercury_mass

    let mercury_mass : Double

    Mercury mass (kg)

    mercury_radius

    let mercury_radius : Double

    Mercury radius (m)

    min_value

    fn min_value(values : Array[Double]) -> Double

    Minimum value in array

    moment_of_inertia_cone_axis

    fn moment_of_inertia_cone_axis(mass : Double, radius : Double) -> Double

    Moment of inertia: solid cone (about symmetry axis) m: mass (kg) r: base radius (m)

    moment_of_inertia_cylinder_axis

    fn moment_of_inertia_cylinder_axis(mass : Double, radius : Double) -> Double

    Moment of inertia: solid cylinder (about central axis) m: mass (kg) r: radius (m)

    moment_of_inertia_cylinder_diameter

    fn moment_of_inertia_cylinder_diameter(mass : Double, radius : Double, height : Double) -> Double

    Moment of inertia: solid cylinder (about diameter through center) m: mass (kg) r: radius (m) h: height (m)

    moment_of_inertia_disk

    fn moment_of_inertia_disk(mass : Double, radius : Double) -> Double

    Moment of inertia: disk/cylinder (about central axis) m: mass (kg) r: radius (m)

    moment_of_inertia_ellipsoid

    fn moment_of_inertia_ellipsoid(mass : Double, a : Double, b : Double, c : Double, axis : Int) -> Double

    Moment of inertia: ellipsoid (about axis through center) m: mass (kg) a: semi-axis a (m) b: semi-axis b (m) c: semi-axis c (m) axis: which axis (1=a, 2=b, 3=c)

    moment_of_inertia_from_conservation

    fn moment_of_inertia_from_conservation(i1 : Double, omega1 : Double, omega2 : Double) -> Double

    Angular momentum conservation: calculate final moment of inertia i1: initial moment of inertia (kg·m²) omega1: initial angular velocity (rad/s) omega2: final angular velocity (rad/s) Returns: final moment of inertia

    moment_of_inertia_hollow_sphere

    fn moment_of_inertia_hollow_sphere(mass : Double, radius : Double) -> Double

    Moment of inertia: hollow sphere (about diameter) m: mass (kg) r: radius (m)

    moment_of_inertia_point_mass

    fn moment_of_inertia_point_mass(mass : Double, radius : Double) -> Double

    Moment of inertia: point mass m: mass (kg) r: distance from rotation axis (m)

    moment_of_inertia_rectangular_bar

    fn moment_of_inertia_rectangular_bar(mass : Double, width : Double, height : Double) -> Double

    Moment of inertia: rectangular bar (about center, perpendicular to length) m: mass (kg) a: width (m) b: height (m)

    moment_of_inertia_rectangular_plate

    fn moment_of_inertia_rectangular_plate(mass : Double, length : Double, width : Double) -> Double

    Moment of inertia: rectangular plate (about center, perpendicular to plate) m: mass (kg) a: length (m) b: width (m)

    moment_of_inertia_rectangular_plate_edge

    fn moment_of_inertia_rectangular_plate_edge(mass : Double, width : Double) -> Double

    Moment of inertia: rectangular plate (about long edge) m: mass (kg) b: width (m)

    moment_of_inertia_ring

    fn moment_of_inertia_ring(mass : Double, radius : Double) -> Double

    Moment of inertia: ring (about central axis) m: mass (kg) r: radius (m)

    moment_of_inertia_ring_diameter

    fn moment_of_inertia_ring_diameter(mass : Double, radius : Double) -> Double

    Moment of inertia: thin ring (about diameter) m: mass (kg) r: radius (m)

    moment_of_inertia_rod_center

    fn moment_of_inertia_rod_center(mass : Double, length : Double) -> Double

    Moment of inertia: thin rod (about center) m: mass (kg) l: length (m)

    moment_of_inertia_rod_end

    fn moment_of_inertia_rod_end(mass : Double, length : Double) -> Double

    Moment of inertia: thin rod (about end) m: mass (kg) l: length (m)

    moment_of_inertia_sphere

    fn moment_of_inertia_sphere(mass : Double, radius : Double) -> Double

    Moment of inertia: solid sphere (about diameter) m: mass (kg) r: radius (m)

    momentum

    fn momentum(mass : Double, velocity : Double) -> Double

    Momentum m: mass (kg) v: velocity (m/s)

    momentum_change

    fn momentum_change(mass : Double, v1 : Double, v2 : Double) -> Double

    Change in momentum m: mass (kg) v1: initial velocity (m/s) v2: final velocity (m/s)

    moon_earth_distance

    let moon_earth_distance : Double

    Moon-Earth distance (average) (m)

    moon_mass

    let moon_mass : Double

    Moon mass (kg)

    mps_to_kmph

    fn mps_to_kmph(mps : Double) -> Double

    Convert meters per second to kilometers per hour

    n_to_lbf

    fn n_to_lbf(newtons : Double) -> Double

    Convert Newtons to pounds-force

    net_force_1d

    fn net_force_1d(forces : Array[Double]) -> Double

    Rigid body equilibrium: net force is zero forces: force array (N) Note: This is a simplified version assuming all forces are in the same direction

    net_torque

    fn net_torque(torques : Array[Double]) -> Double

    Rigid body equilibrium: net torque is zero torques: torque array (N·m)

    normal_coordinate_antisymmetric

    fn normal_coordinate_antisymmetric(x1 : Double, x2 : Double) -> Double

    Coupled oscillators: normal coordinate (antisymmetric mode) x1: oscillator 1 displacement (m) x2: oscillator 2 displacement (m)

    normal_coordinate_symmetric

    fn normal_coordinate_symmetric(x1 : Double, x2 : Double) -> Double

    Coupled oscillators: normal coordinate (symmetric mode) x1: oscillator 1 displacement (m) x2: oscillator 2 displacement (m)

    normal_force_horizontal

    fn normal_force_horizontal(mass : Double, gravity : Double) -> Double

    Normal force (horizontal surface) m: mass (kg) g: gravitational acceleration (m/s²)

    normal_force_inclined_plane

    fn normal_force_inclined_plane(mass : Double, gravity : Double, angle : Double) -> Double

    Normal force on inclined plane m: mass (kg) g: gravitational acceleration (m/s²) angle: inclination angle (radians)

    normal_force_inclined_with_force

    fn normal_force_inclined_with_force(mass : Double, gravity : Double, angle : Double, parallel_force : Double) -> Double

    Normal force (inclined plane, considering friction) m: mass (kg) g: gravitational acceleration (m/s²) angle: incline angle (radians) f_parallel: force along incline (e.g., friction) (N)

    normal_frequency_antisymmetric

    fn normal_frequency_antisymmetric(omega0 : Double, k_coupling : Double, mass : Double) -> Double

    Normal frequency of coupled oscillations (two identical oscillators, antisymmetric mode) omega0: natural angular frequency of single oscillator (rad/s) k_coupling: coupling constant m: mass (kg) Returns: normal frequency (antisymmetric mode)

    normal_frequency_symmetric

    fn normal_frequency_symmetric(omega0 : Double) -> Double

    Normal frequency of coupled oscillations (two identical oscillators) omega0: natural angular frequency of single oscillator (rad/s) k_coupling: coupling constant m: mass (kg) Returns: normal frequency (symmetric mode)

    normal_mode_frequency_antisymmetric

    fn normal_mode_frequency_antisymmetric(k : Double, mass : Double) -> Double

    Coupled oscillators: normal mode frequency (antisymmetric mode) k: spring constant (N/m) k_coupling: coupling spring constant (N/m) m: mass (kg) Returns: normal mode frequency (rad/s)

    normal_mode_frequency_symmetric

    fn normal_mode_frequency_symmetric(k : Double, k_coupling : Double, mass : Double) -> Double

    Coupled oscillators: normal mode frequency (symmetric coupling, two identical oscillators) k: spring constant (N/m) k_coupling: coupling spring constant (N/m) m: mass (kg) Returns: normal mode frequency (rad/s)

    normal_strain

    fn normal_strain(length_change : Double, original_length : Double) -> Double

    Strain (normal strain) delta_l: length change (m) l0: original length (m)

    normal_stress

    fn normal_stress(force : Double, area : Double) -> Double

    Stress (normal stress) f: force (N) a: area (m²)

    nutation_frequency

    fn nutation_frequency(moment_of_inertia : Double, omega_precess : Double, omega_spin : Double, mass : Double, gravity : Double, radius : Double) -> Double

    Gyroscope: nutation frequency i: moment of inertia (kg·m²) omega_precess: precession angular velocity (rad/s) omega_spin: spin angular velocity (rad/s) m: mass (kg) g: gravitational acceleration (m/s²) r: distance from pivot to center of mass (m)

    orbital_energy_circular

    fn orbital_energy_circular(mass : Double, central_mass : Double, radius : Double, g_const : Double) -> Double

    Orbital energy (circular orbit) m: object mass (kg) m_central: central body mass (kg) r: orbital radius (m) g_const: gravitational constant (m³/(kg·s²))

    orbital_energy_elliptical

    fn orbital_energy_elliptical(mass : Double, central_mass : Double, semi_major_axis : Double, g_const : Double) -> Double

    Orbital energy (elliptical orbit) m: object mass (kg) m_central: central body mass (kg) a: semi-major axis (m) g_const: gravitational constant (m³/(kg·s²))

    orbital_period_elliptical

    fn orbital_period_elliptical(semi_major_axis : Double, central_mass : Double, g_const : Double) -> Double

    Orbital period (elliptical orbit) a: semi-major axis (m) m_central: central body mass (kg) g_const: gravitational constant (m³/(kg·s²))

    orbital_velocity_apoapsis

    fn orbital_velocity_apoapsis(semi_major_axis : Double, eccentricity : Double, central_mass : Double, g_const : Double) -> Double

    Orbital velocity: elliptical orbit at apoapsis a: semi-major axis (m) e: eccentricity m_central: central mass (kg) g_const: gravitational constant

    orbital_velocity_circular

    fn orbital_velocity_circular(radius : Double, central_mass : Double, g_const : Double) -> Double

    Orbital velocity (circular orbit) r: orbital radius (m) M: central body mass (kg) g_const: gravitational constant

    orbital_velocity_periapsis

    fn orbital_velocity_periapsis(semi_major_axis : Double, eccentricity : Double, central_mass : Double, g_const : Double) -> Double

    Orbital velocity: elliptical orbit at periapsis a: semi-major axis (m) e: eccentricity m_central: central mass (kg) g_const: gravitational constant

    parallel_axis_theorem

    fn parallel_axis_theorem(i_cm : Double, mass : Double, distance : Double) -> Double

    Parallel axis theorem: calculate moment of inertia i_cm: moment of inertia about center of mass (kg·m²) m: mass (kg) d: distance to new axis (m)

    parsec

    let parsec : Double

    Parsec (m)

    pendulum_angular_frequency

    fn pendulum_angular_frequency(gravity : Double, length : Double) -> Double

    Simple pendulum: angular frequency g: gravitational acceleration (m/s²) l: pendulum length (m)

    pendulum_period

    fn pendulum_period(gravity : Double, length : Double) -> Double

    Simple pendulum: period

    perfectly_inelastic_collision_velocity

    fn perfectly_inelastic_collision_velocity(m1 : Double, m2 : Double, v1i : Double, v2i : Double) -> Double

    Perfectly inelastic collision: common velocity after collision m1: object 1 mass (kg) m2: object 2 mass (kg) v1i: object 1 initial velocity (m/s) v2i: object 2 initial velocity (m/s)

    phase_space_volume_1d

    fn phase_space_volume_1d(position : Double, momentum : Double) -> Double

    Phase space volume (1D) x: position (m) p: momentum (kg·m/s)

    physical_pendulum_angular_frequency

    fn physical_pendulum_angular_frequency(mass : Double, gravity : Double, moment_of_inertia : Double, distance : Double) -> Double

    Compound pendulum: angular frequency m: mass (kg) g: gravitational acceleration (m/s²) i: moment of inertia (kg·m²) d: distance from center of mass to pivot (m)

    physical_pendulum_period

    fn physical_pendulum_period(mass : Double, gravity : Double, moment_of_inertia : Double, distance : Double) -> Double

    Compound pendulum: period m: mass (kg) g: gravitational acceleration (m/s²) i: moment of inertia (kg·m²) d: distance from center of mass to pivot (m)

    planck_constant

    let planck_constant : Double

    Planck constant h (J·s)

    poiseuille_flow_rate

    fn poiseuille_flow_rate(pressure_difference : Double, radius : Double, length : Double, dynamic_viscosity : Double) -> Double

    Flow rate from pressure difference (Poiseuille's law, simplified) delta_p: pressure difference (Pa) r: pipe radius (m) l: pipe length (m) mu: dynamic viscosity (Pa·s)

    potential_energy_from_work

    fn potential_energy_from_work(work : Double, pe_initial : Double) -> Double

    Potential energy change from work work: work done (J) pe_initial: initial potential energy (J)

    power

    fn power(work : Double, time : Double) -> Double

    Power (average power) W: work (J) t: time (s)

    power_from_force

    fn power_from_force(force : Double, velocity : Double, angle : Double) -> Double

    Power (force and velocity) F: force (N) v: velocity (m/s) angle: angle between force and velocity (radians)

    power_from_force_parallel

    fn power_from_force_parallel(force : Double, velocity : Double) -> Double

    Power (force and velocity in same direction) F: force (N) v: velocity (m/s)

    power_loss

    fn power_loss(input_power : Double, efficiency : Double) -> Double

    Power loss input_power: input power (W) efficiency: efficiency (0-1)

    precession_angular_velocity

    fn precession_angular_velocity(mass : Double, gravity : Double, radius : Double, moment_of_inertia : Double, spin_angular_velocity : Double) -> Double

    Precession angular velocity (gyroscope precession) m: mass (kg) g: gravitational acceleration (m/s²) r: distance from center of mass to pivot (m) i: moment of inertia (kg·m²) omega: spin angular velocity (rad/s)

    projectile_flight_time

    fn projectile_flight_time(v0 : Double, angle : Double, g : Double) -> Double

    Projectile motion: flight time v0: initial velocity (m/s) angle: launch angle (radians) g: gravitational acceleration (m/s²)

    projectile_horizontal_displacement

    fn projectile_horizontal_displacement(v0 : Double, angle : Double, t : Double) -> Double

    Projectile motion: horizontal displacement v0: initial velocity (m/s) angle: launch angle (radians) t: time (s)

    projectile_max_height

    fn projectile_max_height(v0 : Double, angle : Double, g : Double) -> Double

    Projectile motion: maximum height v0: initial velocity (m/s) angle: launch angle (radians) g: gravitational acceleration (m/s²)

    projectile_range

    fn projectile_range(v0 : Double, angle : Double, g : Double) -> Double

    Projectile motion: range v0: initial velocity (m/s) angle: launch angle (radians) g: gravitational acceleration (m/s²)

    projectile_velocity_angle

    fn projectile_velocity_angle(v0 : Double, angle : Double, t : Double, g : Double) -> Double

    Projectile motion: velocity direction at any time (angle with horizontal) v0: initial velocity (m/s) angle: launch angle (radians) t: time (s) g: gravitational acceleration (m/s²)

    projectile_velocity_magnitude

    fn projectile_velocity_magnitude(v0 : Double, angle : Double, t : Double, g : Double) -> Double

    Projectile motion: velocity magnitude at any time v0: initial velocity (m/s) angle: launch angle (radians) t: time (s) g: gravitational acceleration (m/s²)

    projectile_vertical_displacement

    fn projectile_vertical_displacement(v0 : Double, angle : Double, t : Double, g : Double) -> Double

    Projectile motion: vertical displacement v0: initial velocity (m/s) angle: launch angle (radians) t: time (s) g: gravitational acceleration (m/s²), default uses Earth's gravity

    quadratic_drag

    fn quadratic_drag(drag_coefficient : Double, density : Double, velocity : Double, area : Double) -> Double

    Drag force: quadratic drag (high Reynolds number) cd: drag coefficient rho: fluid density (kg/m³) v: velocity (m/s) a: cross-sectional area (m²)

    quality_factor

    fn quality_factor(natural_frequency : Double, damping_coefficient : Double) -> Double

    Quality factor (Q factor) of oscillator omega0: natural frequency (rad/s) gamma: damping coefficient

    rad_to_deg

    fn rad_to_deg(radians : Double) -> Double

    Convert radians to degrees

    reduced_planck_constant

    let reduced_planck_constant : Double

    Reduced Planck constant ħ = h/(2π) (J·s)

    relative_acceleration_1d

    fn relative_acceleration_1d(a1 : Double, a2 : Double) -> Double

    Relative acceleration (one-dimensional) a1: acceleration of object 1 (m/s²) a2: acceleration of object 2 (m/s²) Returns: acceleration of object 2 relative to object 1

    relative_displacement_1d

    fn relative_displacement_1d(x1 : Double, x2 : Double) -> Double

    Relative displacement (one-dimensional) x1: position of object 1 (m) x2: position of object 2 (m) Returns: displacement of object 2 relative to object 1

    relative_velocity_1d

    fn relative_velocity_1d(v1 : Double, v2 : Double) -> Double

    Relative velocity (one-dimensional) v1: velocity of object 1 (m/s) v2: velocity of object 2 (m/s) Returns: velocity of object 2 relative to object 1

    relativistic_kinetic_energy

    fn relativistic_kinetic_energy(rest_mass : Double, velocity : Double, speed_of_light : Double) -> Double

    Relativistic kinetic energy m0: rest mass (kg) v: velocity (m/s) c: speed of light (m/s)

    relativistic_mass

    fn relativistic_mass(rest_mass : Double, velocity : Double, speed_of_light : Double) -> Double

    Relativistic mass m0: rest mass (kg) v: velocity (m/s) c: speed of light (m/s)

    relativistic_momentum

    fn relativistic_momentum(rest_mass : Double, velocity : Double, speed_of_light : Double) -> Double

    Relativistic momentum m0: rest mass (kg) v: velocity (m/s) c: speed of light (m/s)

    relativistic_total_energy

    fn relativistic_total_energy(rest_mass : Double, velocity : Double, speed_of_light : Double) -> Double

    Relativistic total energy m0: rest mass (kg) v: velocity (m/s) c: speed of light (m/s)

    resonance_frequency

    fn resonance_frequency(omega0 : Double) -> Double

    Resonance frequency (undamped) omega0: natural angular frequency (rad/s)

    resonance_frequency_damped

    fn resonance_frequency_damped(omega0 : Double, gamma : Double) -> Double

    Resonance frequency (damped) omega0: natural angular frequency (rad/s) gamma: damping coefficient

    reynolds_number

    fn reynolds_number(density : Double, velocity : Double, characteristic_length : Double, dynamic_viscosity : Double) -> Double

    Reynolds number (determining flow state) rho: fluid density (kg/m³) v: flow velocity (m/s) d: characteristic length (e.g., pipe diameter) (m) mu: dynamic viscosity (Pa·s)

    rms

    fn rms(values : Array[Double]) -> Double

    Root mean square (RMS) value values: array of values

    rocket_equation

    fn rocket_equation(initial_velocity : Double, exhaust_velocity : Double, initial_mass : Double, final_mass : Double) -> Double

    Variable mass system: rocket equation (Tsiolkovsky formula) v0: initial velocity (m/s) ve: exhaust velocity (m/s) m0: initial mass (kg) mf: final mass (kg)

    rolling_acceleration_downhill

    fn rolling_acceleration_downhill(gravity : Double, angle : Double, beta : Double) -> Double

    Rolling downhill acceleration (no slipping) g: gravitational acceleration (m/s²) angle: inclination angle (radians) beta: moment of inertia coefficient

    rolling_kinetic_energy

    fn rolling_kinetic_energy(mass : Double, velocity : Double, moment_of_inertia : Double, angular_velocity : Double) -> Double

    Total kinetic energy of rolling object (translational + rotational) m: mass (kg) v: linear velocity (m/s) I: moment of inertia (kg·m²) omega: angular velocity (rad/s)

    rolling_kinetic_energy_simplified

    fn rolling_kinetic_energy_simplified(mass : Double, velocity : Double, beta : Double) -> Double

    Total kinetic energy of rolling object (using moment of inertia coefficient) m: mass (kg) v: linear velocity (m/s) beta: moment of inertia coefficient (e.g., 0.4 for sphere, 0.5 for cylinder)

    rolling_velocity

    fn rolling_velocity(angular_velocity : Double, radius : Double) -> Double

    Rolling without slipping condition: relationship between linear velocity and angular velocity omega: angular velocity (rad/s) r: radius (m) Returns: linear velocity

    rotational_kinetic_energy

    fn rotational_kinetic_energy(moment_of_inertia : Double, angular_velocity : Double) -> Double

    Rotational kinetic energy I: moment of inertia (kg·m²) omega: angular velocity (rad/s)

    rotational_kinetic_energy_simple

    fn rotational_kinetic_energy_simple(moment_of_inertia : Double, angular_velocity : Double) -> Double

    Kinetic energy of rigid body rotating about fixed axis i: moment of inertia (kg·m²) omega: angular velocity (rad/s)

    rotational_power

    fn rotational_power(torque : Double, angular_velocity : Double) -> Double

    Power of rigid body rotation tau: torque (N·m) omega: angular velocity (rad/s)

    s_to_h

    fn s_to_h(seconds : Double) -> Double

    Convert seconds to hours

    saturn_gravity

    let saturn_gravity : Double

    Saturn surface gravity (m/s²)

    saturn_mass

    let saturn_mass : Double

    Saturn mass (kg)

    saturn_radius

    let saturn_radius : Double

    Saturn radius (m)

    second_cosmic_velocity

    fn second_cosmic_velocity(gravity : Double, radius : Double) -> Double

    Second cosmic velocity (Earth's surface escape velocity)

    shear_stress

    fn shear_stress(tangential_force : Double, area : Double) -> Double

    Shear stress f: tangential force (N) a: area (m²)

    shm_acceleration

    fn shm_acceleration(amplitude : Double, angular_frequency : Double, time : Double, phase : Double) -> Double

    Simple harmonic motion: acceleration

    shm_angular_frequency

    fn shm_angular_frequency(spring_constant : Double, mass : Double) -> Double

    Simple harmonic motion: angular frequency k: spring constant (N/m) m: mass (kg)

    shm_displacement

    fn shm_displacement(amplitude : Double, angular_frequency : Double, time : Double, phase : Double) -> Double

    Simple harmonic motion: displacement A: amplitude (m) omega: angular frequency (rad/s) t: time (s) phi: initial phase (radians)

    shm_frequency

    fn shm_frequency(angular_frequency : Double) -> Double

    Simple harmonic motion: frequency omega: angular frequency (rad/s)

    shm_period

    fn shm_period(angular_frequency : Double) -> Double

    Simple harmonic motion: period omega: angular frequency (rad/s)

    shm_velocity

    fn shm_velocity(amplitude : Double, angular_frequency : Double, time : Double, phase : Double) -> Double

    Simple harmonic motion: velocity

    sign

    fn sign(x : Double) -> Int

    Sign function

    smoothstep

    fn smoothstep(edge0 : Double, edge1 : Double, x : Double) -> Double

    Smooth step interpolation (smooth transition between 0 and 1)

    sound_intensity

    fn sound_intensity(pressure_amplitude : Double, density : Double, sound_speed : Double) -> Double

    Sound intensity (wave intensity) p: pressure amplitude (Pa) rho: medium density (kg/m³) c: sound speed (m/s)

    sound_intensity_level

    fn sound_intensity_level(intensity : Double, reference_intensity : Double) -> Double

    Sound intensity level (decibels) i: sound intensity (W/m²) i0: reference intensity (W/m²), typically 10^-12 W/m²

    sound_pressure_level

    fn sound_pressure_level(pressure : Double, reference_pressure : Double) -> Double

    Sound pressure level (decibels) p: sound pressure (Pa) p0: reference pressure (Pa), typically 20 μPa

    sound_speed_ideal_gas

    fn sound_speed_ideal_gas(gamma : Double, gas_constant : Double, temperature : Double) -> Double

    Sound speed (ideal gas) gamma: specific heat ratio r: gas constant (J/(kg·K)) t: temperature (K)

    speed_of_light

    let speed_of_light : Double

    Fundamental physical constants Speed of light (m/s)

    standard_temperature

    let standard_temperature : Double

    Standard temperature (K) - 0°C

    standing_wave_fundamental_frequency

    fn standing_wave_fundamental_frequency(wave_speed : Double, length : Double) -> Double

    Standing wave: fundamental frequency c: wave speed (m/s) l: length of string/pipe (m)

    standing_wave_harmonic_frequency

    fn standing_wave_harmonic_frequency(n : Int, wave_speed : Double, length : Double) -> Double

    Standing wave: nth harmonic frequency n: harmonic number c: wave speed (m/s) l: length (m)

    standing_wave_node_spacing

    fn standing_wave_node_spacing(wavelength : Double) -> Double

    Standing wave: node spacing lambda: wavelength (m)

    static_friction

    fn static_friction(mu_s : Double, normal_force : Double) -> Double

    Static friction (maximum static friction) mu_s: coefficient of static friction N: normal force (N)

    steel_youngs_modulus

    let steel_youngs_modulus : Double

    Young's modulus of steel (Pa)

    stokes_drag

    fn stokes_drag(radius : Double, velocity : Double, dynamic_viscosity : Double) -> Double

    Stokes' law: viscous drag (sphere) r: sphere radius (m) v: velocity (m/s) mu: dynamic viscosity (Pa·s)

    sun_mass

    let sun_mass : Double

    Sun mass (kg)

    tangential_acceleration

    fn tangential_acceleration(angular_acceleration : Double, radius : Double) -> Double

    Circular motion: tangential acceleration alpha: angular acceleration (rad/s²) r: radius (m)

    terminal_velocity

    fn terminal_velocity(mass : Double, gravity : Double, drag_coefficient : Double, density : Double, area : Double) -> Double

    Terminal velocity (falling object with quadratic drag) m: mass (kg) g: gravitational acceleration (m/s²) cd: drag coefficient rho: fluid density (kg/m³) a: cross-sectional area (m²)

    thrust_force

    fn thrust_force(mass_flow_rate : Double, exhaust_velocity : Double) -> Double

    Variable mass: thrust force dm_dt: mass flow rate (kg/s) v_exhaust: exhaust velocity (m/s)

    time_from_velocity_change

    fn time_from_velocity_change(v0 : Double, v : Double, a : Double) -> Double

    Uniformly accelerated motion: calculate time (given displacement and velocity) v0: initial velocity (m/s) v: final velocity (m/s) a: acceleration (m/s²)

    time_weighted_average

    fn time_weighted_average(values : Array[Double], times : Array[Double]) -> Double

    Time-weighted average values: array of values times: array of time intervals (s)

    torque

    fn torque(force : Double, lever_arm : Double, angle : Double) -> Double

    Torque f: force (N) r: lever arm (m) angle: angle between force and lever arm (radians)

    torricelli_velocity

    fn torricelli_velocity(height : Double, gravity : Double) -> Double

    Torricelli's theorem: exit velocity h: height of fluid above opening (m) g: gravitational acceleration (m/s²)

    total_acceleration_magnitude

    fn total_acceleration_magnitude(tangential_acc : Double, centripetal_acc : Double) -> Double

    Circular motion: total acceleration magnitude a_t: tangential acceleration (m/s²) a_c: centripetal acceleration (m/s²)

    total_kinetic_energy_1d

    fn total_kinetic_energy_1d(masses : Array[Double], velocities : Array[Double]) -> Double

    Total system kinetic energy (one-dimensional)

    total_momentum_1d

    fn total_momentum_1d(masses : Array[Double], velocities : Array[Double]) -> Double

    Total system momentum (one-dimensional) masses: mass array (kg) velocities: velocity array (m/s)

    uniform_acceleration_displacement

    fn uniform_acceleration_displacement(v0 : Double, a : Double, t : Double) -> Double

    Uniform acceleration: calculate displacement v0: initial velocity (m/s) a: acceleration (m/s²) t: time (s)

    uniform_acceleration_velocity

    fn uniform_acceleration_velocity(v0 : Double, a : Double, t : Double) -> Double

    Uniform acceleration: calculate velocity v0: initial velocity (m/s) a: acceleration (m/s²) t: time (s)

    uniform_acceleration_velocity_from_displacement

    fn uniform_acceleration_velocity_from_displacement(v0 : Double, a : Double, s : Double) -> Double

    Uniform acceleration: calculate velocity (using displacement) v0: initial velocity (m/s) a: acceleration (m/s²) s: displacement (m)

    uniform_motion_displacement

    fn uniform_motion_displacement(velocity : Double, time : Double) -> Double

    Uniform motion: calculate displacement v: velocity (m/s) t: time (s)

    vec3

    fn vec3(x : Double, y : Double, z : Double) -> Vec3

    Create a 3D vector

    vec3_add

    fn vec3_add(a : Vec3, b : Vec3) -> Vec3

    Vector addition

    vec3_angle

    fn vec3_angle(a : Vec3, b : Vec3) -> Double

    Angle between vectors (radians)

    vec3_component

    fn vec3_component(v : Vec3, direction : Vec3) -> Double

    Vector component along direction

    vec3_cross

    fn vec3_cross(a : Vec3, b : Vec3) -> Vec3

    Vector cross product (outer product)

    vec3_distance

    fn vec3_distance(a : Vec3, b : Vec3) -> Double

    Distance between two points (3D)

    vec3_distance_sq

    fn vec3_distance_sq(a : Vec3, b : Vec3) -> Double

    Square of distance between two points (avoids square root)

    vec3_dot

    fn vec3_dot(a : Vec3, b : Vec3) -> Double

    Vector dot product (inner product)

    vec3_lerp

    fn vec3_lerp(a : Vec3, b : Vec3, t : Double) -> Vec3

    Linear interpolation between two vectors

    vec3_magnitude

    fn vec3_magnitude(v : Vec3) -> Double

    Vector magnitude (length)

    vec3_magnitude_sq

    fn vec3_magnitude_sq(v : Vec3) -> Double

    Square of vector magnitude (avoids square root operation)

    vec3_normalize

    fn vec3_normalize(v : Vec3) -> Vec3

    Vector normalization (unit vector)

    vec3_project

    fn vec3_project(a : Vec3, b : Vec3) -> Vec3

    Vector projection: project vector a onto vector b

    vec3_reflect

    fn vec3_reflect(a : Vec3, normal : Vec3) -> Vec3

    Vector reflection: reflect vector a about normal n

    vec3_reject

    fn vec3_reject(a : Vec3, b : Vec3) -> Vec3

    Vector rejection: component of a perpendicular to b

    vec3_scale

    fn vec3_scale(v : Vec3, s : Double) -> Vec3

    Vector scalar multiplication

    vec3_sub

    fn vec3_sub(a : Vec3, b : Vec3) -> Vec3

    Vector subtraction

    vec3_unit_x

    fn vec3_unit_x() -> Vec3

    Unit vector (x direction)

    vec3_unit_y

    fn vec3_unit_y() -> Vec3

    Unit vector (y direction)

    vec3_unit_z

    fn vec3_unit_z() -> Vec3

    Unit vector (z direction)

    vec3_zero

    fn vec3_zero() -> Vec3

    Zero vector

    velocity_from_energy_conservation

    fn velocity_from_energy_conservation(ke_initial : Double, pe_initial : Double, pe_final : Double, mass : Double) -> Double

    Mechanical energy conservation: calculate final velocity ke_initial: initial kinetic energy (J) pe_initial: initial potential energy (J) pe_final: final potential energy (J) m: mass (kg) Returns: final velocity

    velocity_from_impulse

    fn velocity_from_impulse(mass : Double, initial_velocity : Double, impulse : Double) -> Double

    Impulse-momentum theorem: calculate final velocity m: mass (kg) v0: initial velocity (m/s) impulse: impulse (N·s)

    velocity_from_path

    fn velocity_from_path(ds : Double, dt : Double) -> Double

    Curvilinear motion: velocity from path length ds: path length element (m) dt: time element (s)

    velocity_from_spring_energy

    fn velocity_from_spring_energy(spring_constant : Double, displacement : Double, mass : Double) -> Double

    Elastic potential energy to kinetic energy: calculate velocity k: spring constant (N/m) x: compression/extension (m) m: mass (kg) Returns: velocity

    velocity_transformation

    fn velocity_transformation(v_object : Double, v_frame : Double) -> Double

    Relative motion: velocity transformation v_object: object velocity in frame A (m/s) v_frame: frame A velocity relative to frame B (m/s) Returns: object velocity in frame B

    venturi_velocity_ratio

    fn venturi_velocity_ratio(a1 : Double, a2 : Double) -> Double

    Venturi effect: velocity ratio a1: cross-section 1 area (m²) a2: cross-section 2 area (m²)

    venus_gravity

    let venus_gravity : Double

    Venus surface gravity (m/s²)

    venus_mass

    let venus_mass : Double

    Venus mass (kg)

    venus_radius

    let venus_radius : Double

    Venus radius (m)

    viscous_force

    fn viscous_force(dynamic_viscosity : Double, area : Double, velocity_gradient : Double) -> Double

    Viscous force (flow between parallel plates) mu: dynamic viscosity (Pa·s) a: area (m²) dv_dy: velocity gradient (1/s)

    volumetric_flow_rate

    fn volumetric_flow_rate(velocity : Double, area : Double) -> Double

    Flow rate: from velocity and area v: flow velocity (m/s) a: cross-sectional area (m²)

    w_to_hp

    fn w_to_hp(watts : Double) -> Double

    Convert watts to horsepower

    water_density

    let water_density : Double

    Density of water (kg/m³) at 4°C

    water_surface_tension

    let water_surface_tension : Double

    Surface tension of water (N/m) at 20°C

    water_viscosity

    let water_viscosity : Double

    Dynamic viscosity of water (Pa·s) at 20°C

    wave_displacement

    fn wave_displacement(amplitude : Double, wave_number : Double, position : Double, angular_frequency : Double, time : Double, phase : Double) -> Double

    Harmonic wave: displacement a: amplitude (m) k: wave number (rad/m) x: position (m) omega: angular frequency (rad/s) t: time (s) phi: initial phase (radians)

    wave_intensity_from_amplitude

    fn wave_intensity_from_amplitude(amplitude : Double, angular_frequency : Double, density : Double, wave_speed : Double) -> Double

    Wave intensity from amplitude a: amplitude (m) omega: angular frequency (rad/s) rho: medium density (kg/m³) c: wave speed (m/s)

    wave_velocity

    fn wave_velocity(frequency : Double, wavelength : Double) -> Double

    Wave velocity (using frequency and wavelength) f: frequency (Hz) lambda: wavelength (m)

    wave_velocity_from_angular

    fn wave_velocity_from_angular(angular_frequency : Double, wave_number : Double) -> Double

    Wave velocity (using angular frequency and wave number) omega: angular frequency (rad/s) k: wave number (rad/m)

    work

    fn work(force : Double, displacement : Double, angle : Double) -> Double

    Work (constant force, linear motion) F: force (N) s: displacement (m) angle: angle between force and displacement (radians)

    work_from_kinetic_energy

    fn work_from_kinetic_energy(ke_final : Double, ke_initial : Double) -> Double

    Work-energy theorem: calculate work from kinetic energy change ke_final: final kinetic energy (J) ke_initial: initial kinetic energy (J)

    work_from_power

    fn work_from_power(power : Double, time : Double) -> Double

    Power-time relationship: calculate work p: power (W) t: time (s)

    work_parallel

    fn work_parallel(force : Double, displacement : Double) -> Double

    Work (force and displacement in same direction) F: force (N) s: displacement (m)

    youngs_modulus

    fn youngs_modulus(stress : Double, strain : Double) -> Double

    Young's modulus (elastic modulus) stress: stress (Pa) strain: strain