From f12ecb67472aa2453d3b1b3fb68e4eb9521aee77 Mon Sep 17 00:00:00 2001 From: hbui <hong-phuc.bui@htwsaar.de> Date: Sun, 21 Jul 2024 13:41:27 +0200 Subject: [PATCH] gui ok --- num-int/src/numint/main.py | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/num-int/src/numint/main.py b/num-int/src/numint/main.py index 0353729..bcfa605 100644 --- a/num-int/src/numint/main.py +++ b/num-int/src/numint/main.py @@ -1,7 +1,7 @@ import sys from matplotlib import pyplot as plt -from numint.RiemannSum import numint +from numint.riemann_sum import numint_epsilon from numint.input_parser import parse_function, parse_value @@ -10,11 +10,15 @@ (a, b) = (parse_value(start), parse_value(end)) eps = parse_value(epsilon) - (x, y, l, r, n) = numint(f, a, b, eps) - # print(l, r, n) - plt.step(x, y, label="x^3") - plt.step(x, y, where="post", label="x^3") - plt.plot(x, y, color="gray", alpha=0.3) + (x, y, l, r, n) = numint_epsilon(f, a, b, eps) + fig, ax = plt.subplots() + ax.stairs(y[1:], x, baseline=0, fill=True, alpha=1,label=function_expr) + ax.stairs(y[0:-1], x, baseline=0, fill=True, color="orange", alpha=0.5, label=function_expr) + #ax.step(x, y, label=function_expr) + #ax.step(x, y, where="post", label=function_expr) + + ax.plot(x, y, color="black") + plt.show() pass -- Gitblit v1.10.0-SNAPSHOT