From 8c14a2b1f70a1521f2b38537098cb0f07eed2ff7 Mon Sep 17 00:00:00 2001 From: Ravi Kumar <119737193+ravi-ivar-7@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:05:32 +0530 Subject: [PATCH 1/4] 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. --- maths/rkf45.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/maths/rkf45.py b/maths/rkf45.py index 29fd447b61b8..c170206302bf 100644 --- a/maths/rkf45.py +++ b/maths/rkf45.py @@ -7,7 +7,7 @@ import numpy as np -def runge_futta_fehlberg_45( +def runge_kutta_fehlberg_45( func: Callable, x_initial: float, y_initial: float, @@ -33,33 +33,33 @@ def runge_futta_fehlberg_45( # exact value of y[1] is tan(0.2) = 0.2027100937470787 >>> def f(x, y): ... return 1 + y**2 - >>> y = runge_futta_fehlberg_45(f, 0, 0, 0.2, 1) + >>> y = runge_kutta_fehlberg_45(f, 0, 0, 0.2, 1) >>> y[1] 0.2027100937470787 >>> def f(x,y): ... return x - >>> y = runge_futta_fehlberg_45(f, -1, 0, 0.2, 0) + >>> y = runge_kutta_fehlberg_45(f, -1, 0, 0.2, 0) >>> y[1] -0.18000000000000002 - >>> y = runge_futta_fehlberg_45(5, 0, 0, 0.1, 1) + >>> y = runge_kutta_fehlberg_45(5, 0, 0, 0.1, 1) Traceback (most recent call last): ... TypeError: 'int' object is not callable >>> def f(x, y): ... return x + y - >>> y = runge_futta_fehlberg_45(f, 0, 0, 0.2, -1) + >>> y = runge_kutta_fehlberg_45(f, 0, 0, 0.2, -1) Traceback (most recent call last): ... ValueError: The final value x must be greater than initial value of x. >>> def f(x, y): ... return x - >>> y = runge_futta_fehlberg_45(f, -1, 0, -0.2, 0) + >>> y = runge_kutta_fehlberg_45(f, -1, 0, -0.2, 0) Traceback (most recent call last): ... ValueError: Step size must be positive. """ if x_initial >= x_final: - raise ValueError("The final value x must be greater than initial value of x.") + raise ValueError("The final value of x must be greater than initial value of x.") if step_size <= 0: raise ValueError("Step size must be positive.") From 2790b86a0e856e7ecc9fbaec9d5792a05a2038de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:44:15 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/rkf45.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maths/rkf45.py b/maths/rkf45.py index c170206302bf..c342c6e229e1 100644 --- a/maths/rkf45.py +++ b/maths/rkf45.py @@ -59,7 +59,9 @@ def runge_kutta_fehlberg_45( ValueError: Step size must be positive. """ if x_initial >= x_final: - raise ValueError("The final value of x must be greater than initial value of x.") + raise ValueError( + "The final value of x must be greater than initial value of x." + ) if step_size <= 0: raise ValueError("Step size must be positive.") From 68c7182b8eea79ff22df72745108ba0bd202ca89 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 15 Oct 2023 12:50:31 +0200 Subject: [PATCH 3/4] Rename rkf45.py to runge_kutta_fehlberg_45.py --- maths/{rkf45.py => runge_kutta_fehlberg_45.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename maths/{rkf45.py => runge_kutta_fehlberg_45.py} (100%) diff --git a/maths/rkf45.py b/maths/runge_kutta_fehlberg_45.py similarity index 100% rename from maths/rkf45.py rename to maths/runge_kutta_fehlberg_45.py From 6f0cf205bffe9076ffe56df0d031dfe4ac9d7ced Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 15 Oct 2023 12:52:43 +0200 Subject: [PATCH 4/4] Update runge_kutta_fehlberg_45.py --- maths/runge_kutta_fehlberg_45.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/runge_kutta_fehlberg_45.py b/maths/runge_kutta_fehlberg_45.py index c342c6e229e1..8181fe3015fc 100644 --- a/maths/runge_kutta_fehlberg_45.py +++ b/maths/runge_kutta_fehlberg_45.py @@ -50,7 +50,7 @@ def runge_kutta_fehlberg_45( >>> y = runge_kutta_fehlberg_45(f, 0, 0, 0.2, -1) Traceback (most recent call last): ... - ValueError: The final value x must be greater than initial value of x. + ValueError: The final value of x must be greater than initial value of x. >>> def f(x, y): ... return x >>> y = runge_kutta_fehlberg_45(f, -1, 0, -0.2, 0)