diff --git a/symplyphysics/laws/dynamics/damped_oscillations/energy_of_underdamped_oscillator.py b/symplyphysics/laws/dynamics/damped_oscillations/energy_of_underdamped_oscillator.py index c50ed4a7f..9ff5b86f8 100644 --- a/symplyphysics/laws/dynamics/damped_oscillations/energy_of_underdamped_oscillator.py +++ b/symplyphysics/laws/dynamics/damped_oscillations/energy_of_underdamped_oscillator.py @@ -4,7 +4,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, angle_type, @@ -27,6 +26,8 @@ # Conditions ## - Damping ratio (zeta) is small, i.e. zeta << 1 +# Links: similar equation 15-44 on p. 431 of "Fundamentals of Physics" by David Halladay et al., 10th Ed. + oscillator_energy = Symbol("oscillator_energy", units.energy) oscillator_mass = symbols.mass maximum_amplitude = Symbol("maximum_amplitude", units.length) @@ -41,10 +42,6 @@ # TODO Derive from [underdamped oscillations](../../kinematics/damped_oscillations/underdamping.py) -def print_law() -> str: - return print_expression(law) - - @validate_input( oscillator_mass_=oscillator_mass, maximum_amplitude_=maximum_amplitude, diff --git a/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_bandwidth.py b/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_bandwidth.py index f3b2437fd..388c3edc3 100644 --- a/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_bandwidth.py +++ b/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_bandwidth.py @@ -4,7 +4,6 @@ dimensionless, Quantity, Symbol, - print_expression, validate_input, validate_output, ) @@ -26,6 +25,8 @@ # Note ## - An equivalent definition uses angular frequencies instead of linear ones. +# Links: Wikipedia + quality_factor = Symbol("quality_factor", dimensionless) resonant_frequency = Symbol("resonant_frequency", units.frequency) resonance_width = Symbol("resonance_width", units.frequency) @@ -33,10 +34,6 @@ law = Eq(quality_factor, resonant_frequency / resonance_width) -def print_law() -> str: - return print_expression(law) - - @validate_input( resonant_frequency_=resonant_frequency, resonance_width_=resonance_width, diff --git a/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_damping_ratio.py b/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_damping_ratio.py index 03bbd14e6..8410f4b71 100644 --- a/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_damping_ratio.py +++ b/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_damping_ratio.py @@ -3,7 +3,6 @@ convert_to_float, dimensionless, Symbol, - print_expression, validate_input, validate_output, ) @@ -18,16 +17,14 @@ ## Q - Q factor ## zeta - [damping ratio](../../../definitions/damped_harmonic_oscillator_equation.py) +# Links: derivable from here + quality_factor = Symbol("quality_factor", dimensionless) damping_ratio = Symbol("damping_ratio", dimensionless) law = Eq(quality_factor, 1 / (2 * damping_ratio)) -def print_law() -> str: - return print_expression(law) - - @validate_input(damping_ratio_=damping_ratio) @validate_output(quality_factor) def calculate_quality_factor(damping_ratio_: float) -> float: diff --git a/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_energy_loss.py b/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_energy_loss.py index 731a635bd..d463d04e4 100644 --- a/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_energy_loss.py +++ b/symplyphysics/laws/dynamics/damped_oscillations/quality_factor_via_energy_loss.py @@ -5,7 +5,6 @@ dimensionless, Quantity, Symbol, - print_expression, validate_input, validate_output, ) @@ -22,6 +21,8 @@ ## E_stored - energy stored in oscillator ## P_loss - power loss of oscillator, i.e. rate of energy dissipation from it +# Links: Wikipedia + quality_factor = Symbol("quality_factor", dimensionless) resonant_angular_frequency = Symbol("resonant_angular_frequency", angle_type / units.time) energy_stored = Symbol("energy_stored", units.energy) @@ -30,10 +31,6 @@ law = Eq(quality_factor, resonant_angular_frequency * (energy_stored / power_loss)) -def print_law() -> str: - return print_expression(law) - - @validate_input( resonant_angular_frequency_=resonant_angular_frequency, energy_stored_=energy_stored, diff --git a/symplyphysics/laws/dynamics/deformation/bulk_modulus_via_young_modulus_and_poisson_ratio.py b/symplyphysics/laws/dynamics/deformation/bulk_modulus_via_young_modulus_and_poisson_ratio.py index 19e112033..4e6220e27 100644 --- a/symplyphysics/laws/dynamics/deformation/bulk_modulus_via_young_modulus_and_poisson_ratio.py +++ b/symplyphysics/laws/dynamics/deformation/bulk_modulus_via_young_modulus_and_poisson_ratio.py @@ -13,6 +13,10 @@ #. The :ref:`Poisson ratio ` :math:`\nu < \frac{1}{2}`, since :doc:`elastic energy density ` cannot be negative. + +**Links:** + +#. `Wikipedia, derivable from second part of the equation `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_bulk_compression_via_pressure.py b/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_bulk_compression_via_pressure.py index 5199cc11e..563a59c3c 100644 --- a/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_bulk_compression_via_pressure.py +++ b/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_bulk_compression_via_pressure.py @@ -5,6 +5,14 @@ Volumetric density of the elastic energy of a body that is under bulk compression is proportional to the square of the pressure in the body and inversely proportional to the bulk modulus of the body's material. + +**Conditions:** + +#. The body undergoes bulk compression. + +**Links:** + +#. Formula 77.5 on p. 393 of "General Course of Physics" (Obschiy kurs fiziki), vol. 1 by Sivukhin D.V. (1979). """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_compression_via_strain.py b/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_compression_via_strain.py index 2a3ee53dd..024028516 100644 --- a/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_compression_via_strain.py +++ b/symplyphysics/laws/dynamics/deformation/elastic_energy_density_of_compression_via_strain.py @@ -6,6 +6,14 @@ its Young's modulus and the square of its strain. The :doc:`Hooke's law ` can be used to obtain analogous forms of this law. + +**Conditions:** + +#. The material is linearly elastic. + +**Links:** + +#. `Wikipedia, equation on the fourth line `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/engineering_normal_strain_is_total_deformation_over_initial_dimension.py b/symplyphysics/laws/dynamics/deformation/engineering_normal_strain_is_total_deformation_over_initial_dimension.py index b4b50fd84..a3282bec7 100644 --- a/symplyphysics/laws/dynamics/deformation/engineering_normal_strain_is_total_deformation_over_initial_dimension.py +++ b/symplyphysics/laws/dynamics/deformation/engineering_normal_strain_is_total_deformation_over_initial_dimension.py @@ -4,6 +4,10 @@ *Engineering normal strain*, also called *Cauchy strain*, is expressed as the ratio of total deformation to the initial dimension of a material body on which forces are applied. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/poisson_ratio_is_transverse_to_axial_strain_ratio.py b/symplyphysics/laws/dynamics/deformation/poisson_ratio_is_transverse_to_axial_strain_ratio.py index 55c2d2f65..c8807d2c2 100644 --- a/symplyphysics/laws/dynamics/deformation/poisson_ratio_is_transverse_to_axial_strain_ratio.py +++ b/symplyphysics/laws/dynamics/deformation/poisson_ratio_is_transverse_to_axial_strain_ratio.py @@ -11,6 +11,14 @@ negative strain indicates contraction. #. The Poisson ratio and the Young modulus are all that is needed to completely describe elastic properties of an isotropic material. + +**Conditions:** + +#. The strains must be small. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/pressure_is_maclaurin_series_of_strain.py b/symplyphysics/laws/dynamics/deformation/pressure_is_maclaurin_series_of_strain.py index 85ff18f25..4cffe497a 100644 --- a/symplyphysics/laws/dynamics/deformation/pressure_is_maclaurin_series_of_strain.py +++ b/symplyphysics/laws/dynamics/deformation/pressure_is_maclaurin_series_of_strain.py @@ -19,6 +19,10 @@ #. The deformations are small, i.e. :math:`e \ll 1`. #. This law features the expansion up to the third power of strain, higher terms can be added if needed. + +**Links:** + +#. Section 3 on p. 385 of "General Course of Physics" (Obschiy kurs fiziki), vol. 1 by Sivukhin D.V. (1979). """ from sympy import Eq, O diff --git a/symplyphysics/laws/dynamics/deformation/rotational_stiffness_is_torque_over_angle.py b/symplyphysics/laws/dynamics/deformation/rotational_stiffness_is_torque_over_angle.py index 0bc31318a..d84d41cad 100644 --- a/symplyphysics/laws/dynamics/deformation/rotational_stiffness_is_torque_over_angle.py +++ b/symplyphysics/laws/dynamics/deformation/rotational_stiffness_is_torque_over_angle.py @@ -3,6 +3,10 @@ ================================================= *Rotational stiffness* is the extent to which an object resists rotational deformation. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/shear_stress_is_shear_modulus_times_strain.py b/symplyphysics/laws/dynamics/deformation/shear_stress_is_shear_modulus_times_strain.py index d92b82328..88d44dce4 100644 --- a/symplyphysics/laws/dynamics/deformation/shear_stress_is_shear_modulus_times_strain.py +++ b/symplyphysics/laws/dynamics/deformation/shear_stress_is_shear_modulus_times_strain.py @@ -4,7 +4,6 @@ angle_type, Quantity, Symbol, - print_expression, validate_input, validate_output, ) @@ -26,6 +25,8 @@ # Note ## For a visual representation of shear stress visit [this](https://vuzdoc.org/htm/img/3/6176/223.png) +# Links: Wikipedia + shear_stress = Symbol("shear_stress", units.pressure) shear_modulus = Symbol("shear_modulus", units.pressure) shear_strain = Symbol("shear_strain", angle_type) @@ -33,10 +34,6 @@ law = Eq(shear_stress, shear_modulus * shear_strain) -def print_law() -> str: - return print_expression(law) - - @validate_input( shear_modulus_=shear_modulus, shear_strain_=shear_strain, diff --git a/symplyphysics/laws/dynamics/deformation/superposition_of_small_deformations.py b/symplyphysics/laws/dynamics/deformation/superposition_of_small_deformations.py index 4455ccf7f..e1d7cc04c 100644 --- a/symplyphysics/laws/dynamics/deformation/superposition_of_small_deformations.py +++ b/symplyphysics/laws/dynamics/deformation/superposition_of_small_deformations.py @@ -9,6 +9,10 @@ **Conditions:** #. The deformations are small. + +**Links:** + +#. `Wikipedia, general information can be found here `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/deformation/tensile_stress_is_youngs_modulus_times_strain.py b/symplyphysics/laws/dynamics/deformation/tensile_stress_is_youngs_modulus_times_strain.py index 74524fdbd..8a19f29bf 100644 --- a/symplyphysics/laws/dynamics/deformation/tensile_stress_is_youngs_modulus_times_strain.py +++ b/symplyphysics/laws/dynamics/deformation/tensile_stress_is_youngs_modulus_times_strain.py @@ -4,6 +4,10 @@ When an object is under tension or compression, the stress is related to the strain via the Young's modulus. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq diff --git a/symplyphysics/laws/dynamics/fields/conservative_force_is_gradient_of_potential_energy.py b/symplyphysics/laws/dynamics/fields/conservative_force_is_gradient_of_potential_energy.py index 61eaf200b..86a22373a 100644 --- a/symplyphysics/laws/dynamics/fields/conservative_force_is_gradient_of_potential_energy.py +++ b/symplyphysics/laws/dynamics/fields/conservative_force_is_gradient_of_potential_energy.py @@ -18,6 +18,8 @@ # Conditions ## - Force is conservative (see definition above) +# Links: Wikipedia + def law(potential_: ScalarField) -> Vector: gradient_vector = gradient_operator(potential_) diff --git a/symplyphysics/laws/dynamics/springs/compliance_of_two_serial_springs.py b/symplyphysics/laws/dynamics/springs/compliance_of_two_serial_springs.py index 45322988d..378d8647a 100644 --- a/symplyphysics/laws/dynamics/springs/compliance_of_two_serial_springs.py +++ b/symplyphysics/laws/dynamics/springs/compliance_of_two_serial_springs.py @@ -3,7 +3,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, ) @@ -25,6 +24,8 @@ # Condition ## - Springs must be Hookean, or linear-response, i.e. obey the Hooke's law. +# Links: Wikipedia + total_compliance = Symbol("total_compliance", units.length / units.force) first_compliance = Symbol("first_compliance", units.length / units.force) second_compliance = Symbol("second_compliance", units.length / units.force) @@ -76,10 +77,6 @@ assert expr_equals(_total_compliance_derived, law.rhs) -def print_law() -> str: - return print_expression(law) - - @validate_input( first_compliance_=first_compliance, second_compliance_=second_compliance, diff --git a/symplyphysics/laws/dynamics/springs/spring_reaction_is_proportional_to_deformation.py b/symplyphysics/laws/dynamics/springs/spring_reaction_is_proportional_to_deformation.py index 6391b6dff..2f3de672d 100644 --- a/symplyphysics/laws/dynamics/springs/spring_reaction_is_proportional_to_deformation.py +++ b/symplyphysics/laws/dynamics/springs/spring_reaction_is_proportional_to_deformation.py @@ -33,6 +33,8 @@ ## be positive, in which case the spring is stretched, or negative, in which case the spring ## is compressed. The sign of the force indicates its direction along the x-axis. +# Links: Wikipedia, last formula in paragraph + # Also see its [vector counterpart](../vector/spring_reaction_from_deformation.py) spring_reaction = symbols.force diff --git a/symplyphysics/laws/dynamics/springs/stiffness_of_two_parallel_springs.py b/symplyphysics/laws/dynamics/springs/stiffness_of_two_parallel_springs.py index 432468f5b..fd2a317d4 100644 --- a/symplyphysics/laws/dynamics/springs/stiffness_of_two_parallel_springs.py +++ b/symplyphysics/laws/dynamics/springs/stiffness_of_two_parallel_springs.py @@ -3,7 +3,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, Vector, @@ -24,6 +23,8 @@ # Condition ## - Springs must be Hookean, or linear-response, i.e. obey the Hooke's law. +# Links: Wikipedia + total_stiffness = Symbol("total_stiffness", units.force / units.length, positive=True) first_stiffness = Symbol("first_stiffness", units.force / units.length, positive=True) second_stiffness = Symbol("second_stiffness", units.force / units.length, positive=True) @@ -60,10 +61,6 @@ assert expr_equals(_total_stiffness_derived, law.rhs) -def print_law() -> str: - return print_expression(law) - - @validate_input( first_stiffness_=first_stiffness, second_stiffness_=second_stiffness, diff --git a/symplyphysics/laws/hydro/dynamic_pressure_via_density_and_flow_speed.py b/symplyphysics/laws/hydro/dynamic_pressure_via_density_and_flow_speed.py index 6fac8527c..0c06dcfbd 100644 --- a/symplyphysics/laws/hydro/dynamic_pressure_via_density_and_flow_speed.py +++ b/symplyphysics/laws/hydro/dynamic_pressure_via_density_and_flow_speed.py @@ -10,6 +10,10 @@ #. Many authors define this quantity only for *incompressible flows*, but others extend it for compressible flows as well. + +**Links:** + +#. `Wikipedia `__. """ from sympy import (Eq, solve) diff --git a/symplyphysics/laws/hydro/efficiency_of_the_hydraulic_press_from_force_and_height.py b/symplyphysics/laws/hydro/efficiency_of_the_hydraulic_press_from_force_and_height.py index 0f0439e3e..95a875015 100644 --- a/symplyphysics/laws/hydro/efficiency_of_the_hydraulic_press_from_force_and_height.py +++ b/symplyphysics/laws/hydro/efficiency_of_the_hydraulic_press_from_force_and_height.py @@ -5,7 +5,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, dimensionless, @@ -23,6 +22,8 @@ ## h1 is expended height ## n is coefficient of efficiency +# TODO find link + useful_force = clone_as_symbol(symbols.force, display_symbol="F_1", display_latex="F_1") useful_height = Symbol("useful_height", units.length) expended_force = clone_as_symbol(symbols.force, display_symbol="F_2", display_latex="F_2") @@ -32,10 +33,6 @@ law = Eq(efficiency, (useful_force * useful_height) / (expended_force * expended_height)) -def print_law() -> str: - return print_expression(law) - - @validate_input(useful_force_=useful_force, useful_height_=useful_height, expended_force_=expended_force, diff --git a/symplyphysics/laws/hydro/efflux_speed_via_height.py b/symplyphysics/laws/hydro/efflux_speed_via_height.py index 332d51d46..efeedde18 100644 --- a/symplyphysics/laws/hydro/efflux_speed_via_height.py +++ b/symplyphysics/laws/hydro/efflux_speed_via_height.py @@ -10,6 +10,10 @@ #. The orifice is very small relative to the horizontal cross-section of the container. #. The fluid is :ref:`ideal `. #. The fluid is subjected to the gravity force of Earth. + +**Links:** + +#. `Wikipedia `__. """ from sympy import (Eq, solve, sqrt) diff --git a/symplyphysics/laws/hydro/efflux_speed_via_hydrostatic_pressure_and_density.py b/symplyphysics/laws/hydro/efflux_speed_via_hydrostatic_pressure_and_density.py index 561c4c67b..20354b681 100644 --- a/symplyphysics/laws/hydro/efflux_speed_via_hydrostatic_pressure_and_density.py +++ b/symplyphysics/laws/hydro/efflux_speed_via_hydrostatic_pressure_and_density.py @@ -10,6 +10,9 @@ #. The orifice is very small relative to the horizontal cross-section of the container. #. The fluid is :ref:`ideal `. + +.. + TODO find link """ from sympy import (Eq, solve, sqrt) diff --git a/symplyphysics/laws/hydro/excessive_pressure_under_curved_surface_of_bubble.py b/symplyphysics/laws/hydro/excessive_pressure_under_curved_surface_of_bubble.py index f88b951c5..2874fbd3e 100644 --- a/symplyphysics/laws/hydro/excessive_pressure_under_curved_surface_of_bubble.py +++ b/symplyphysics/laws/hydro/excessive_pressure_under_curved_surface_of_bubble.py @@ -1,5 +1,5 @@ from sympy import (Eq, solve) -from symplyphysics import (units, Quantity, Symbol, print_expression, validate_input, +from symplyphysics import (units, Quantity, Symbol, validate_input, validate_output) from symplyphysics.core.expr_comparisons import expr_equals @@ -15,6 +15,8 @@ ## sigma - surface tension of the liquid, ## R - radius of bubble. +# Links: Physics LibreTexts, formula 20.2.4 + excessive_pressure = Symbol("excessive_pressure", units.pressure) surface_tension_of_the_liquid = Symbol("surface_tension_of_the_liquid", units.force / units.length) @@ -24,6 +26,8 @@ # This law might be derived via Laplace law. +# TODO prefix all variables used in proof with underscore + laplace_law_applied = laplace_law.law.subs({ laplace_law.surface_tension: surface_tension_of_the_liquid, laplace_law.radius_of_curvature: radius_of_bubble @@ -39,10 +43,6 @@ assert expr_equals(2 * pressure_derived, law.rhs) -def print_law() -> str: - return print_expression(law) - - @validate_input(surface_tension_of_the_liquid_=surface_tension_of_the_liquid, radius_of_bubble_=radius_of_bubble) @validate_output(excessive_pressure) diff --git a/symplyphysics/laws/hydro/froude_number.py b/symplyphysics/laws/hydro/froude_number.py index a1696c606..440ae1a8e 100644 --- a/symplyphysics/laws/hydro/froude_number.py +++ b/symplyphysics/laws/hydro/froude_number.py @@ -3,7 +3,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, dimensionless, @@ -27,6 +26,8 @@ # L is a characteristic length, # Fr is Froude number. +# Links: Wikipedia + velocity = Symbol("velocity", units.velocity) characteristic_length = Symbol("characteristic_length", units.length) froude_number = Symbol("froude_number", dimensionless) @@ -34,10 +35,6 @@ law = Eq(froude_number, velocity / sqrt(units.acceleration_due_to_gravity * characteristic_length)) -def print_law() -> str: - return print_expression(law) - - @validate_input(velocity_=velocity, characteristic_length_=characteristic_length) @validate_output(froude_number) def calculate_froude_number(velocity_: Quantity, characteristic_length_: Quantity) -> float: diff --git a/symplyphysics/laws/hydro/hagen_poiseuille_equation.py b/symplyphysics/laws/hydro/hagen_poiseuille_equation.py index 238861676..1a470ae7a 100644 --- a/symplyphysics/laws/hydro/hagen_poiseuille_equation.py +++ b/symplyphysics/laws/hydro/hagen_poiseuille_equation.py @@ -1,6 +1,5 @@ from sympy import Eq, solve, pi - -from symplyphysics import (Quantity, Symbol, print_expression, units, validate_input, +from symplyphysics import (Quantity, Symbol, units, validate_input, validate_output) # Law: delta_p = 8 * mu * L * Q / (pi * R**4) @@ -10,6 +9,8 @@ # Q is the volumetric flow rate, # R is the pipe radius +# Links: Wikipedia, first part of the first equation + dynamic_viscosity = Symbol("dynamic_viscosity", units.pressure * units.time) length = Symbol("length", units.length) flow_rate = Symbol("flow_rate", units.volume / units.time) @@ -19,10 +20,6 @@ law = Eq(delta_pressure, 8 * dynamic_viscosity * length * flow_rate / (pi * radius**4)) -def print_law() -> str: - return print_expression(law) - - @validate_input( dynamic_viscosity_=dynamic_viscosity, length_=length, diff --git a/symplyphysics/laws/hydro/hydraulic_stress_is_bulk_modulus_times_strain.py b/symplyphysics/laws/hydro/hydraulic_stress_is_bulk_modulus_times_strain.py index fccad761f..ce87babc2 100644 --- a/symplyphysics/laws/hydro/hydraulic_stress_is_bulk_modulus_times_strain.py +++ b/symplyphysics/laws/hydro/hydraulic_stress_is_bulk_modulus_times_strain.py @@ -6,6 +6,10 @@ the pressure (hydraulic stress) on the object due to the fluid is proportional to the fractional change in the object's volume due to that pressure and the bulk modulus of the object. Thus, bulk modulus of a substance is a measure of its resistance to bulk compression. + +**Links:** + +#. `Wikipedia, derivable from 12.5.3 `__. """ from sympy import Eq diff --git a/symplyphysics/laws/hydro/hydrostatic_pressure_from_density_and_depth_acceleration.py b/symplyphysics/laws/hydro/hydrostatic_pressure_from_density_and_depth_acceleration.py index 6dde6f399..aa3e834b3 100644 --- a/symplyphysics/laws/hydro/hydrostatic_pressure_from_density_and_depth_acceleration.py +++ b/symplyphysics/laws/hydro/hydrostatic_pressure_from_density_and_depth_acceleration.py @@ -1,5 +1,5 @@ from sympy import Eq, solve -from symplyphysics import symbols, units, Quantity, Symbol, print_expression, validate_input, validate_output +from symplyphysics import symbols, units, Quantity, Symbol, validate_input, validate_output # Description # Law: P = ρ * a * h @@ -11,6 +11,8 @@ # Conditions # - No other accelerations involved, ie gravitational acceleration +# TODO: find link + density = Symbol("density", units.mass / units.volume) depth = Symbol("depth", units.length) acceleration = symbols.acceleration @@ -19,10 +21,6 @@ law = Eq(hydrostatic_pressure, density * acceleration * depth) -def print_law() -> str: - return print_expression(law) - - @validate_input(density_=density, depth_=depth, acceleration_=acceleration) @validate_output(hydrostatic_pressure) def calculate_hydrostatic_pressure(density_: Quantity, depth_: Quantity, diff --git a/symplyphysics/laws/hydro/hydrostatic_pressure_via_density_and_height.py b/symplyphysics/laws/hydro/hydrostatic_pressure_via_density_and_height.py index ac096bebd..1b6f8cd00 100644 --- a/symplyphysics/laws/hydro/hydrostatic_pressure_via_density_and_height.py +++ b/symplyphysics/laws/hydro/hydrostatic_pressure_via_density_and_height.py @@ -10,6 +10,10 @@ #. The fluid is in statical equilibrium. #. The only force acting on the fluid is the force of gravity. #. The fluid is subjected to the gravity force of Earth. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq, solve diff --git a/symplyphysics/laws/hydro/inner_pressure_is_constant.py b/symplyphysics/laws/hydro/inner_pressure_is_constant.py index 9205efc2d..8039426f7 100644 --- a/symplyphysics/laws/hydro/inner_pressure_is_constant.py +++ b/symplyphysics/laws/hydro/inner_pressure_is_constant.py @@ -8,6 +8,10 @@ **Conditions:** #. The fluid must be :ref:`ideal `. + +**Links:** + +#. `Wikipedia, derivable from here `__. """ from sympy import Eq, dsolve, Derivative diff --git a/symplyphysics/laws/hydro/inner_pressure_is_sum_of_pressures.py b/symplyphysics/laws/hydro/inner_pressure_is_sum_of_pressures.py index d24138a95..9342c6bdd 100644 --- a/symplyphysics/laws/hydro/inner_pressure_is_sum_of_pressures.py +++ b/symplyphysics/laws/hydro/inner_pressure_is_sum_of_pressures.py @@ -8,6 +8,10 @@ **Conditions:** #. The fluid is :ref:`ideal `. + +**Links:** + +#. `Wikipedia, derivable from here `__. """ from sympy import Eq, solve diff --git a/symplyphysics/laws/hydro/input_force_to_area_ratio_equals_to_output.py b/symplyphysics/laws/hydro/input_force_to_area_ratio_equals_to_output.py index c9d7384dc..ad723a24d 100644 --- a/symplyphysics/laws/hydro/input_force_to_area_ratio_equals_to_output.py +++ b/symplyphysics/laws/hydro/input_force_to_area_ratio_equals_to_output.py @@ -1,5 +1,5 @@ from sympy import (Eq, solve, dsolve) -from symplyphysics import (clone_as_symbol, symbols, units, Quantity, Symbol, print_expression, +from symplyphysics import (clone_as_symbol, symbols, units, Quantity, Symbol, validate_input, validate_output) from symplyphysics.laws.dynamics import pressure_from_force_and_area as pressure_law from symplyphysics.core.expr_comparisons import expr_equals @@ -20,6 +20,8 @@ ## Conditions ## This ratio is performed only in an ideal hydraulic press, i.e. one in which there is no friction. +# Links: Physics LibreTexts, formula 53.1.2 + input_force = clone_as_symbol(symbols.force, display_symbol="F_in", display_latex="F_\\text{in}") input_area = Symbol("input_area", units.area) output_force = clone_as_symbol(symbols.force, display_symbol="F_out", display_latex="F_\\text{out}") @@ -27,6 +29,8 @@ law = Eq(input_force / input_area, output_force / output_forces_area) +# TODO prefix variables used in proof with underscore + pressure_input = pressure_law.law.rhs.subs({ pressure_law.force: input_force, pressure_law.area: input_area @@ -52,10 +56,6 @@ assert expr_equals(law.lhs, pressure_equation.lhs) -def print_law() -> str: - return print_expression(law) - - @validate_input(input_force_=input_force, input_area_=input_area, output_forces_area_=output_forces_area) diff --git a/symplyphysics/laws/hydro/jurin_equation.py b/symplyphysics/laws/hydro/jurin_equation.py index e80866928..d1787f252 100644 --- a/symplyphysics/laws/hydro/jurin_equation.py +++ b/symplyphysics/laws/hydro/jurin_equation.py @@ -1,5 +1,5 @@ from sympy import (Eq, solve, cos) -from symplyphysics import (units, Quantity, Symbol, print_expression, validate_input, +from symplyphysics import (units, Quantity, Symbol, validate_input, validate_output, angle_type) # Description @@ -19,6 +19,8 @@ ## g is acceleration of free fall ## r is capillary radius +# Links: Wikipedia + height = Symbol("height", units.length) surface_tension_coefficient = Symbol("surface_tension_coefficient", units.force / units.length) angle = Symbol("angle", angle_type) @@ -30,10 +32,6 @@ (density_of_liquid * radius * units.acceleration_due_to_gravity)) -def print_law() -> str: - return print_expression(law) - - @validate_input(surface_tension_coefficient_=surface_tension_coefficient, angle_=angle, density_of_liquid_=density_of_liquid, diff --git a/symplyphysics/laws/hydro/mach_number_is_flow_speed_over_speed_of_sound.py b/symplyphysics/laws/hydro/mach_number_is_flow_speed_over_speed_of_sound.py index 676a9a916..fe3cff60b 100644 --- a/symplyphysics/laws/hydro/mach_number_is_flow_speed_over_speed_of_sound.py +++ b/symplyphysics/laws/hydro/mach_number_is_flow_speed_over_speed_of_sound.py @@ -4,6 +4,10 @@ *Mach number* is a dimensionless quantity in fluid dynamics representing the ratio of flow speed divided by the speed of sound in the medium. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq, solve diff --git a/symplyphysics/laws/hydro/nusselt_number.py b/symplyphysics/laws/hydro/nusselt_number.py index 7ef5e2bad..227d8e8c8 100644 --- a/symplyphysics/laws/hydro/nusselt_number.py +++ b/symplyphysics/laws/hydro/nusselt_number.py @@ -3,7 +3,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, dimensionless, @@ -26,6 +25,8 @@ # k is the thermal conductivity, # Nu is Nusselt number. +# Links: Wikipedia + heat_transfer_coefficient = Symbol("heat_transfer_coefficient", units.power / (units.area * units.temperature)) characteristic_length = Symbol("characteristic_length", units.length) @@ -37,10 +38,6 @@ law = Eq(nusselt_number, heat_transfer_coefficient * characteristic_length / thermal_conductivity) -def print_law() -> str: - return print_expression(law) - - @validate_input( heat_transfer_coefficient_=heat_transfer_coefficient, characteristic_length_=characteristic_length, diff --git a/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_horizontally.py b/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_horizontally.py index 1f157f82d..8eae148ee 100644 --- a/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_horizontally.py +++ b/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_horizontally.py @@ -7,7 +7,6 @@ units, Quantity, Symbol, - print_expression, validate_input, validate_output, vector_magnitude, @@ -29,6 +28,8 @@ ## a - acceleration of vessel, ## h - height. +# TODO: find link + pressure = Symbol("pressure", units.pressure) density_liquid = Symbol("density_liquid", units.mass / units.volume) @@ -38,6 +39,8 @@ law = Eq(pressure, density_liquid * sqrt(earth_free_fall_acceleration**2 + acceleration**2) * height) +# TODO prefix variables used in proof with underscore + # This law might be derived via hydrostatic pressure law. # The vessel moves horizontally and the pressure exerted by the resultant force on a surface of equal pressure, # which is inclined with respect to the horizon, is considered. The modulus of the optimizing force will be equal @@ -63,10 +66,6 @@ assert expr_equals(pressure_derived, law.rhs) -def print_law() -> str: - return print_expression(law) - - @validate_input(density_liquid_=density_liquid, acceleration_=acceleration, height_=height) @validate_output(pressure) def calculate_pressure(density_liquid_: Quantity, acceleration_: Quantity, diff --git a/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_vertically.py b/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_vertically.py index dbe4ef48a..2a44175b0 100644 --- a/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_vertically.py +++ b/symplyphysics/laws/hydro/pressure_of_liquid_in_vessel_moving_vertically.py @@ -27,6 +27,8 @@ ## a - acceleration of vessel, ## h - height. +# TODO: find link + pressure = Symbol("pressure", units.pressure) density_liquid = Symbol("density_liquid", units.mass / units.volume) diff --git a/symplyphysics/laws/hydro/reynolds_number_formula.py b/symplyphysics/laws/hydro/reynolds_number_formula.py index 557f5388c..0d543cc3e 100644 --- a/symplyphysics/laws/hydro/reynolds_number_formula.py +++ b/symplyphysics/laws/hydro/reynolds_number_formula.py @@ -6,6 +6,10 @@ It helps predict fluid flow patterns in different situations by measuring the ratio between inertial and viscous forces. Low Reynolds numbers tend to correspond to laminar flows, while high Reynolds numbers tend to correspond to turbulent flows. + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq, solve diff --git a/symplyphysics/laws/hydro/shear_stress_is_proportional_to_speed_gradient.py b/symplyphysics/laws/hydro/shear_stress_is_proportional_to_speed_gradient.py index 5e82a078f..587265418 100644 --- a/symplyphysics/laws/hydro/shear_stress_is_proportional_to_speed_gradient.py +++ b/symplyphysics/laws/hydro/shear_stress_is_proportional_to_speed_gradient.py @@ -22,6 +22,10 @@ derivatives with respect to both perpendicular directions. #. The fluid is incompressible and isotropic. #. The fluid flow is steady (laminar). + +**Links:** + +#. `Wikipedia `__. """ from sympy import Eq, Derivative, solve diff --git a/symplyphysics/laws/hydro/submerged_volume_of_floating_body_via_density_ratio.py b/symplyphysics/laws/hydro/submerged_volume_of_floating_body_via_density_ratio.py index e05554900..4c4ef5908 100644 --- a/symplyphysics/laws/hydro/submerged_volume_of_floating_body_via_density_ratio.py +++ b/symplyphysics/laws/hydro/submerged_volume_of_floating_body_via_density_ratio.py @@ -13,6 +13,10 @@ #. :math:`\rho \le \rho_\text{fl}`, so the body must be floating. #. The body must be in static equilibrium. + +**Links:** + +#. `Physics LibreTexts, formula 10.3.17 `__. """ from sympy import (Eq, solve) diff --git a/symplyphysics/laws/hydro/surface_tension_force_via_surface_tension_and_length.py b/symplyphysics/laws/hydro/surface_tension_force_via_surface_tension_and_length.py index 943e6414a..fd413ba57 100644 --- a/symplyphysics/laws/hydro/surface_tension_force_via_surface_tension_and_length.py +++ b/symplyphysics/laws/hydro/surface_tension_force_via_surface_tension_and_length.py @@ -5,6 +5,10 @@ The surface tension force is directed tangentially to the surface of the fluid, perpendicular to the section of the fluid contour on which it acts and is proportional to the length of this section. Also see `figure `_. + +**Links:** + +#. `Wikipedia `__. """ from sympy import (Eq, solve) diff --git a/symplyphysics/laws/hydro/volume_flux_is_constant.py b/symplyphysics/laws/hydro/volume_flux_is_constant.py index d9612bb21..27f55d909 100644 --- a/symplyphysics/laws/hydro/volume_flux_is_constant.py +++ b/symplyphysics/laws/hydro/volume_flux_is_constant.py @@ -1,4 +1,4 @@ -""" +r""" Volume flux is constant ======================= @@ -9,6 +9,10 @@ **Conditions:** #. The fluid is :ref:`ideal `. + +**Links:** + +#. `Engineering LibreTexts, derivable from here `__. """ from sympy import Eq, solve, dsolve, Derivative diff --git a/symplyphysics/laws/hydro/weight_in_fluid_via_ratio_of_densities.py b/symplyphysics/laws/hydro/weight_in_fluid_via_ratio_of_densities.py index 1924b4259..4864f555d 100644 --- a/symplyphysics/laws/hydro/weight_in_fluid_via_ratio_of_densities.py +++ b/symplyphysics/laws/hydro/weight_in_fluid_via_ratio_of_densities.py @@ -5,6 +5,10 @@ The *Archimedean force* acting on a body immersed in a fluid is equal to the weight of the fluid displaced by the body. It can be derived that the weight of the body immersed in the fluid is proportional to its weight in vacuum and also depends on the ratio of the fluid density and body density. + +**Links:** + +#. `Physics LibreTexts, derivable from here `__. """ from sympy import (Eq, solve)