Skip to content

Commit c5a24b2

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

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

maths/numerical_analysis/adams_bashforth.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def __init__(
1919
step_size: float,
2020
x_final: float,
2121
) -> None:
22-
2322
self.func = func
2423
self.x_initials = x_initials
2524
self.y_initials = y_initials
@@ -34,7 +33,10 @@ def __init__(
3433
if step_size <= 0:
3534
raise ValueError("Step size must be positive.")
3635

37-
if not all(round(x1 - x0,10) == step_size for x0, x1 in zip(x_initials, x_initials[1:])):
36+
if not all(
37+
round(x1 - x0, 10) == step_size
38+
for x0, x1 in zip(x_initials, x_initials[1:])
39+
):
3840
raise ValueError("x-values must be equally spaced according to step size.")
3941

4042
"""
@@ -70,7 +72,6 @@ def __init__(
7072
"""
7173

7274
def step_2(self) -> np.ndarray:
73-
7475
"""
7576
>>> def f(x, y):
7677
... return x
@@ -106,7 +107,6 @@ def step_2(self) -> np.ndarray:
106107
return y
107108

108109
def step_3(self) -> np.ndarray:
109-
110110
"""
111111
>>> def f(x, y):
112112
... return x + y
@@ -146,7 +146,6 @@ def step_3(self) -> np.ndarray:
146146
return y
147147

148148
def step_4(self) -> np.ndarray:
149-
150149
"""
151150
>>> def f(x,y):
152151
... return x + y
@@ -155,7 +154,7 @@ def step_4(self) -> np.ndarray:
155154
0.30699999999999994
156155
>>> y[5]
157156
0.5771083333333333
158-
157+
159158
>>> def f(x, y):
160159
... return (x -y)/2
161160
>>> AdamsBashforth(f, [0, 0.2, 0.4], [0, 0, 0.04], 0.2, 1).step_4()
@@ -192,7 +191,6 @@ def step_4(self) -> np.ndarray:
192191
return y
193192

194193
def step_5(self) -> np.ndarray:
195-
196194
"""
197195
>>> def f(x,y):
198196
... return x + y

0 commit comments

Comments
 (0)