From bb1d79fed86866fd512ed107e4d737ba1b9ca8c7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:22:47 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/polynomials/legendre.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/maths/polynomials/legendre.py b/maths/polynomials/legendre.py index 8bd3fdb56..74865729f 100644 --- a/maths/polynomials/legendre.py +++ b/maths/polynomials/legendre.py @@ -16,7 +16,7 @@ def legendre(n: int) -> list[float]: Returns: list[float]: Coefficients of the polynomial in ascending order of powers. """ - p = (1 / (factorial(n) * (2 ** n))) * (Polynomial([-1, 0, 1]) ** n) + p = (1 / (factorial(n) * (2**n))) * (Polynomial([-1, 0, 1]) ** n) return p.deriv(n).coef.tolist() @@ -42,12 +42,21 @@ def test_legendre_1(): def test_legendre_2(): """Test the 2nd Legendre polynomial.""" - assert legendre(2) == [-0.5, 0.0, 1.5], "The 2nd Legendre polynomial should be [-0.5, 0.0, 1.5]" + assert legendre(2) == [ + -0.5, + 0.0, + 1.5, + ], "The 2nd Legendre polynomial should be [-0.5, 0.0, 1.5]" def test_legendre_3(): """Test the 3rd Legendre polynomial.""" - 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]" + 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]" def test_legendre_4(): @@ -56,5 +65,5 @@ def test_legendre_4(): "The 4th Legendre polynomial should be [0.375, 0.0, -3.75, 0.0, 4.375]" -if __name__ == '__main__': +if __name__ == "__main__": pytest.main()