TDMS
Time Domain Maxwell Solver
|
Tests of the numerical differentiation/FFT functions. More...
#include "numerical_derivative.h"
#include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp>
#include <fftw3.h>
#include <spdlog/spdlog.h>
#include "unit_test_utils.h"
Functions | |
TEST_CASE ("Element-by-element multiplication of array of complex numbers") | |
Test complex number multilication (internally used for numerical derivative). | |
TEST_CASE ("Numerical derivative") | |
Test the numerical derivative function itself. | |
Variables | |
const int | REAL = 0 |
const int | IMAG = 1 |
Tests of the numerical differentiation/FFT functions.
TEST_CASE | ( | "Numerical derivative" | ) |
Test the numerical derivative function itself.
The cosine should have negative sine as a derivative. This test involves a bit of trickery because the normalisation is arbitrary. So the ratio of the expected function (-sinθ) and the output (k dcosθ / dx) should be a constant (k) modulo the places where either function is a zero. So calculate the mean ratio of the expected to the output, and check the ratio ~= it's mean value.