Skip to content

Commit c2a1c3f

Browse files
ravi-ivar-7pre-commit-ci[bot]cclauss
authored andcommitted
Corrected typo in function name and doctests. rkf45.py (TheAlgorithms#10518)
* Corrected typo in function name and doctests. rkf45.py There was a mistake in name of function (runge_futta_fehlberg instead of runge_kutta_fehlberg) . I have corrected this in function name and also doctest. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Rename rkf45.py to runge_kutta_fehlberg_45.py * Update runge_kutta_fehlberg_45.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <[email protected]>
1 parent 2069dd1 commit c2a1c3f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Diff for: maths/rkf45.py renamed to maths/runge_kutta_fehlberg_45.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88

99

10-
def runge_futta_fehlberg_45(
10+
def runge_kutta_fehlberg_45(
1111
func: Callable,
1212
x_initial: float,
1313
y_initial: float,
@@ -33,33 +33,35 @@ def runge_futta_fehlberg_45(
3333
# exact value of y[1] is tan(0.2) = 0.2027100937470787
3434
>>> def f(x, y):
3535
... return 1 + y**2
36-
>>> y = runge_futta_fehlberg_45(f, 0, 0, 0.2, 1)
36+
>>> y = runge_kutta_fehlberg_45(f, 0, 0, 0.2, 1)
3737
>>> y[1]
3838
0.2027100937470787
3939
>>> def f(x,y):
4040
... return x
41-
>>> y = runge_futta_fehlberg_45(f, -1, 0, 0.2, 0)
41+
>>> y = runge_kutta_fehlberg_45(f, -1, 0, 0.2, 0)
4242
>>> y[1]
4343
-0.18000000000000002
44-
>>> y = runge_futta_fehlberg_45(5, 0, 0, 0.1, 1)
44+
>>> y = runge_kutta_fehlberg_45(5, 0, 0, 0.1, 1)
4545
Traceback (most recent call last):
4646
...
4747
TypeError: 'int' object is not callable
4848
>>> def f(x, y):
4949
... return x + y
50-
>>> y = runge_futta_fehlberg_45(f, 0, 0, 0.2, -1)
50+
>>> y = runge_kutta_fehlberg_45(f, 0, 0, 0.2, -1)
5151
Traceback (most recent call last):
5252
...
53-
ValueError: The final value x must be greater than initial value of x.
53+
ValueError: The final value of x must be greater than initial value of x.
5454
>>> def f(x, y):
5555
... return x
56-
>>> y = runge_futta_fehlberg_45(f, -1, 0, -0.2, 0)
56+
>>> y = runge_kutta_fehlberg_45(f, -1, 0, -0.2, 0)
5757
Traceback (most recent call last):
5858
...
5959
ValueError: Step size must be positive.
6060
"""
6161
if x_initial >= x_final:
62-
raise ValueError("The final value x must be greater than initial value of x.")
62+
raise ValueError(
63+
"The final value of x must be greater than initial value of x."
64+
)
6365

6466
if step_size <= 0:
6567
raise ValueError("Step size must be positive.")

0 commit comments

Comments
 (0)