MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / second_effusion_rate

Function second_effusion_rate

physics/grahams_law.py:103–136  ·  view source on GitHub ↗

Input Parameters: ----------------- effusion_rate: Effustion rate of second gas (m^2/s, mm^2/s, etc.) molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.) molar_mass_2: Molar mass of the second gas (g/mol, kg/kmol, etc.) Returns: -------- >>> second_effu

(
    effusion_rate: float, molar_mass_1: float, molar_mass_2: float
)

Source from the content-addressed store, hash-verified

101
102
103def second_effusion_rate(
104 effusion_rate: float, molar_mass_1: float, molar_mass_2: float
105) -> float | ValueError:
106 """
107 Input Parameters:
108 -----------------
109 effusion_rate: Effustion rate of second gas (m^2/s, mm^2/s, etc.)
110 molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.)
111 molar_mass_2: Molar mass of the second gas (g/mol, kg/kmol, etc.)
112
113 Returns:
114 --------
115 >>> second_effusion_rate(1, 2.016, 4.002)
116 0.709752
117 >>> second_effusion_rate(-1, 2.016, 4.002)
118 ValueError('Input Error: Molar mass and effusion rate values must greater than 0.')
119 >>> second_effusion_rate(1)
120 Traceback (most recent call last):
121 ...
122 TypeError: second_effusion_rate() missing 2 required positional arguments: \
123'molar_mass_1' and 'molar_mass_2'
124 >>> second_effusion_rate(1, 2.016)
125 Traceback (most recent call last):
126 ...
127 TypeError: second_effusion_rate() missing 1 required positional argument: \
128'molar_mass_2'
129 """
130 return (
131 round(effusion_rate / sqrt(molar_mass_2 / molar_mass_1), 6)
132 if validate(effusion_rate, molar_mass_1, molar_mass_2)
133 else ValueError(
134 "Input Error: Molar mass and effusion rate values must greater than 0."
135 )
136 )
137
138
139def first_molar_mass(

Callers

nothing calls this directly

Calls 1

validateFunction · 0.70

Tested by

no test coverage detected