TU-Programmieren_2/exercise3/task3.hpp
2025-04-09 10:22:44 +02:00

23 lines
938 B
C++

/// @file
/// @brief Task3: function declarations
#pragma once
#include <filesystem> // std::filesystem::path
#include <functional> // std::function
/// @brief This function
/// - samples a one-dimensional scalar function (f) in a provided interval and resolution,
// - approximates its derivative (df) and antiderivative (F) numerically, and
/// - produces a csv-file holding the discrete values in this form:
/// - csv-column layout: x, f, F, df
/// @param filepath
/// @param del Delimiter
/// @param comment Character designating a line as a comment
/// @param func Callable with a signature compatible with f(double) -> double
/// @param start Start of the interval
/// @param end End of the interval
/// @param N Number of values; assumption: N >= 2
void sample_to_csv(std::filesystem::path filepath, char del, char comments, std::function<double(double)> func,
double start, double end, unsigned int N);