/// @file /// @brief Task2: function declarations #pragma once #include // std::function #include // std::vector /// @brief Creates a sequence of equidistant values in a given interval (inclusive). /// @param start Start of the interval /// @param end End of the interval /// @param N Number of values; assumption: N >= 2 /// @return Sequence of equidistant values in increasing order std::vector range(double start, double end, unsigned int N); /// @brief Evaluates a one-dimensional scalar function at the provided discrete locations /// @param values Sequence of discrete locations /// @param func Callable with a signature compatible with f(double) -> double /// @return Sequence of function values std::vector sample(std::vector values, std::function func); /// @brief Performs a numerical differentiation using a combined forward/center/backward difference scheme /// @param x Discrete sequence of locations; assumption: two or more values, ascending, and equally spaced /// @param y Discrete sequence of function values; assumption: same size as 'x' /// @return Sequence of function values of the numerical derivative std::vector numdiff(std::vector x, std::vector y); /// @brief Performs a numerical integration using the trapezoidal rule /// @param x Discrete sequence of locations; assumption: two or more values, ascending, and equally spaced /// @param y Discrete sequence of function values; assumption: same size as 'x' /// @param C Constant of integration /// @return Sequence of function values of the numerical antiderivative std::vector numint(std::vector x, std::vector y, double C);