Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links — miscellanous (3) #930

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
units,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
angle_type,
Expand All @@ -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)
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
dimensionless,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
)
Expand All @@ -26,17 +25,15 @@
# Note
## - An equivalent definition uses angular frequencies instead of linear ones.

# Links: Wikipedia <https://en.wikipedia.org/wiki/Q_factor#Bandwidth_definition>

quality_factor = Symbol("quality_factor", dimensionless)
resonant_frequency = Symbol("resonant_frequency", units.frequency)
resonance_width = Symbol("resonance_width", units.frequency)

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
convert_to_float,
dimensionless,
Symbol,
print_expression,
validate_input,
validate_output,
)
Expand All @@ -18,16 +17,14 @@
## Q - Q factor
## zeta - [damping ratio](../../../definitions/damped_harmonic_oscillator_equation.py)

# Links: derivable from here <https://en.wikipedia.org/wiki/Damping#Q_factor_and_decay_rate>

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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
dimensionless,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
)
Expand All @@ -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 <https://en.wikipedia.org/wiki/Q_factor#Stored_energy_definition>

quality_factor = Symbol("quality_factor", dimensionless)
resonant_angular_frequency = Symbol("resonant_angular_frequency", angle_type / units.time)
energy_stored = Symbol("energy_stored", units.energy)
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#. The :ref:`Poisson ratio <poisson-ratio>` :math:`\nu < \frac{1}{2}`,
since :doc:`elastic energy density <laws.dynamics.deformation.elastic_energy_density_of_bulk_compression_via_pressure>`
cannot be negative.

**Links:**

#. `Wikipedia, derivable from second part of the equation <https://en.wikipedia.org/wiki/Young%27s_modulus#Usage>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
its Young's modulus and the square of its strain. The
:doc:`Hooke's law <laws.dynamics.deformation.tensile_stress_is_youngs_modulus_times_strain>`
can be used to obtain analogous forms of this law.

**Conditions:**

#. The material is linearly elastic.

**Links:**

#. `Wikipedia, equation on the fourth line <https://en.wikipedia.org/wiki/Young%27s_modulus#Elastic_potential_energy>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://en.wikipedia.org/wiki/Strain_(mechanics)#Engineering_strain>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://en.wikipedia.org/wiki/Poisson%27s_ratio#Origin>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
=================================================

*Rotational stiffness* is the extent to which an object resists rotational deformation.

**Links:**

#. `Wikipedia <https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
angle_type,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
)
Expand All @@ -26,17 +25,15 @@
# Note
## For a visual representation of shear stress visit [this](https://vuzdoc.org/htm/img/3/6176/223.png)

# Links: Wikipedia <https://en.wikipedia.org/wiki/Shear_stress#Pure>

shear_stress = Symbol("shear_stress", units.pressure)
shear_modulus = Symbol("shear_modulus", units.pressure)
shear_strain = Symbol("shear_strain", angle_type)

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
**Conditions:**

#. The deformations are small.

**Links:**

#. `Wikipedia, general information can be found here <https://en.wikipedia.org/wiki/Infinitesimal_strain_theory>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://en.wikipedia.org/wiki/Young%27s_modulus#Definition>`__.
"""

from sympy import Eq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# Conditions
## - Force is conservative (see definition above)

# Links: Wikipedia <https://en.wikipedia.org/wiki/Conservative_force>


def law(potential_: ScalarField) -> Vector:
gradient_vector = gradient_operator(potential_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
units,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
)
Expand All @@ -25,6 +24,8 @@
# Condition
## - Springs must be Hookean, or linear-response, i.e. obey the Hooke's law.

# Links: Wikipedia <https://en.wikipedia.org/wiki/Series_and_parallel_springs#Formulas>

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)
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://en.wikipedia.org/wiki/Hooke%27s_law#Linear_springs>

# Also see its [vector counterpart](../vector/spring_reaction_from_deformation.py)

spring_reaction = symbols.force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
units,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
Vector,
Expand All @@ -24,6 +23,8 @@
# Condition
## - Springs must be Hookean, or linear-response, i.e. obey the Hooke's law.

# Links: Wikipedia <https://en.wikipedia.org/wiki/Series_and_parallel_springs#Formulas>

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)
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

#. Many authors define this quantity only for *incompressible flows*, but others extend it for
compressible flows as well.

**Links:**

#. `Wikipedia <https://en.wikipedia.org/wiki/Dynamic_pressure>`__.
"""

from sympy import (Eq, solve)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
units,
Quantity,
Symbol,
print_expression,
validate_input,
validate_output,
dimensionless,
Expand All @@ -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")
Expand All @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions symplyphysics/laws/hydro/efflux_speed_via_height.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#. The orifice is very small relative to the horizontal cross-section of the container.
#. The fluid is :ref:`ideal <ideal_fluid_def>`.
#. The fluid is subjected to the gravity force of Earth.

**Links:**

#. `Wikipedia <https://en.wikipedia.org/wiki/Torricelli%27s_law#>`__.
"""

from sympy import (Eq, solve, sqrt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

#. The orifice is very small relative to the horizontal cross-section of the container.
#. The fluid is :ref:`ideal <ideal_fluid_def>`.

..
TODO find link
"""

from sympy import (Eq, solve, sqrt)
Expand Down
Loading
Loading