From b1b3c3586fcf59388c7aa27c96fbc4ae538fd391 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 6 Apr 2018 11:06:48 +0200 Subject: [PATCH] Test Jacobi polynomial evaluation. --- tests/base/polynomial_jacobi.cc | 50 ++ tests/base/polynomial_jacobi.output | 1081 +++++++++++++++++++++++++++ 2 files changed, 1131 insertions(+) create mode 100644 tests/base/polynomial_jacobi.cc create mode 100644 tests/base/polynomial_jacobi.output diff --git a/tests/base/polynomial_jacobi.cc b/tests/base/polynomial_jacobi.cc new file mode 100644 index 0000000000..47db01fc1d --- /dev/null +++ b/tests/base/polynomial_jacobi.cc @@ -0,0 +1,50 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// check jacobi_polynomial_value and jacobi_polynomial_roots + +#include "../tests.h" + +#include + +using namespace Polynomials; + + +int main() +{ + initlog(); + deallog.precision(10); + + for (int alpha = 0; alpha<3; ++alpha) + for (int beta = 0; beta<3; ++beta) + for (unsigned int degree=0; degree<40; ++degree) + { + deallog << "Jacobi_" << degree << "^(" << alpha << "," << beta << ") at 0.3: " + << jacobi_polynomial_value(degree, alpha, beta, 0.3) << std::endl; + + deallog << "Roots: "; + std::vector roots = jacobi_polynomial_roots(degree, alpha, beta); + + // assert that roots are increasing + for (unsigned int i=1; i roots[i-1], ExcInternalError()); + Assert(roots.size() == 0 || roots.front() > -1., ExcInternalError()); + Assert(roots.size() == 0 || roots.back() < 1., ExcInternalError()); + + for (unsigned int i=0; i