Skip to content

Commit

Permalink
Patch documentation (#919)
Browse files Browse the repository at this point in the history
* Fix documentation

* Fix documentation

* Fix documentation

* Add documentation

* Fix documentation

* Fix documentation

* Add documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Fix documentation

* Refactor code test

* Refactor latex test

* Rename variable

* Fix documentation

* Fix documentation

* Split symbol into two

* Remove duplicate law and test

* Fix documentation

* Fix documentation

* Fix tests

* Linter fixes

---------

Co-authored-by: Andrey Lekar <[email protected]>
  • Loading branch information
alesanter and Andrey Lekar authored Nov 11, 2024
1 parent ed3ecab commit 51ab2a0
Show file tree
Hide file tree
Showing 73 changed files with 952 additions and 1,381 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@
from sympy import Eq, exp
from symplyphysics import (
quantities,
dimensionless,
Quantity,
validate_input,
validate_output,
symbols,
convert_to_float,
SymbolNew,
clone_as_symbol,
)

boltzmann_factor = SymbolNew("f", dimensionless)
boltzmann_factor = symbols.boltzmann_factor
"""
Boltzmann factor.
:symbols:`boltzmann_factor`.
"""

energy_of_state = clone_as_symbol(symbols.energy, display_symbol="E[i]", display_latex="E_i")
Expand Down
11 changes: 8 additions & 3 deletions symplyphysics/definitions/damped_harmonic_oscillator_equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@
:symbols:`time`.
"""

displacement = clone_as_function(symbols.position, [time])
displacement = clone_as_function(
symbols.euclidean_distance,
[time],
display_symbol="x",
display_latex="x",
)
"""
Displacement of the oscillating body as a function of time. See :symbols:`position`.
Displacement of the oscillating body as a function of time. See :symbols:`euclidean_distance`.
"""

undamped_angular_frequency = clone_as_symbol(symbols.angular_frequency, positive=True)
Expand All @@ -49,7 +54,7 @@


@validate_input(
initial_position_=symbols.distance,
initial_position_=symbols.euclidean_distance,
initial_velocity_=symbols.speed,
undamped_angular_frequency_=undamped_angular_frequency,
damping_ratio_=damping_ratio,
Expand Down
4 changes: 2 additions & 2 deletions symplyphysics/laws/dynamics/period_of_physical_pendulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
The :symbols:`rotational_inertia` of the pendulum.
"""

distance_to_pivot = clone_as_symbol(symbols.distance, positive=True)
distance_to_pivot = clone_as_symbol(symbols.euclidean_distance, positive=True)
"""
The :symbols:`distance` between the pivot and the pendulum's center of mass.
The :symbols:`euclidean_distance` between the pivot and the pendulum's center of mass.
"""

law = Eq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
The spring's :symbols:`stiffness`, or spring constant.
"""

displacement = symbols.distance
displacement = symbols.euclidean_distance
"""
The displacement of the spring, or the :symbols:`distance` between the initial position
The displacement of the spring, or the :symbols:`euclidean_distance` between the initial position
and the rest position.
"""

Expand Down
6 changes: 2 additions & 4 deletions symplyphysics/laws/electricity/charge_is_quantized.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

from sympy import Eq
from symplyphysics import (
SymbolNew,
dimensionless,
Quantity,
validate_input,
validate_output,
Expand All @@ -25,9 +23,9 @@
Total :symbols:`charge` of the body.
"""

integer_factor = SymbolNew("n", dimensionless) # positive, zero or negative
integer_factor = symbols.whole_number
"""
Integer factor of any sign.
:symbols:`whole_number`.
"""

law = Eq(charge, integer_factor * quantities.elementary_charge)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
:symbols:`area` of the plates.
"""

distance = symbols.distance
distance = symbols.euclidean_distance
"""
:symbols:`distance` between the plates.
:symbols:`euclidean_distance` between the plates.
"""

law = Eq(capacitance, absolute_permittivity * area / distance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
:symbols:`voltage` across the capacitor.
"""

source_voltage = clone_as_symbol(symbols.voltage, display_symbol="V_0", display_latex="V_0")
source_voltage = clone_as_symbol(symbols.voltage, subscript="0")
"""
:symbols:`voltage` of the source, which is the initial voltage across the resistor.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
from sympy import Eq, solve
from symplyphysics import Quantity, validate_input, validate_output, symbols, clone_as_symbol

initial_charge = clone_as_symbol(symbols.charge, display_symbol="q_0", display_latex="q_0")
initial_charge = clone_as_symbol(symbols.charge, subscript="0")
"""
Initial :symbols:`charge` of the system.
"""

final_charge = clone_as_symbol(symbols.charge, display_symbol="q_1", display_latex="q_1")
final_charge = clone_as_symbol(symbols.charge, subscript="1")
"""
Final :symbols:`charge` of the system.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
Magnitude of one the two point :symbols:`charge`-s comprising the system.
"""

distance = symbols.distance
distance = symbols.euclidean_distance
"""
:symbols:`distance` between point charges.
:symbols:`euclidean_distance` between point charges.
"""

law = Eq(electric_dipole_moment, charge * distance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
:symbols:`electric_dipole_moment`.
"""

distance = symbols.distance
distance = symbols.euclidean_distance
"""
:symbols:`distance` to dipole.
:symbols:`euclidean_distance` to dipole.
"""

law = Eq(electric_field_strength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
Value of the point :symbols:`charge`.
"""

distance = symbols.distance
distance = symbols.euclidean_distance
"""
:symbols:`distance` to the charge.
:symbols:`euclidean_distance` to the charge.
"""

law = Eq(electric_field_strength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Projection of the electrostatic :symbols:`force` applied to the test charge.
"""

test_charge = clone_as_symbol(symbols.charge, display_symbol="q_0", display_latex="q_0")
test_charge = clone_as_symbol(symbols.charge, subscript="0")
"""
Value of the test :symbols:`charge`.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
Total :symbols:`charge` of the sphere.
"""

distance = symbols.distance
distance = symbols.euclidean_distance
"""
:symbols:`distance` to the center of the sphere.
:symbols:`euclidean_distance` to the center of the sphere.
"""

law = Eq(electric_field_strength, charge / (4 * pi * quantities.vacuum_permittivity * distance**2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,27 @@

from sympy import (Eq, Derivative)
from symplyphysics import (
dimensionless,
units,
Quantity,
SymbolNew,
validate_input,
validate_output,
symbols,
clone_as_function,
)
from symplyphysics.core.geometry.line import two_point_function, Point2D

electromotive_force = SymbolNew("E", units.voltage, display_latex="\\mathcal{E}")
electromotive_force = symbols.electromotive_force
r"""
Electromotive force induced in the contour.
:symbols:`electromotive_force` induced in the contour.
"""

current_turn_count = SymbolNew("N", dimensionless)
current_turn_count = symbols.positive_number
"""
Number of turns the current makes around the contour.
Number of turns the current makes around the contour. See :symbols:`positive_number`.
"""

time = SymbolNew("t", units.time)
time = symbols.time
"""
Time.
:symbols:`time`.
"""

magnetic_flux = clone_as_function(symbols.magnetic_flux, [time])
Expand Down

This file was deleted.

Loading

0 comments on commit 51ab2a0

Please sign in to comment.