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

Function first_effusion_rate

physics/grahams_law.py:67–100  ·  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: -------- >>> first_effus

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

Source from the content-addressed store, hash-verified

65
66
67def first_effusion_rate(
68 effusion_rate: float, molar_mass_1: float, molar_mass_2: float
69) -> float | ValueError:
70 """
71 Input Parameters:
72 -----------------
73 effusion_rate: Effustion rate of second gas (m^2/s, mm^2/s, etc.)
74 molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.)
75 molar_mass_2: Molar mass of the second gas (g/mol, kg/kmol, etc.)
76
77 Returns:
78 --------
79 >>> first_effusion_rate(1, 2.016, 4.002)
80 1.408943
81 >>> first_effusion_rate(-1, 2.016, 4.002)
82 ValueError('Input Error: Molar mass and effusion rate values must greater than 0.')
83 >>> first_effusion_rate(1)
84 Traceback (most recent call last):
85 ...
86 TypeError: first_effusion_rate() missing 2 required positional arguments: \
87'molar_mass_1' and 'molar_mass_2'
88 >>> first_effusion_rate(1, 2.016)
89 Traceback (most recent call last):
90 ...
91 TypeError: first_effusion_rate() missing 1 required positional argument: \
92'molar_mass_2'
93 """
94 return (
95 round(effusion_rate * sqrt(molar_mass_2 / molar_mass_1), 6)
96 if validate(effusion_rate, molar_mass_1, molar_mass_2)
97 else ValueError(
98 "Input Error: Molar mass and effusion rate values must greater than 0."
99 )
100 )
101
102
103def second_effusion_rate(

Callers

nothing calls this directly

Calls 1

validateFunction · 0.70

Tested by

no test coverage detected