Files
AutoC/integrate.h

25 lines
608 B
C
Raw Normal View History

2026-01-27 15:19:22 +01:00
#ifndef INTEGRATE_H_
#define INTEGRATE_H_
#include <stddef.h>
typedef float (*integrand_f)(float x, void *ctx);
typedef enum
{
INTEG_OK = 0,
INTEG_ERR_BAD_ARGS = -1,
INTEG_ERR_N_EVEN_REQUIRED = -2
} integ_status_t;
integ_status_t midpoint(integrand_f f, void *ctx, float a, float b, unsigned n,
float *out);
integ_status_t trapezoid(integrand_f f, void *ctx, float a, float b, unsigned n,
float *out);
integ_status_t simpson(integrand_f f, void *ctx, float a, float b, unsigned n,
float *out);
#endif // INTEGRATE_H_