| | |
| | | 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 |
| | | |
| | | |
| | |
| | | |
| | | (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 |
| | | |