11"""
2- Magnetic flux (Φ) is a scalar quantity that measures the number of magnetic field lines (B)
3- that pass through a closed area (A). Furthermore, the magnetic flux depends on the angle
4- formed between the magnetic field and the normal line (N) in area A. Check out the formula
5- used to calculate this flux:
2+ ________________________________________________________________________________________
3+ Magnetic flux (Φ) is a scalar quantity that measures the number of magnetic field
4+ lines (B) that pass through a closed area (A). Furthermore, the magnetic flux depends
5+ on the angle formed between the magnetic field and the normal line (N) in area A.
6+ Check out the formula used to calculate this flux:
67 ------------
78 | Φ = B.A.cos(θ) |
89 ------------
1516(Description adapted from https://en.wikipedia.org/wiki/Ideal_gas_law )
1617"""
1718
18- from math import cos , radians as deg_to_rad
19-
19+ from math import cos , radians
2020
2121def check_args (magnetic_field : float , area : float , angle : float ) -> None :
2222 """
@@ -50,8 +50,8 @@ def magnetic_flux(magnetic_field: float, area: float, angle: float) -> float:
5050 """
5151 >>> magnetic_flux(50.0, 2, 0.0)
5252 100.0
53- >>> magnetic_flux(1.5, 3.0 , 60.0)
54- 2.25
53+ >>> magnetic_flux(50, 2 , 60.0)
54+ 50.0
5555 >>> magnetic_flux(0.5, 4.0, 90.0)
5656 0.0
5757 >>> magnetic_flux(1, 2.0, 180.0)
@@ -67,8 +67,8 @@ def magnetic_flux(magnetic_field: float, area: float, angle: float) -> float:
6767 ... ValueError: Invalid area. Should be a positive number.
6868 """
6969 check_args (magnetic_field , area , angle )
70- radians = deg_to_rad (angle )
71- return magnetic_field * area * cos (radians )
70+ rad = radians (angle )
71+ return magnetic_field * area * cos (rad )
7272
7373
7474if __name__ == "__main__" :
0 commit comments