aboutsummaryrefslogtreecommitdiffstats
path: root/src/integral.c
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov2070@gmail.com>2024-10-04 18:15:00 +0300
committerjustanothercatgirl <sotov2070@gmail.com>2024-10-04 20:14:24 +0300
commit7cf056d737ac5ad9d819220c855a53847185a327 (patch)
tree15a26d09d3f20fc7e318d3991962c688194f4d1a /src/integral.c
parentaa0d37540f5bc4bb6327b43c7213b46d0e261cf0 (diff)
Finished homework
Diffstat (limited to 'src/integral.c')
-rw-r--r--src/integral.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/integral.c b/src/integral.c
index d2ae11f..f791803 100644
--- a/src/integral.c
+++ b/src/integral.c
@@ -5,8 +5,7 @@
double accrc = 10000.0;
// интеграл прямоугольниками
-double int_rect(f_t f, double a, double b) {
- // f(x + dx/2) * dx
+double int_rect(func_t f, double a, double b) {
const double dx = (b-a) / accrc;
const double dx_2 = dx / 2.0;
double sum = 0.0;
@@ -16,8 +15,7 @@ double int_rect(f_t f, double a, double b) {
}
// интеграл трапециями
-double int_trap(f_t f, double a, double b) {
- // ( f(x) + f(x+dx) )/2 * dx
+double int_trap(func_t f, double a, double b) {
const double dx = (b-a) / accrc;
double sum = 0.0;
for (double i = a; i < b; i += dx)
@@ -26,7 +24,7 @@ double int_trap(f_t f, double a, double b) {
}
// интегрирование параболами
-double int_simp(f_t f, double a, double b) {
+double int_simp(func_t f, double a, double b) {
const double dx = (b-a) / accrc;
const double dx_2 = dx / 2;
const double dx_6 = dx / 6;