Skip to content

Commit bb1d79f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 08d1f15 commit bb1d79f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

maths/polynomials/legendre.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def legendre(n: int) -> list[float]:
1616
Returns:
1717
list[float]: Coefficients of the polynomial in ascending order of powers.
1818
"""
19-
p = (1 / (factorial(n) * (2 ** n))) * (Polynomial([-1, 0, 1]) ** n)
19+
p = (1 / (factorial(n) * (2**n))) * (Polynomial([-1, 0, 1]) ** n)
2020
return p.deriv(n).coef.tolist()
2121

2222

@@ -42,12 +42,21 @@ def test_legendre_1():
4242

4343
def test_legendre_2():
4444
"""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]"
4650

4751

4852
def test_legendre_3():
4953
"""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]"
5160

5261

5362
def test_legendre_4():
@@ -56,5 +65,5 @@ def test_legendre_4():
5665
"The 4th Legendre polynomial should be [0.375, 0.0, -3.75, 0.0, 4.375]"
5766

5867

59-
if __name__ == '__main__':
68+
if __name__ == "__main__":
6069
pytest.main()

0 commit comments

Comments
 (0)