|
1 | 1 | """ |
2 | | -Title : Implementation of Boyle's law. |
| 2 | +Title: Implementation of Boyle's law. |
3 | 3 |
|
4 | 4 | Description : |
5 | 5 | Boyle's law, also referred to as the Boyle-Mariotte law, or Mariotte's law |
|
12 | 12 |
|
13 | 13 | P ∝ (1/V) |
14 | 14 |
|
15 | | - Where P is the pressure exerted by the gas and V is the volume occupied by it. This |
16 | | - proportionality can be converted into an equation by adding a constant, k. |
| 15 | + Where P is the pressure exerted by the gas, and V is the volume occupied by it. |
| 16 | + This proportionality can be converted into an equation by adding a constant, k. |
17 | 17 |
|
18 | 18 | P = k*(1/V) ⇒ PV = k |
19 | 19 |
|
20 | 20 | Boyle's law states that when the temperature of a given mass of confined gas is |
21 | | - constant,the product of its pressure and volume is also constant. When comparing the |
| 21 | + constant, the product of its pressure and volume is also constant. When comparing the |
22 | 22 | same substance under two different sets of conditions, the law can be expressed as: |
23 | 23 |
|
24 | 24 | P1V1 = P2V2 |
25 | 25 |
|
26 | 26 | Where, |
27 | 27 |
|
28 | 28 | P1 is the initial pressure exerted by the gas in Pascals (P) |
29 | | - V1 is the initial volume occupied by the gas Litres (L) |
30 | | - P2 is the final pressure exerted by the gas Pascals (P) |
31 | | - V2 is the final volume occupied by the gas Litres (L) |
| 29 | + V1 is the initial volume occupied by the gas in litres (L) |
| 30 | + P2 is the final pressure exerted by the gas in Pascals (P) |
| 31 | + V2 is the final volume occupied by the gas in litres (L) |
32 | 32 |
|
33 | 33 | This equation can be used to predict the increase in the pressure exerted by a gas |
34 | 34 | on the walls of its container when the volume of its container is decreased |
35 | 35 | (and its quantity and absolute temperature remain unchanged). |
36 | 36 |
|
| 37 | + Related to: physics/ideal_gas_law.py |
| 38 | +
|
37 | 39 | Sources : |
38 | 40 | https://en.wikipedia.org/wiki/Boyle%27s_law |
39 | 41 | https://byjus.com/chemistry/boyles-law/ |
|
45 | 47 | def check_validity(values: dict[str, float]) -> None: |
46 | 48 | """ |
47 | 49 |
|
48 | | - Function takes dictionary as an input and returns nothing if the input |
49 | | - is valid |
| 50 | + Takes a dictionary as input and returns nothing if the input is valid |
50 | 51 |
|
51 | 52 | >>> check_validity({}) |
52 | 53 | Traceback (most recent call last): |
@@ -81,9 +82,8 @@ def check_validity(values: dict[str, float]) -> None: |
81 | 82 | def find_target_variable(values: dict[str, float]) -> str: |
82 | 83 | """ |
83 | 84 |
|
84 | | - Function is used to get the valid target variable whose value needs to be found |
85 | | - using Boyle's Law. |
86 | | - Function takes a dictionary as an input and returns a string |
| 85 | + Get the valid target variable whose value needs to be found using Boyle's Law. |
| 86 | + Takes a dictionary as input and returns a string |
87 | 87 |
|
88 | 88 | >>> find_target_variable({}) |
89 | 89 | Traceback (most recent call last): |
@@ -114,10 +114,10 @@ def find_target_variable(values: dict[str, float]) -> str: |
114 | 114 | def boyles_law(values: dict[str, float]) -> dict[str, str]: |
115 | 115 | """ |
116 | 116 |
|
117 | | - Function calculates the the unknown pressure or volume using Boyle's law. |
118 | | - Function takes a dictionary as an input. It contains values for respective |
| 117 | + Calculates the unknown pressure or volume using Boyle's law. |
| 118 | + Takes a dictionary as input that contains values for the respective |
119 | 119 | pressure and volumes and computes the required value and returns it as |
120 | | - output |
| 120 | + output. |
121 | 121 |
|
122 | 122 | >>> boyles_law({'p1':2,'v2':1}) |
123 | 123 | Traceback (most recent call last): |
|
0 commit comments