From 11beed44c78847c91b25d8b4c9d8b3c7ada8de35 Mon Sep 17 00:00:00 2001
From: hbui <hong-phuc.bui@htwsaar.de>
Date: Thu, 25 Jul 2024 03:01:12 +0200
Subject: [PATCH] Auswahl der Methode is eindeutig gestaltet
---
num-int/src/numint/riemann_sum.py | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/num-int/src/numint/riemann_sum.py b/num-int/src/numint/riemann_sum.py
index 250f073..f0b997d 100644
--- a/num-int/src/numint/riemann_sum.py
+++ b/num-int/src/numint/riemann_sum.py
@@ -17,7 +17,16 @@
pass
-def numint_epsilon(f:Callable[[float], float], a: float, b: float, epsilon: float = 1e-3):
+def numint_epsilon(f: Callable[[float], float], a: float, b: float, epsilon: float = 1e-3):
+ """
+ a not very stupid implementation of Riemann sum for a function,
+ left sum and right sum are calculated as long as their difference less than the given epsilon.
+ :param f:
+ :param a:
+ :param b:
+ :param epsilon:
+ :return:
+ """
dx = b - a
x = [a, b] # debug only
y = [f(a), f(b)]
@@ -36,7 +45,15 @@
return x, y, s_left, s_right, n
-def numint_section(f:Callable[[float], float], a: float, b: float, section_count: int = 8):
+def numint_section(f: Callable[[float], float], a: float, b: float, section_count: int = 8):
+ """
+ a stupid implementation of Riemann sum for a function with a fixed number of sections in interval [a, b]
+ :param f:
+ :param a:
+ :param b:
+ :param section_count:
+ :return:
+ """
dx = b - a
x = [a, b]
y = [f(a), f(b)]
--
Gitblit v1.10.0