From 0a8b4836dea5d68a71d89298d58aa1621331ffaf Mon Sep 17 00:00:00 2001 From: aryan26roy <50577809+aryan26roy@users.noreply.github.com> Date: Wed, 29 Jul 2020 01:38:42 +0530 Subject: [PATCH 1/7] Correcting the Gaussian Formula I have added the parenthesis around the 2*sigma^2 term. --- maths/gaussian.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/gaussian.py b/maths/gaussian.py index 5d5800e00989..657c08d2266b 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -50,7 +50,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(2523, mu=234234, sigma=3425) 0.0 """ - return 1 / sqrt(2 * pi * sigma ** 2) * exp(-((x - mu) ** 2) / 2 * sigma ** 2) + return 1 / sqrt(2 * pi * sigma ** 2) * exp(-((x - mu) ** 2) / (2 * sigma ** 2)) if __name__ == "__main__": From 43317946f6eed9798c4992b2c074488b408fc751 Mon Sep 17 00:00:00 2001 From: aryan26roy <50577809+aryan26roy@users.noreply.github.com> Date: Wed, 29 Jul 2020 02:28:55 +0530 Subject: [PATCH 2/7] Update gaussian.py --- maths/gaussian.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maths/gaussian.py b/maths/gaussian.py index 657c08d2266b..01015a2cdd55 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -15,6 +15,9 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(24) 3.342714441794458e-126 + + >>>gaussian(1,4,2) + 0.06475879783294587 Supports NumPy Arrays Use numpy.meshgrid with this to generate gaussian blur on images. From f58557863dafa83f050aeea548d705623b388c62 Mon Sep 17 00:00:00 2001 From: aryan26roy <50577809+aryan26roy@users.noreply.github.com> Date: Wed, 29 Jul 2020 17:13:06 +0530 Subject: [PATCH 3/7] Update gaussian.py --- maths/gaussian.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maths/gaussian.py b/maths/gaussian.py index 01015a2cdd55..2098990e14ce 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -16,8 +16,11 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(24) 3.342714441794458e-126 - >>>gaussian(1,4,2) + >>> gaussian(1,4,2) 0.06475879783294587 + + >>> gaussian(1,4,3) + 0.0806569081730478 Supports NumPy Arrays Use numpy.meshgrid with this to generate gaussian blur on images. From 5c5646df4f0e086b90d72460d0cbfdc9531f1b4c Mon Sep 17 00:00:00 2001 From: aryan26roy <50577809+aryan26roy@users.noreply.github.com> Date: Wed, 29 Jul 2020 21:15:18 +0530 Subject: [PATCH 4/7] Update gaussian.py --- maths/gaussian.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/gaussian.py b/maths/gaussian.py index 2098990e14ce..66e8a2813b58 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -21,7 +21,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(1,4,3) 0.0806569081730478 - + Supports NumPy Arrays Use numpy.meshgrid with this to generate gaussian blur on images. >>> import numpy as np From 5110ace6e9b94690d0ea78d1df37053633768b92 Mon Sep 17 00:00:00 2001 From: aryan26roy <50577809+aryan26roy@users.noreply.github.com> Date: Wed, 29 Jul 2020 21:22:50 +0530 Subject: [PATCH 5/7] Update gaussian.py --- maths/gaussian.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maths/gaussian.py b/maths/gaussian.py index 66e8a2813b58..745fc7e44f83 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -19,8 +19,8 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(1,4,2) 0.06475879783294587 - >>> gaussian(1,4,3) - 0.0806569081730478 + >>> gaussian(1,5,3) + 0.05467002489199788 Supports NumPy Arrays Use numpy.meshgrid with this to generate gaussian blur on images. From f78eee4c61fbe77a7cb140975f328c788506e924 Mon Sep 17 00:00:00 2001 From: aryan26roy <50577809+aryan26roy@users.noreply.github.com> Date: Wed, 29 Jul 2020 21:31:43 +0530 Subject: [PATCH 6/7] Update gaussian.py --- maths/gaussian.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maths/gaussian.py b/maths/gaussian.py index 745fc7e44f83..19249d6ffd86 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -15,13 +15,13 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(24) 3.342714441794458e-126 - + >>> gaussian(1,4,2) 0.06475879783294587 - + >>> gaussian(1,5,3) 0.05467002489199788 - + Supports NumPy Arrays Use numpy.meshgrid with this to generate gaussian blur on images. >>> import numpy as np From ed8a114b7fad48b48cadc910defec6e65e454299 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 29 Jul 2020 21:31:21 +0200 Subject: [PATCH 7/7] Update gaussian.py --- maths/gaussian.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/maths/gaussian.py b/maths/gaussian.py index 19249d6ffd86..a5dba50a927d 100644 --- a/maths/gaussian.py +++ b/maths/gaussian.py @@ -1,9 +1,5 @@ """ Reference: https://en.wikipedia.org/wiki/Gaussian_function - -python/black : True -python : 3.7.3 - """ from numpy import exp, pi, sqrt @@ -16,10 +12,10 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(24) 3.342714441794458e-126 - >>> gaussian(1,4,2) + >>> gaussian(1, 4, 2) 0.06475879783294587 - >>> gaussian(1,5,3) + >>> gaussian(1, 5, 3) 0.05467002489199788 Supports NumPy Arrays @@ -55,7 +51,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: >>> gaussian(2523, mu=234234, sigma=3425) 0.0 - """ + """ return 1 / sqrt(2 * pi * sigma ** 2) * exp(-((x - mu) ** 2) / (2 * sigma ** 2))