File indexing completed on 2024-05-12 03:47:52
0001 /* 0002 File : nsl_int.h 0003 Project : LabPlot 0004 Description : NSL numerical integration functions 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2016 Stefan Gerlach <stefan.gerlach@uni.kn> 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef NSL_INT_H 0011 #define NSL_INT_H 0012 0013 #include <stdlib.h> 0014 0015 #define NSL_INT_NETHOD_COUNT 4 0016 typedef enum { nsl_int_method_rectangle, nsl_int_method_trapezoid, nsl_int_method_simpson, nsl_int_method_simpson_3_8 } nsl_int_method_type; 0017 extern const char* nsl_int_method_name[]; 0018 0019 /* 0020 numerical integration for non-uniform samples 0021 rectangle rule (1-point) 0022 trapezoid rule (2-point) 0023 Simpson-1/3 rule (3-point) returns number of points, abs not supported yet 0024 Simpson-3/8 rule (4-point) returns number of points, abs not supported yet 0025 abs - 0:return mathem. area, 1: return absolute area 0026 */ 0027 int nsl_int_rectangle(const double* x, double* y, const size_t n, int abs); 0028 int nsl_int_trapezoid(const double* x, double* y, const size_t n, int abs); 0029 size_t nsl_int_simpson(double* x, double* y, const size_t n, int abs); 0030 size_t nsl_int_simpson_3_8(double* x, double* y, const size_t n, int abs); 0031 0032 #endif /* NSL_INT_H */