@@ -16,7 +16,7 @@ def legendre(n: int) -> list[float]:
16
16
Returns:
17
17
list[float]: Coefficients of the polynomial in ascending order of powers.
18
18
"""
19
- p = (1 / (factorial (n ) * (2 ** n ))) * (Polynomial ([- 1 , 0 , 1 ]) ** n )
19
+ p = (1 / (factorial (n ) * (2 ** n ))) * (Polynomial ([- 1 , 0 , 1 ]) ** n )
20
20
return p .deriv (n ).coef .tolist ()
21
21
22
22
@@ -42,12 +42,21 @@ def test_legendre_1():
42
42
43
43
def test_legendre_2 ():
44
44
"""Test the 2nd Legendre polynomial."""
45
- assert legendre (2 ) == [- 0.5 , 0.0 , 1.5 ], "The 2nd Legendre polynomial should be [-0.5, 0.0, 1.5]"
45
+ assert legendre (2 ) == [
46
+ - 0.5 ,
47
+ 0.0 ,
48
+ 1.5 ,
49
+ ], "The 2nd Legendre polynomial should be [-0.5, 0.0, 1.5]"
46
50
47
51
48
52
def test_legendre_3 ():
49
53
"""Test the 3rd Legendre polynomial."""
50
- assert legendre (3 ) == [0.0 , - 1.5 , 0.0 , 2.5 ], "The 3rd Legendre polynomial should be [0.0, -1.5, 0.0, 2.5]"
54
+ assert legendre (3 ) == [
55
+ 0.0 ,
56
+ - 1.5 ,
57
+ 0.0 ,
58
+ 2.5 ,
59
+ ], "The 3rd Legendre polynomial should be [0.0, -1.5, 0.0, 2.5]"
51
60
52
61
53
62
def test_legendre_4 ():
@@ -56,5 +65,5 @@ def test_legendre_4():
56
65
"The 4th Legendre polynomial should be [0.375, 0.0, -3.75, 0.0, 4.375]"
57
66
58
67
59
- if __name__ == ' __main__' :
68
+ if __name__ == " __main__" :
60
69
pytest .main ()
0 commit comments