From bacd9d1152fa05560aece237ca9694ca15a9fd13 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Tue, 24 Dec 2024 03:41:46 +0300 Subject: [PATCH 1/8] Fix sphinx/build_docs warnings for physics/speeds_of_gas_molecules --- physics/speeds_of_gas_molecules.py | 37 ++++++++++++------------------ 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index a50d1c0f6d76..1bd40073641f 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -1,46 +1,37 @@ -""" +r""" The root-mean-square, average and most probable speeds of gas molecules are derived from the Maxwell-Boltzmann distribution. The Maxwell-Boltzmann distribution is a probability distribution that describes the distribution of speeds of particles in an ideal gas. The distribution is given by the following equation: - - ------------------------------------------------- - | f(v) = (M/2πRT)^(3/2) * 4πv^2 * e^(-Mv^2/2RT) | - ------------------------------------------------- + \.. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 \cdot e^{-\frac{Mv^2}{2RT}} where: - f(v) is the fraction of molecules with a speed v - M is the molar mass of the gas in kg/mol - R is the gas constant - T is the absolute temperature + * :math:`f(v)` is the fraction of molecules with a speed :math:`v` + * :math:`M` is the molar mass of the gas in kg/mol + * :math:`R` is the gas constant + * :math:`T` is the absolute temperature More information about the Maxwell-Boltzmann distribution can be found here: https://en.wikipedia.org/wiki/Maxwell%E2%80%93Boltzmann_distribution The average speed can be calculated by integrating the Maxwell-Boltzmann distribution from 0 to infinity and dividing by the total number of molecules. The result is: - - --------------------- - | vavg = √(8RT/πM) | - --------------------- + + .. math:: v_{avg} = \sqrt{\frac{8RT}{\pi M}} The most probable speed is the speed at which the Maxwell-Boltzmann distribution is at its maximum. This can be found by differentiating the Maxwell-Boltzmann -distribution with respect to v and setting the result equal to zero. The result is: - - --------------------- - | vmp = √(2RT/M) | - --------------------- +distribution with respect to :math:`v` and setting the result equal to zero. The result is: + + .. math:: v_{mp} = \sqrt{\frac{2RT}{M}} The root-mean-square speed is another measure of the average speed of the molecules in a gas. It is calculated by taking the square root of the average of the squares of the speeds of the molecules. The result is: - - --------------------- - | vrms = √(3RT/M) | - --------------------- + + .. math:: v_{rms} = \sqrt{\frac{3RT}{M}} Here we have defined functions to calculate the average and most probable speeds of molecules in a gas given the @@ -57,6 +48,7 @@ def avg_speed_of_molecule(temperature: float, molar_mass: float) -> float: and returns the average speed of a molecule in the gas (in m/s). Examples: + >>> avg_speed_of_molecule(273, 0.028) # nitrogen at 273 K 454.3488755020387 >>> avg_speed_of_molecule(300, 0.032) # oxygen at 300 K @@ -84,6 +76,7 @@ def mps_speed_of_molecule(temperature: float, molar_mass: float) -> float: and returns the most probable speed of a molecule in the gas (in m/s). Examples: + >>> mps_speed_of_molecule(273, 0.028) # nitrogen at 273 K 402.65620701908966 >>> mps_speed_of_molecule(300, 0.032) # oxygen at 300 K From 05921b5115ba0b666353d18181ba1758bf289e03 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Tue, 24 Dec 2024 03:42:16 +0300 Subject: [PATCH 2/8] Fix --- physics/speeds_of_gas_molecules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index 1bd40073641f..b16dbfb53cd1 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -5,7 +5,7 @@ speeds of particles in an ideal gas. The distribution is given by the following equation: - \.. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 \cdot e^{-\frac{Mv^2}{2RT}} + .. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 \cdot e^{-\frac{Mv^2}{2RT}} where: * :math:`f(v)` is the fraction of molecules with a speed :math:`v` From a50e72401e487c3e73288ac834734afaf78d9beb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Dec 2024 14:58:58 +0000 Subject: [PATCH 3/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- physics/speeds_of_gas_molecules.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index b16dbfb53cd1..4e4e74855ff5 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -18,19 +18,19 @@ The average speed can be calculated by integrating the Maxwell-Boltzmann distribution from 0 to infinity and dividing by the total number of molecules. The result is: - + .. math:: v_{avg} = \sqrt{\frac{8RT}{\pi M}} The most probable speed is the speed at which the Maxwell-Boltzmann distribution is at its maximum. This can be found by differentiating the Maxwell-Boltzmann distribution with respect to :math:`v` and setting the result equal to zero. The result is: - + .. math:: v_{mp} = \sqrt{\frac{2RT}{M}} The root-mean-square speed is another measure of the average speed of the molecules in a gas. It is calculated by taking the square root of the average of the squares of the speeds of the molecules. The result is: - + .. math:: v_{rms} = \sqrt{\frac{3RT}{M}} Here we have defined functions to calculate the average and From e6ed32e1bb926298886fa453f4c2add4375a51f6 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Tue, 24 Dec 2024 18:07:52 +0300 Subject: [PATCH 4/8] Fix --- physics/speeds_of_gas_molecules.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index 4e4e74855ff5..caf97beda03f 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -5,7 +5,8 @@ speeds of particles in an ideal gas. The distribution is given by the following equation: - .. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 \cdot e^{-\frac{Mv^2}{2RT}} + .. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 + \cdot e^{-\frac{Mv^2}{2RT}} where: * :math:`f(v)` is the fraction of molecules with a speed :math:`v` @@ -23,7 +24,8 @@ The most probable speed is the speed at which the Maxwell-Boltzmann distribution is at its maximum. This can be found by differentiating the Maxwell-Boltzmann -distribution with respect to :math:`v` and setting the result equal to zero. The result is: +distribution with respect to :math:`v` and setting the result equal to zero. +The result is: .. math:: v_{mp} = \sqrt{\frac{2RT}{M}} From 214e482f138fb0b28d599fae3b69a487772e7e15 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Tue, 24 Dec 2024 19:50:50 +0300 Subject: [PATCH 5/8] Fix review issue --- physics/speeds_of_gas_molecules.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index caf97beda03f..a6feb39f0a70 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -5,6 +5,8 @@ speeds of particles in an ideal gas. The distribution is given by the following equation: + f(v) = (M/2πRT)^(3/2) * 4πv^2 * e^(-Mv^2/2RT) + .. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 \cdot e^{-\frac{Mv^2}{2RT}} From f620e2927afebab4e70b4c29fb1cd0e33cc01668 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Sun, 29 Dec 2024 21:48:39 +0300 Subject: [PATCH 6/8] Fix --- physics/speeds_of_gas_molecules.py | 37 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index a6feb39f0a70..8db4178decb5 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -1,41 +1,46 @@ -r""" +""" The root-mean-square, average and most probable speeds of gas molecules are derived from the Maxwell-Boltzmann distribution. The Maxwell-Boltzmann distribution is a probability distribution that describes the distribution of speeds of particles in an ideal gas. -The distribution is given by the following equation: - f(v) = (M/2πRT)^(3/2) * 4πv^2 * e^(-Mv^2/2RT) +The distribution is given by the following equation:: - .. math:: f(v) = \left(\frac{M}{2 \pi RT}\right)^{\frac{3}{2}} \cdot 4 \pi v^2 - \cdot e^{-\frac{Mv^2}{2RT}} + ------------------------------------------------- + | f(v) = (M/2πRT)^(3/2) * 4πv^2 * e^(-Mv^2/2RT) | + ------------------------------------------------- where: - * :math:`f(v)` is the fraction of molecules with a speed :math:`v` - * :math:`M` is the molar mass of the gas in kg/mol - * :math:`R` is the gas constant - * :math:`T` is the absolute temperature + * ``f(v)`` is the fraction of molecules with a speed ``v`` + * ``M`` is the molar mass of the gas in kg/mol + * ``R`` is the gas constant + * ``T`` is the absolute temperature More information about the Maxwell-Boltzmann distribution can be found here: https://en.wikipedia.org/wiki/Maxwell%E2%80%93Boltzmann_distribution The average speed can be calculated by integrating the Maxwell-Boltzmann distribution -from 0 to infinity and dividing by the total number of molecules. The result is: +from 0 to infinity and dividing by the total number of molecules. The result is:: - .. math:: v_{avg} = \sqrt{\frac{8RT}{\pi M}} + --------------------- + | v_avg = √(8RT/πM) | + --------------------- The most probable speed is the speed at which the Maxwell-Boltzmann distribution is at its maximum. This can be found by differentiating the Maxwell-Boltzmann -distribution with respect to :math:`v` and setting the result equal to zero. -The result is: +distribution with respect to v and setting the result equal to zero. The result is:: - .. math:: v_{mp} = \sqrt{\frac{2RT}{M}} + --------------------- + | v_mp = √(2RT/M) | + --------------------- The root-mean-square speed is another measure of the average speed of the molecules in a gas. It is calculated by taking the square root -of the average of the squares of the speeds of the molecules. The result is: +of the average of the squares of the speeds of the molecules. The result is:: - .. math:: v_{rms} = \sqrt{\frac{3RT}{M}} + --------------------- + | v_rms = √(3RT/M) | + --------------------- Here we have defined functions to calculate the average and most probable speeds of molecules in a gas given the From ee44cc10daa172bea0f463b29367bae8c2e684a8 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Sun, 29 Dec 2024 21:49:41 +0300 Subject: [PATCH 7/8] Fix --- physics/speeds_of_gas_molecules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index 8db4178decb5..35d41257e74f 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -28,7 +28,7 @@ The most probable speed is the speed at which the Maxwell-Boltzmann distribution is at its maximum. This can be found by differentiating the Maxwell-Boltzmann -distribution with respect to v and setting the result equal to zero. The result is:: +distribution with respect to ``v`` and setting the result equal to zero. The result is:: --------------------- | v_mp = √(2RT/M) | From f19c044bd99a86084dbecd6ec6f9d097b9bb5fd5 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Sun, 29 Dec 2024 21:52:30 +0300 Subject: [PATCH 8/8] Fix --- physics/speeds_of_gas_molecules.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/physics/speeds_of_gas_molecules.py b/physics/speeds_of_gas_molecules.py index 35d41257e74f..42f90a9fd6f3 100644 --- a/physics/speeds_of_gas_molecules.py +++ b/physics/speeds_of_gas_molecules.py @@ -22,25 +22,25 @@ The average speed can be calculated by integrating the Maxwell-Boltzmann distribution from 0 to infinity and dividing by the total number of molecules. The result is:: - --------------------- + ---------------------- | v_avg = √(8RT/πM) | - --------------------- + ---------------------- The most probable speed is the speed at which the Maxwell-Boltzmann distribution is at its maximum. This can be found by differentiating the Maxwell-Boltzmann distribution with respect to ``v`` and setting the result equal to zero. The result is:: - --------------------- + ---------------------- | v_mp = √(2RT/M) | - --------------------- + ---------------------- The root-mean-square speed is another measure of the average speed of the molecules in a gas. It is calculated by taking the square root of the average of the squares of the speeds of the molecules. The result is:: - --------------------- + ---------------------- | v_rms = √(3RT/M) | - --------------------- + ---------------------- Here we have defined functions to calculate the average and most probable speeds of molecules in a gas given the