The ExprUA Standard Library provides a comprehensive collection of mathematical and scientific functions organized into modules. These functions are designed to handle common calculations in geometry, kinematics, mechanics, and thermodynamics with full unit support and dimensional consistency.
The Standard Library is organized into the following modules:
All functions in the Standard Library support ExprUA's unit system, ensuring dimensional consistency and automatic unit conversion. Functions are designed to be intuitive and follow standard mathematical notation.
Common formulas for calculating areas, volumes, and perimeters
area_annulus(outer_radius: m, inner_radius: m) -> m^2perimeter_annulus(outer_radius: m, inner_radius: m) -> marea_circle(radius: m) -> m^2circumference_circle(radius: m) -> marea_circle_sector(radius: m, angle_radians: dimensionless) -> m^2arc_length_circle_sector(radius: m, angle_radians: dimensionless) -> marea_circle_segment(radius: m, angle_radians: dimensionless) -> m^2volume_cone(radius: m, height: m) -> m^3surface_area_cone(radius: m, height: m) -> m^2 - Total surface area = πr² + πr√(r² + h²)lateral_surface_area_cone(radius: m, height: m) -> m^2 - Lateral surface area = πr√(r² + h²)volume_cylinder(radius: m, height: m) -> m^3surface_area_cylinder(radius: m, height: m) -> m^2 - Total surface area = 2πr² + 2πrh = 2πr(r + h)lateral_surface_area_cylinder(radius: m, height: m) -> m^2 - Lateral surface area = 2πrharea_ellipse(semi_major_axis: m, semi_minor_axis: m) -> m^2perimeter_ellipse(semi_major_axis: m, semi_minor_axis: m) -> m - Approximation: Ramanujan's approximationvolume_ellipsoid(semi_axis_a: m, semi_axis_b: m, semi_axis_c: m) -> m^3area_kite(diagonal1: m, diagonal2: m) -> m^2area_parallelogram(base: m, height: m) -> m^2volume_pyramid_square_base(base_side: m, height: m) -> m^3volume_pyramid_rectangular_base(length: m, width: m, height: m) -> m^3surface_area_pyramid_square_base(base_side: m, height: m) -> m^2 - Total surface area = base area + 4 triangular facesarea_rectangle(length: m, width: m) -> m^2perimeter_rectangle(length: m, width: m) -> marea_square(side: m) -> m^2 - Square functions (special case of rectangle)perimeter_square(side: m) -> mvolume_rectangular_prism(length: m, width: m, height: m) -> m^3surface_area_rectangular_prism(length: m, width: m, height: m) -> m^2volume_cube(side: m) -> m^3 - Cube functions (special case of rectangular prism)surface_area_cube(side: m) -> m^2area_regular_hexagon(side: m) -> m^2 - Area = (3√3/2) * s²perimeter_regular_hexagon(side: m) -> marea_regular_pentagon(side: m) -> m^2 - Area = (1/4) * √(5(5+2√5)) * s²perimeter_regular_pentagon(side: m) -> marea_regular_polygon(side_length: m, num_sides: dimensionless) -> m^2perimeter_regular_polygon(side_length: m, num_sides: dimensionless) -> mvolume_regular_tetrahedron(edge_length: m) -> m^3 - Volume = (√2/12) * a³surface_area_regular_tetrahedron(edge_length: m) -> m^2 - Surface area = √3 * a²volume_regular_octahedron(edge_length: m) -> m^3 - Volume = (√2/3) * a³surface_area_regular_octahedron(edge_length: m) -> m^2 - Surface area = 2√3 * a²volume_regular_icosahedron(edge_length: m) -> m^3 - Volume = (5/12) * (3+√5) * a³surface_area_regular_icosahedron(edge_length: m) -> m^2 - Surface area = 5√3 * a²volume_regular_dodecahedron(edge_length: m) -> m^3 - Volume = (1/4) * (15+7√5) * a³surface_area_regular_dodecahedron(edge_length: m) -> m^2 - Surface area = 3√(25+10√5) * a²distance_2d(x1: m, y1: m, x2: m, y2: m) -> m - Distance between two points in 2D: √[(x₂-x₁)² + (y₂-y₁)²]distance_3d(x1: m, y1: m, z1: m, x2: m, y2: m, z2: m) -> m - Distance between two points in 3D: √[(x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²]midpoint_x_2d(x1: m, x2: m) -> m - X-coordinate of midpoint between two points in 2Dmidpoint_y_2d(y1: m, y2: m) -> m - Y-coordinate of midpoint between two points in 2Dmidpoint_x_3d(x1: m, x2: m) -> m - X-coordinate of midpoint between two points in 3Dmidpoint_y_3d(y1: m, y2: m) -> m - Y-coordinate of midpoint between two points in 3Dmidpoint_z_3d(z1: m, z2: m) -> m - Z-coordinate of midpoint between two points in 3Darea_rhombus(diagonal1: m, diagonal2: m) -> m^2area_rhombus_side_height(side: m, height: m) -> m^2perimeter_rhombus(side: m) -> mvolume_sphere(radius: m) -> m^3surface_area_sphere(radius: m) -> m^2volume_torus(major_radius: m, minor_radius: m) -> m^3surface_area_torus(major_radius: m, minor_radius: m) -> m^2area_trapezoid(base1: m, base2: m, height: m) -> m^2area_triangle(base: m, height: m) -> m^2area_triangle_heron(a: m, b: m, c: m) -> m^2Motion equations for velocity, acceleration, displacement, and projectile motion
acceleration_velocity_time(initial_velocity: m/s, final_velocity: m/s, time: s) -> m/s^2 - Average acceleration: a = Δv/tacceleration_force_mass(force: N, mass: kg) -> m/s^2 - Acceleration from force: a = F/mangular_velocity_linear(linear_velocity: m/s, radius: m) -> Hz - Angular velocity from linear velocity: ω = v/r (returns Hz = 1/s)angular_velocity_period(period: s) -> Hz - Angular velocity from period: ω = 2π/T (returns Hz = 1/s)angular_velocity_frequency(frequency: Hz) -> Hz - Angular velocity from frequency: ω = 2πf (returns Hz = 1/s)linear_velocity_angular(angular_velocity: Hz, radius: m) -> m/s - Linear velocity from angular velocity: v = ωr (angular_velocity in Hz = 1/s)centripetal_acceleration(velocity: m/s, radius: m) -> m/s^2 - Centripetal acceleration: a = v²/rcentripetal_acceleration_angular(angular_velocity: Hz, radius: m) -> m/s^2 - Centripetal acceleration using angular velocity: a = ω²r (angular_velocity in Hz = 1/s)period_frequency(frequency: Hz) -> s - Period from frequency: T = 1/ffrequency_period(period: s) -> Hz - Frequency from period: f = 1/Tdisplacement_velocity_time(initial_velocity: m/s, final_velocity: m/s, time: s) -> m - Displacement from average velocity: Δx = (v₀ + v)t/2displacement_initial_acceleration_time(initial_velocity: m/s, acceleration: m/s^2, time: s) -> m - Displacement: Δx = v₀t + (1/2)at²displacement_velocity_acceleration(initial_velocity: m/s, final_velocity: m/s, acceleration: m/s^2) -> m - Displacement: Δx = (v² - v₀²)/(2a)free_fall_velocity(initial_velocity: m/s, time: s) -> m/s - Velocity in free fall: v = v₀ + gt (downward positive, uses standard gravity constant g)free_fall_displacement(initial_velocity: m/s, time: s) -> m - Displacement in free fall: Δy = v₀t + (1/2)gt²free_fall_time_max_height(initial_velocity: m/s) -> s - Time to reach maximum height: t = v₀/gfree_fall_max_height(initial_velocity: m/s) -> m - Maximum height: h = v₀²/(2g)projectile_range(initial_velocity: m/s, angle_radians: dimensionless) -> m - Horizontal range: R = (v₀² sin(2θ))/gprojectile_max_height(initial_velocity: m/s, angle_radians: dimensionless) -> m - Maximum height: h = (v₀² sin²(θ))/(2g)projectile_time_of_flight(initial_velocity: m/s, angle_radians: dimensionless) -> s - Time of flight: t = (2v₀ sin(θ))/gprojectile_velocity_x(initial_velocity: m/s, angle_radians: dimensionless) -> m/s - Horizontal velocity component: vx = v₀ cos(θ)projectile_velocity_y(initial_velocity: m/s, angle_radians: dimensionless, time: s) -> m/s - Vertical velocity component: vy = v₀ sin(θ) - gtprojectile_position_x(initial_velocity: m/s, angle_radians: dimensionless, time: s) -> m - Horizontal position: x = v₀ cos(θ) tprojectile_position_y(initial_velocity: m/s, angle_radians: dimensionless, time: s) -> m - Vertical position: y = v₀ sin(θ) t - (1/2)gt²relative_velocity(velocity1: m/s, velocity2: m/s) -> m/s - Relative velocity: v_rel = v1 - v2velocity_addition_1d(velocity1: m/s, velocity2: m/s) -> m/s - Velocity addition in 1D: v_total = v1 + v2velocity_displacement_time(displacement: m, time: s) -> m/s - Average velocity: v = Δx/tvelocity_initial_acceleration_time(initial_velocity: m/s, acceleration: m/s^2, time: s) -> m/s - Final velocity: v = v₀ + atvelocity_initial_acceleration_displacement(initial_velocity: m/s, acceleration: m/s^2, displacement: m) -> m/s - Final velocity from displacement: v² = v₀² + 2aΔxForce, work, energy, power, momentum, and torque calculations
momentum_conservation_1d(mass1: kg, velocity1_initial: m/s, mass2: kg, velocity2_initial: m/s, velocity1_final: m/s) -> m/s - Conservation of momentum in 1D: m1v1i + m2v2i = m1v1f + m2v2fkinetic_energy_elastic_collision(mass1: kg, velocity1_initial: m/s, mass2: kg, velocity2_initial: m/s) -> J - Total kinetic energy before collision (for elastic collision calculations)efficiency_useful_output(useful_output: J, total_input: J) -> dimensionless - Efficiency: η = (useful output / total input) * 100%efficiency_power(useful_power: W, total_power: W) -> dimensionless - Efficiency from power: η = (useful power / total power)energy_kinetic(mass: kg, velocity: m/s) -> J - Kinetic energy: KE = (1/2)mv²energy_potential_gravitational(mass: kg, height: m) -> J - Gravitational potential energy: PE = mghenergy_potential_spring(spring_constant: N/m, displacement: m) -> J - Spring potential energy: PE = (1/2)kx²energy_mechanical(kinetic_energy: J, potential_energy: J) -> J - Total mechanical energy: E = KE + PEforce(mass: kg, acceleration: m/s^2) -> N - Newton's second law: F = maforce_weight(mass: kg) -> N - Weight force: F = mgforce_friction_kinetic(normal_force: N, coefficient_kinetic: dimensionless) -> N - Kinetic friction: F = μk * Nforce_friction_static_max(normal_force: N, coefficient_static: dimensionless) -> N - Maximum static friction: F = μs * Nforce_centripetal(mass: kg, velocity: m/s, radius: m) -> N - Centripetal force: F = mv²/rforce_centripetal_angular(mass: kg, angular_velocity: Hz, radius: m) -> N - Centripetal force using angular velocity: F = mω²r (angular_velocity in Hz = 1/s)force_gravitational(mass1: kg, mass2: kg, distance: m) -> N - Newton's law of universal gravitation: F = G * m1 * m2 / r²momentum(mass: kg, velocity: m/s) -> kg*m/s - Linear momentum: p = mvmomentum_change(initial_momentum: kg*m/s, final_momentum: kg*m/s) -> kg*m/s - Change in momentum: Δp = pf - piimpulse(force: N, time: s) -> kg*m/s - Impulse: J = Ftimpulse_momentum_theorem(initial_momentum: kg*m/s, final_momentum: kg*m/s) -> kg*m/s - Impulse-momentum theorem: J = Δppower_work_time(work: J, time: s) -> W - Power: P = W/tpower_force_velocity(force: N, velocity: m/s) -> W - Power: P = Fv (force parallel to velocity)power_force_velocity_angle(force: N, velocity: m/s, angle_radians: dimensionless) -> W - Power with force at angle: P = Fv cos(θ)pressure_force_area(force: N, area: m^2) -> Pa - Pressure: P = F/Apressure_depth(density: kg/m^3, depth: m) -> Pa - Hydrostatic pressure: P = ρghspring_force(spring_constant: N/m, displacement: m) -> N - Hooke's law: F = -kx (returns magnitude, sign indicates direction)spring_constant(force: N, displacement: m) -> N/m - Spring constant from force and displacement: k = F/xtorque_force_radius(force: N, radius: m) -> N*m - Torque: τ = Fr (force perpendicular to radius)torque_force_radius_angle(force: N, radius: m, angle_radians: dimensionless) -> N*m - Torque with force at angle: τ = Fr sin(θ)torque_angular_acceleration(moment_of_inertia: kg*m^2, angular_acceleration: Hz/s) -> N*m - Rotational form of Newton's second law: τ = Iα (angular_acceleration in Hz/s = 1/s^2)work_force_distance(force: N, distance: m) -> J - Work done by constant force: W = Fd (force parallel to displacement)work_force_distance_angle(force: N, distance: m, angle_radians: dimensionless) -> J - Work done by force at angle: W = Fd cos(θ)heat_specific_heat(mass: kg, specific_heat: J/(kg*K), temperature_change: K) -> J - Heat transfer: Q = mcΔTheat_heat_capacity(heat_capacity: J/K, temperature_change: K) -> Jheat_latent(mass: kg, latent_heat: J/kg) -> Jheat_fusion(mass: kg, latent_heat_fusion: J/kg) -> J - Heat of fusion: Q = mLfheat_vaporization(mass: kg, latent_heat_vaporization: J/kg) -> J - Heat of vaporization: Q = mLvspecific_heat_from_heat(mass: kg, heat: J, temperature_change: K) -> J/(kg*K) - Specific heat: c = Q/(mΔT)heat_capacity_from_heat(heat: J, temperature_change: K) -> J/K - Heat capacity: C = Q/ΔTheat_capacity_from_specific_heat(mass: kg, specific_heat: J/(kg*K)) -> J/K - Heat capacity: C = mcspecific_heat_from_heat_capacity(mass: kg, heat_capacity: J/K) -> J/(kg*K) - Specific heat: c = C/mthermal_expansion_linear(length: m, coefficient_linear: 1/K, temperature_change: K) -> m - Linear thermal expansion: ΔL = αL₀ΔTthermal_expansion_linear_final(length_initial: m, coefficient_linear: 1/K, temperature_change: K) -> m - Final length after linear expansion: L = L₀(1 + αΔT)thermal_expansion_area(area: m^2, coefficient_linear: 1/K, temperature_change: K) -> m^2 - Area thermal expansion: ΔA ≈ 2αA₀ΔT (for small expansions)thermal_expansion_volume(volume: m^3, coefficient_linear: 1/K, temperature_change: K) -> m^3 - Volume thermal expansion: ΔV ≈ 3αV₀ΔT (for small expansions)thermal_expansion_volume_final(volume_initial: m^3, coefficient_volume: 1/K, temperature_change: K) -> m^3heat_conduction(thermal_conductivity: W/(m*K), area: m^2, temperature_difference: K, thickness: m) -> W - Conduction heat transfer rate: Q/t = kAΔT/dheat_conduction_energy(thermal_conductivity: W/(m*K), area: m^2, temperature_difference: K, thickness: m, time: s) -> J - Conduction heat transfer: Q = (kAΔT/d) * theat_convection(convection_coefficient: W/(m^2*K), area: m^2, temperature_difference: K) -> W - Convection heat transfer rate: Q/t = hAΔTheat_convection_energy(convection_coefficient: W/(m^2*K), area: m^2, temperature_difference: K, time: s) -> J - Convection heat transfer: Q = hAΔT * theat_radiation(emissivity: dimensionless, area: m^2, temperature: K) -> W - Radiation heat transfer rate: Q/t = εσAT⁴heat_radiation_energy(emissivity: dimensionless, area: m^2, temperature: K, time: s) -> J - Radiation heat transfer: Q = εσAT⁴ * theat_radiation_net(emissivity: dimensionless, area: m^2, temperature_hot: K, temperature_cold: K) -> W - Net radiation heat transfer: Q/t = εσA(Tₕ⁴ - Tᶜ⁴)work_isobaric(pressure: Pa, volume_change: m^3) -> J - Work in isobaric (constant pressure) process: W = PΔVwork_isothermal(pressure_initial: Pa, volume_initial: m^3, volume_final: m^3) -> J - Work in isothermal (constant temperature) process: W = P₁V₁ ln(V₂/V₁)work_adiabatic(pressure_initial: Pa, volume_initial: m^3, volume_final: m^3, gamma: dimensionless) -> Jpressure_adiabatic(pressure_initial: Pa, volume_initial: m^3, volume_final: m^3, gamma: dimensionless) -> Pa - Pressure in adiabatic process: P₂ = P₁(V₁/V₂)^γtemperature_adiabatic(temperature_initial: K, volume_initial: m^3, volume_final: m^3, gamma: dimensionless) -> K - Temperature in adiabatic process: T₂ = T₁(V₁/V₂)^(γ-1)temperature_adiabatic_pressure(temperature_initial: K, pressure_initial: Pa, pressure_final: Pa, gamma: dimensionless) -> K - Temperature in adiabatic process: T₂ = T₁(P₂/P₁)^((γ-1)/γ)efficiency_carnot(temperature_hot: K, temperature_cold: K) -> dimensionless - Carnot efficiency: η = 1 - Tᶜ/Tₕefficiency_thermal(work_output: J, heat_input: J) -> dimensionless - Thermal efficiency: η = W/Qₕefficiency_thermal_power(power_output: W, heat_input_rate: W) -> dimensionless - Thermal efficiency from power: η = P_out/P_incoefficient_performance_cooling(heat_removed: J, work_input: J) -> dimensionless - Coefficient of performance (cooling): COP = Qᶜ/Wcoefficient_performance_heating(heat_delivered: J, work_input: J) -> dimensionless - Coefficient of performance (heating): COP = Qₕ/Wentropy_change_heat(temperature: K, heat: J) -> J/K - Entropy change: ΔS = Q/T (for reversible process)entropy_change_isothermal(heat: J, temperature: K) -> J/K - Entropy change in isothermal process: ΔS = Q/Tentropy_change_constant_volume(mass: kg, specific_heat_volume: J/(kg*K), temperature_initial: K, temperature_final: K) -> J/K - Entropy change at constant volume: ΔS = mCv ln(T₂/T₁)entropy_change_constant_pressure(mass: kg, specific_heat_pressure: J/(kg*K), temperature_initial: K, temperature_final: K) -> J/K - Entropy change at constant pressure: ΔS = mCp ln(T₂/T₁)enthalpy_change_constant_pressure(heat: J) -> J - Enthalpy change at constant pressure: ΔH = Qenthalpy_change_ideal_gas(mass: kg, specific_heat_pressure: J/(kg*K), temperature_change: K) -> J - Enthalpy change for ideal gas: ΔH = mCpΔTrms_velocity_ideal_gas(temperature: K, molar_mass: kg/mol) -> m/s - Root mean square velocity: v_rms = √(3RT/M)average_kinetic_energy_ideal_gas(temperature: K) -> J - Average kinetic energy per molecule: KE_avg = (3/2)kTinternal_energy_ideal_gas_monatomic(moles: mol, temperature: K) -> J - Internal energy for monatomic ideal gas: U = (3/2)nRTinternal_energy_ideal_gas_diatomic(moles: mol, temperature: K) -> J - Internal energy for diatomic ideal gas: U = (5/2)nRTinternal_energy_ideal_gas_polyatomic(moles: mol, temperature: K, degrees_freedom: dimensionless) -> J