From d492b33f0edcc9af9dea83f5bf266f6571db3f16 Mon Sep 17 00:00:00 2001
From: Chichi Lalescu <chichilalescu@gmail.com>
Date: Tue, 9 May 2017 22:18:12 +0200
Subject: [PATCH] add interpolations with more neighbours

---
 bfps/cpp/spline_n10.cpp | 414 ++++++++++++++++++++++++++++++++++++++++
 bfps/cpp/spline_n10.hpp |  38 ++++
 bfps/cpp/spline_n7.cpp  | 324 +++++++++++++++++++++++++++++++
 bfps/cpp/spline_n7.hpp  |  38 ++++
 bfps/cpp/spline_n8.cpp  | 354 ++++++++++++++++++++++++++++++++++
 bfps/cpp/spline_n8.hpp  |  38 ++++
 bfps/cpp/spline_n9.cpp  | 384 +++++++++++++++++++++++++++++++++++++
 bfps/cpp/spline_n9.hpp  |  38 ++++
 8 files changed, 1628 insertions(+)
 create mode 100644 bfps/cpp/spline_n10.cpp
 create mode 100644 bfps/cpp/spline_n10.hpp
 create mode 100644 bfps/cpp/spline_n7.cpp
 create mode 100644 bfps/cpp/spline_n7.hpp
 create mode 100644 bfps/cpp/spline_n8.cpp
 create mode 100644 bfps/cpp/spline_n8.hpp
 create mode 100644 bfps/cpp/spline_n9.cpp
 create mode 100644 bfps/cpp/spline_n9.hpp

diff --git a/bfps/cpp/spline_n10.cpp b/bfps/cpp/spline_n10.cpp
new file mode 100644
index 00000000..17126639
--- /dev/null
+++ b/bfps/cpp/spline_n10.cpp
@@ -0,0 +1,414 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2015 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#include "spline_n10.hpp"
+#include <cmath>
+
+void beta_n10_m0(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = 0;
+        poly_val[10] = -x + 1;
+        poly_val[11] = x;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        poly_val[18] = 0;
+        poly_val[19] = 0;
+        poly_val[20] = 0;
+        poly_val[21] = 0;
+        break;
+    case 1:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = 0;
+        poly_val[10] = -1;
+        poly_val[11] = 1;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        poly_val[18] = 0;
+        poly_val[19] = 0;
+        poly_val[20] = 0;
+        poly_val[21] = 0;
+        break;
+    case 2:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = 0;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        poly_val[18] = 0;
+        poly_val[19] = 0;
+        poly_val[20] = 0;
+        poly_val[21] = 0;
+        break;
+    }
+}
+void beta_n10_m1(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*((1.0L/1847560.0L)*x - 1.0L/923780.0L) + 1.0L/1847560.0L);
+        poly_val[1] = x*(x*(-191.0L/16628040.0L*x + 23.0L/978120.0L) - 5.0L/415701.0L);
+        poly_val[2] = x*(x*((775.0L/6651216.0L)*x - 815.0L/3325608.0L) + 5.0L/38896.0L);
+        poly_val[3] = x*(x*(-205.0L/272272.0L*x + 445.0L/272272.0L) - 15.0L/17017.0L);
+        poly_val[4] = x*(x*((475.0L/136136.0L)*x - 535.0L/68068.0L) + 5.0L/1144.0L);
+        poly_val[5] = x*(x*(-71.0L/5720.0L*x + 167.0L/5720.0L) - 12.0L/715.0L);
+        poly_val[6] = x*(x*((51.0L/1430.0L)*x - 63.0L/715.0L) + 15.0L/286.0L);
+        poly_val[7] = x*(x*(-25.0L/286.0L*x + 5.0L/22.0L) - 20.0L/143.0L);
+        poly_val[8] = x*(x*((115.0L/572.0L)*x - 155.0L/286.0L) + 15.0L/44.0L);
+        poly_val[9] = x*(x*(-25.0L/44.0L*x + 65.0L/44.0L) - 10.0L/11.0L);
+        poly_val[10] = pow(x, 2)*((12.0L/11.0L)*x - 23.0L/11.0L) + 1;
+        poly_val[11] = x*(x*(-12.0L/11.0L*x + 13.0L/11.0L) + 10.0L/11.0L);
+        poly_val[12] = x*(x*((25.0L/44.0L)*x - 5.0L/22.0L) - 15.0L/44.0L);
+        poly_val[13] = x*(x*(-115.0L/572.0L*x + 35.0L/572.0L) + 20.0L/143.0L);
+        poly_val[14] = x*(x*((25.0L/286.0L)*x - 5.0L/143.0L) - 15.0L/286.0L);
+        poly_val[15] = x*(x*(-51.0L/1430.0L*x + 27.0L/1430.0L) + 12.0L/715.0L);
+        poly_val[16] = x*(x*((71.0L/5720.0L)*x - 23.0L/2860.0L) - 5.0L/1144.0L);
+        poly_val[17] = x*(x*(-475.0L/136136.0L*x + 355.0L/136136.0L) + 15.0L/17017.0L);
+        poly_val[18] = x*(x*((205.0L/272272.0L)*x - 5.0L/8008.0L) - 5.0L/38896.0L);
+        poly_val[19] = x*(x*(-775.0L/6651216.0L*x + 695.0L/6651216.0L) + 5.0L/415701.0L);
+        poly_val[20] = x*(x*((191.0L/16628040.0L)*x - 7.0L/639540.0L) - 1.0L/1847560.0L);
+        poly_val[21] = pow(x, 2)*(-1.0L/1847560.0L*x + 1.0L/1847560.0L);
+        break;
+    case 1:
+        poly_val[0] = x*((3.0L/1847560.0L)*x - 1.0L/461890.0L) + 1.0L/1847560.0L;
+        poly_val[1] = x*(-191.0L/5542680.0L*x + 23.0L/489060.0L) - 5.0L/415701.0L;
+        poly_val[2] = x*((775.0L/2217072.0L)*x - 815.0L/1662804.0L) + 5.0L/38896.0L;
+        poly_val[3] = x*(-615.0L/272272.0L*x + 445.0L/136136.0L) - 15.0L/17017.0L;
+        poly_val[4] = x*((1425.0L/136136.0L)*x - 535.0L/34034.0L) + 5.0L/1144.0L;
+        poly_val[5] = x*(-213.0L/5720.0L*x + 167.0L/2860.0L) - 12.0L/715.0L;
+        poly_val[6] = x*((153.0L/1430.0L)*x - 126.0L/715.0L) + 15.0L/286.0L;
+        poly_val[7] = x*(-75.0L/286.0L*x + 5.0L/11.0L) - 20.0L/143.0L;
+        poly_val[8] = x*((345.0L/572.0L)*x - 155.0L/143.0L) + 15.0L/44.0L;
+        poly_val[9] = x*(-75.0L/44.0L*x + 65.0L/22.0L) - 10.0L/11.0L;
+        poly_val[10] = x*((36.0L/11.0L)*x - 46.0L/11.0L);
+        poly_val[11] = x*(-36.0L/11.0L*x + 26.0L/11.0L) + 10.0L/11.0L;
+        poly_val[12] = x*((75.0L/44.0L)*x - 5.0L/11.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(-345.0L/572.0L*x + 35.0L/286.0L) + 20.0L/143.0L;
+        poly_val[14] = x*((75.0L/286.0L)*x - 10.0L/143.0L) - 15.0L/286.0L;
+        poly_val[15] = x*(-153.0L/1430.0L*x + 27.0L/715.0L) + 12.0L/715.0L;
+        poly_val[16] = x*((213.0L/5720.0L)*x - 23.0L/1430.0L) - 5.0L/1144.0L;
+        poly_val[17] = x*(-1425.0L/136136.0L*x + 355.0L/68068.0L) + 15.0L/17017.0L;
+        poly_val[18] = x*((615.0L/272272.0L)*x - 5.0L/4004.0L) - 5.0L/38896.0L;
+        poly_val[19] = x*(-775.0L/2217072.0L*x + 695.0L/3325608.0L) + 5.0L/415701.0L;
+        poly_val[20] = x*((191.0L/5542680.0L)*x - 7.0L/319770.0L) - 1.0L/1847560.0L;
+        poly_val[21] = x*(-3.0L/1847560.0L*x + 1.0L/923780.0L);
+        break;
+    case 2:
+        poly_val[0] = (3.0L/923780.0L)*x - 1.0L/461890.0L;
+        poly_val[1] = -191.0L/2771340.0L*x + 23.0L/489060.0L;
+        poly_val[2] = (775.0L/1108536.0L)*x - 815.0L/1662804.0L;
+        poly_val[3] = -615.0L/136136.0L*x + 445.0L/136136.0L;
+        poly_val[4] = (1425.0L/68068.0L)*x - 535.0L/34034.0L;
+        poly_val[5] = -213.0L/2860.0L*x + 167.0L/2860.0L;
+        poly_val[6] = (153.0L/715.0L)*x - 126.0L/715.0L;
+        poly_val[7] = -75.0L/143.0L*x + 5.0L/11.0L;
+        poly_val[8] = (345.0L/286.0L)*x - 155.0L/143.0L;
+        poly_val[9] = -75.0L/22.0L*x + 65.0L/22.0L;
+        poly_val[10] = (72.0L/11.0L)*x - 46.0L/11.0L;
+        poly_val[11] = -72.0L/11.0L*x + 26.0L/11.0L;
+        poly_val[12] = (75.0L/22.0L)*x - 5.0L/11.0L;
+        poly_val[13] = -345.0L/286.0L*x + 35.0L/286.0L;
+        poly_val[14] = (75.0L/143.0L)*x - 10.0L/143.0L;
+        poly_val[15] = -153.0L/715.0L*x + 27.0L/715.0L;
+        poly_val[16] = (213.0L/2860.0L)*x - 23.0L/1430.0L;
+        poly_val[17] = -1425.0L/68068.0L*x + 355.0L/68068.0L;
+        poly_val[18] = (615.0L/136136.0L)*x - 5.0L/4004.0L;
+        poly_val[19] = -775.0L/1108536.0L*x + 695.0L/3325608.0L;
+        poly_val[20] = (191.0L/2771340.0L)*x - 7.0L/319770.0L;
+        poly_val[21] = -3.0L/923780.0L*x + 1.0L/923780.0L;
+        break;
+    }
+}
+void beta_n10_m2(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(-29.0L/18475600.0L*x + 7.0L/1679600.0L) - 3.0L/972400.0L) - 1.0L/18475600.0L) + 1.0L/1847560.0L);
+        poly_val[1] = x*(x*(x*(x*((4499.0L/136047600.0L)*x - 5507.0L/62355150.0L) + 32893.0L/498841200.0L) + 5.0L/3741309.0L) - 5.0L/415701.0L);
+        poly_val[2] = x*(x*(x*(x*(-159065.0L/478887552.0L*x + 427795.0L/478887552.0L) - 24815.0L/36837504.0L) - 5.0L/311168.0L) + 5.0L/38896.0L);
+        poly_val[3] = x*(x*(x*(x*((32275.0L/15247232.0L)*x - 2575.0L/448448.0L) + 66795.0L/15247232.0L) + 15.0L/119119.0L) - 15.0L/17017.0L);
+        poly_val[4] = x*(x*(x*(x*(-54965.0L/5717712.0L*x + 2955.0L/112112.0L) - 38855.0L/1905904.0L) - 5.0L/6864.0L) + 5.0L/1144.0L);
+        poly_val[5] = x*(x*(x*(x*((5689.0L/171600.0L)*x - 3953.0L/42900.0L) + 12427.0L/171600.0L) + 12.0L/3575.0L) - 12.0L/715.0L);
+        poly_val[6] = x*(x*(x*(x*(-2589.0L/28600.0L*x + 7323.0L/28600.0L) - 5859.0L/28600.0L) - 15.0L/1144.0L) + 15.0L/286.0L);
+        poly_val[7] = x*(x*(x*(x*((695.0L/3432.0L)*x - 335.0L/572.0L) + 545.0L/1144.0L) + 20.0L/429.0L) - 20.0L/143.0L);
+        poly_val[8] = x*(x*(x*(x*(-1325.0L/3432.0L*x + 3925.0L/3432.0L) - 245.0L/264.0L) - 15.0L/88.0L) + 15.0L/44.0L);
+        poly_val[9] = x*(x*(x*(x*((5.0L/8.0L)*x - 20.0L/11.0L) + 105.0L/88.0L) + 10.0L/11.0L) - 10.0L/11.0L);
+        poly_val[10] = pow(x, 2)*(x*(x*(-11370461.0L/13970880.0L*x + 10100381.0L/4656960.0L) - 3749981.0L/4656960.0L) - 1968329.0L/1270080.0L) + 1;
+        poly_val[11] = x*(x*(x*(x*((11370461.0L/13970880.0L)*x - 1206871.0L/635040.0L) + 3749981.0L/13970880.0L) + 10.0L/11.0L) + 10.0L/11.0L);
+        poly_val[12] = x*(x*(x*(x*(-5.0L/8.0L*x + 115.0L/88.0L) - 15.0L/88.0L) - 15.0L/88.0L) - 15.0L/44.0L);
+        poly_val[13] = x*(x*(x*(x*((1325.0L/3432.0L)*x - 225.0L/286.0L) + 245.0L/1144.0L) + 20.0L/429.0L) + 20.0L/143.0L);
+        poly_val[14] = x*(x*(x*(x*(-695.0L/3432.0L*x + 1465.0L/3432.0L) - 545.0L/3432.0L) - 15.0L/1144.0L) - 15.0L/286.0L);
+        poly_val[15] = x*(x*(x*(x*((2589.0L/28600.0L)*x - 2811.0L/14300.0L) + 189.0L/2200.0L) + 12.0L/3575.0L) + 12.0L/715.0L);
+        poly_val[16] = x*(x*(x*(x*(-5689.0L/171600.0L*x + 4211.0L/57200.0L) - 2023.0L/57200.0L) - 5.0L/6864.0L) - 5.0L/1144.0L);
+        poly_val[17] = x*(x*(x*(x*((54965.0L/5717712.0L)*x - 15515.0L/714714.0L) + 63395.0L/5717712.0L) + 15.0L/119119.0L) + 15.0L/17017.0L);
+        poly_val[18] = x*(x*(x*(x*(-32275.0L/15247232.0L*x + 73825.0L/15247232.0L) - 39345.0L/15247232.0L) - 5.0L/311168.0L) - 5.0L/38896.0L);
+        poly_val[19] = x*(x*(x*(x*((159065.0L/478887552.0L)*x - 61255.0L/79814592.0L) + 3545.0L/8401536.0L) + 5.0L/3741309.0L) + 5.0L/415701.0L);
+        poly_val[20] = x*(x*(x*(x*(-4499.0L/136047600.0L*x + 6781.0L/88030800.0L) - 64897.0L/1496523600.0L) - 1.0L/18475600.0L) - 1.0L/1847560.0L);
+        poly_val[21] = pow(x, 3)*(x*((29.0L/18475600.0L)*x - 1.0L/271700.0L) + 3.0L/1421200.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(-29.0L/3695120.0L*x + 7.0L/419900.0L) - 9.0L/972400.0L) - 1.0L/9237800.0L) + 1.0L/1847560.0L;
+        poly_val[1] = x*(x*(x*((4499.0L/27209520.0L)*x - 11014.0L/31177575.0L) + 32893.0L/166280400.0L) + 10.0L/3741309.0L) - 5.0L/415701.0L;
+        poly_val[2] = x*(x*(x*(-795325.0L/478887552.0L*x + 427795.0L/119721888.0L) - 24815.0L/12279168.0L) - 5.0L/155584.0L) + 5.0L/38896.0L;
+        poly_val[3] = x*(x*(x*((161375.0L/15247232.0L)*x - 2575.0L/112112.0L) + 200385.0L/15247232.0L) + 30.0L/119119.0L) - 15.0L/17017.0L;
+        poly_val[4] = x*(x*(x*(-274825.0L/5717712.0L*x + 2955.0L/28028.0L) - 116565.0L/1905904.0L) - 5.0L/3432.0L) + 5.0L/1144.0L;
+        poly_val[5] = x*(x*(x*((5689.0L/34320.0L)*x - 3953.0L/10725.0L) + 12427.0L/57200.0L) + 24.0L/3575.0L) - 12.0L/715.0L;
+        poly_val[6] = x*(x*(x*(-2589.0L/5720.0L*x + 7323.0L/7150.0L) - 17577.0L/28600.0L) - 15.0L/572.0L) + 15.0L/286.0L;
+        poly_val[7] = x*(x*(x*((3475.0L/3432.0L)*x - 335.0L/143.0L) + 1635.0L/1144.0L) + 40.0L/429.0L) - 20.0L/143.0L;
+        poly_val[8] = x*(x*(x*(-6625.0L/3432.0L*x + 3925.0L/858.0L) - 245.0L/88.0L) - 15.0L/44.0L) + 15.0L/44.0L;
+        poly_val[9] = x*(x*(x*((25.0L/8.0L)*x - 80.0L/11.0L) + 315.0L/88.0L) + 20.0L/11.0L) - 10.0L/11.0L;
+        poly_val[10] = x*(x*(x*(-11370461.0L/2794176.0L*x + 10100381.0L/1164240.0L) - 3749981.0L/1552320.0L) - 1968329.0L/635040.0L);
+        poly_val[11] = x*(x*(x*((11370461.0L/2794176.0L)*x - 1206871.0L/158760.0L) + 3749981.0L/4656960.0L) + 20.0L/11.0L) + 10.0L/11.0L;
+        poly_val[12] = x*(x*(x*(-25.0L/8.0L*x + 115.0L/22.0L) - 45.0L/88.0L) - 15.0L/44.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(x*(x*((6625.0L/3432.0L)*x - 450.0L/143.0L) + 735.0L/1144.0L) + 40.0L/429.0L) + 20.0L/143.0L;
+        poly_val[14] = x*(x*(x*(-3475.0L/3432.0L*x + 1465.0L/858.0L) - 545.0L/1144.0L) - 15.0L/572.0L) - 15.0L/286.0L;
+        poly_val[15] = x*(x*(x*((2589.0L/5720.0L)*x - 2811.0L/3575.0L) + 567.0L/2200.0L) + 24.0L/3575.0L) + 12.0L/715.0L;
+        poly_val[16] = x*(x*(x*(-5689.0L/34320.0L*x + 4211.0L/14300.0L) - 6069.0L/57200.0L) - 5.0L/3432.0L) - 5.0L/1144.0L;
+        poly_val[17] = x*(x*(x*((274825.0L/5717712.0L)*x - 31030.0L/357357.0L) + 63395.0L/1905904.0L) + 30.0L/119119.0L) + 15.0L/17017.0L;
+        poly_val[18] = x*(x*(x*(-161375.0L/15247232.0L*x + 73825.0L/3811808.0L) - 118035.0L/15247232.0L) - 5.0L/155584.0L) - 5.0L/38896.0L;
+        poly_val[19] = x*(x*(x*((795325.0L/478887552.0L)*x - 61255.0L/19953648.0L) + 3545.0L/2800512.0L) + 10.0L/3741309.0L) + 5.0L/415701.0L;
+        poly_val[20] = x*(x*(x*(-4499.0L/27209520.0L*x + 6781.0L/22007700.0L) - 64897.0L/498841200.0L) - 1.0L/9237800.0L) - 1.0L/1847560.0L;
+        poly_val[21] = pow(x, 2)*(x*((29.0L/3695120.0L)*x - 1.0L/67925.0L) + 9.0L/1421200.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(-29.0L/923780.0L*x + 21.0L/419900.0L) - 9.0L/486200.0L) - 1.0L/9237800.0L;
+        poly_val[1] = x*(x*((4499.0L/6802380.0L)*x - 11014.0L/10392525.0L) + 32893.0L/83140200.0L) + 10.0L/3741309.0L;
+        poly_val[2] = x*(x*(-795325.0L/119721888.0L*x + 427795.0L/39907296.0L) - 24815.0L/6139584.0L) - 5.0L/155584.0L;
+        poly_val[3] = x*(x*((161375.0L/3811808.0L)*x - 7725.0L/112112.0L) + 200385.0L/7623616.0L) + 30.0L/119119.0L;
+        poly_val[4] = x*(x*(-274825.0L/1429428.0L*x + 8865.0L/28028.0L) - 116565.0L/952952.0L) - 5.0L/3432.0L;
+        poly_val[5] = x*(x*((5689.0L/8580.0L)*x - 3953.0L/3575.0L) + 12427.0L/28600.0L) + 24.0L/3575.0L;
+        poly_val[6] = x*(x*(-2589.0L/1430.0L*x + 21969.0L/7150.0L) - 17577.0L/14300.0L) - 15.0L/572.0L;
+        poly_val[7] = x*(x*((3475.0L/858.0L)*x - 1005.0L/143.0L) + 1635.0L/572.0L) + 40.0L/429.0L;
+        poly_val[8] = x*(x*(-6625.0L/858.0L*x + 3925.0L/286.0L) - 245.0L/44.0L) - 15.0L/44.0L;
+        poly_val[9] = x*(x*((25.0L/2.0L)*x - 240.0L/11.0L) + 315.0L/44.0L) + 20.0L/11.0L;
+        poly_val[10] = x*(x*(-11370461.0L/698544.0L*x + 10100381.0L/388080.0L) - 3749981.0L/776160.0L) - 1968329.0L/635040.0L;
+        poly_val[11] = x*(x*((11370461.0L/698544.0L)*x - 1206871.0L/52920.0L) + 3749981.0L/2328480.0L) + 20.0L/11.0L;
+        poly_val[12] = x*(x*(-25.0L/2.0L*x + 345.0L/22.0L) - 45.0L/44.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(x*((6625.0L/858.0L)*x - 1350.0L/143.0L) + 735.0L/572.0L) + 40.0L/429.0L;
+        poly_val[14] = x*(x*(-3475.0L/858.0L*x + 1465.0L/286.0L) - 545.0L/572.0L) - 15.0L/572.0L;
+        poly_val[15] = x*(x*((2589.0L/1430.0L)*x - 8433.0L/3575.0L) + 567.0L/1100.0L) + 24.0L/3575.0L;
+        poly_val[16] = x*(x*(-5689.0L/8580.0L*x + 12633.0L/14300.0L) - 6069.0L/28600.0L) - 5.0L/3432.0L;
+        poly_val[17] = x*(x*((274825.0L/1429428.0L)*x - 31030.0L/119119.0L) + 63395.0L/952952.0L) + 30.0L/119119.0L;
+        poly_val[18] = x*(x*(-161375.0L/3811808.0L*x + 221475.0L/3811808.0L) - 118035.0L/7623616.0L) - 5.0L/155584.0L;
+        poly_val[19] = x*(x*((795325.0L/119721888.0L)*x - 61255.0L/6651216.0L) + 3545.0L/1400256.0L) + 10.0L/3741309.0L;
+        poly_val[20] = x*(x*(-4499.0L/6802380.0L*x + 6781.0L/7335900.0L) - 64897.0L/249420600.0L) - 1.0L/9237800.0L;
+        poly_val[21] = x*(x*((29.0L/923780.0L)*x - 3.0L/67925.0L) + 9.0L/710600.0L);
+        break;
+    }
+}
+void beta_n10_m3(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*((51185699.0L/11732745024000.0L)*x - 4090369.0L/266653296000.0L) + 35733059.0L/1955457504000.0L) - 1072961.0L/154378224000.0L) - 514639.0L/617512896000.0L) - 1.0L/18475600.0L) + 1.0L/1847560.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*(-97750271.0L/1066613184000.0L*x + 3782441303.0L/11732745024000.0L) - 237253277.0L/617512896000.0L) + 18781351.0L/128931264000.0L) + 11419.0L/617512896.0L) + 5.0L/3741309.0L) - 5.0L/415701.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*((531225.0L/579394816.0L)*x - 75723343.0L/23465490048.0L) + 90288169.0L/23465490048.0L) - 1311199.0L/902518848.0L) - 487121.0L/2470051584.0L) - 5.0L/311168.0L) + 5.0L/38896.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*(-14351957.0L/2470051584.0L*x + 5616313.0L/274450176.0L) - 20100053.0L/823350528.0L) + 22641695.0L/2470051584.0L) + 5663.0L/4200768.0L) + 15.0L/119119.0L) - 15.0L/17017.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*((129283295.0L/4940103168.0L)*x - 10356823.0L/112275072.0L) + 90651851.0L/823350528.0L) - 50656289.0L/1235025792.0L) - 1933049.0L/290594304.0L) - 5.0L/6864.0L) + 5.0L/1144.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*(-294222911.0L/3302208000.0L*x + 346045183.0L/1100736000.0L) - 4545171157.0L/12108096000.0L) + 5019772789.0L/36324288000.0L) + 9587629.0L/378378000.0L) + 12.0L/3575.0L) - 12.0L/715.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*((720747847.0L/3027024000.0L)*x - 636560369.0L/756756000.0L) + 24128711.0L/24024000.0L) - 21109141.0L/58212000.0L) - 1888949.0L/24216192.0L) - 15.0L/1144.0L) + 15.0L/286.0L);
+        poly_val[7] = x*(x*(x*(x*(x*(x*(-37195415.0L/72648576.0L*x + 131578253.0L/72648576.0L) - 52283503.0L/24216192.0L) + 54623759.0L/72648576.0L) + 1827209.0L/9081072.0L) + 20.0L/429.0L) - 20.0L/143.0L);
+        poly_val[8] = x*(x*(x*(x*(x*(x*((130810913.0L/145297152.0L)*x - 1428677.0L/448448.0L) + 91285561.0L/24216192.0L) - 6286355.0L/5189184.0L) - 1650809.0L/3725568.0L) - 15.0L/88.0L) + 15.0L/44.0L);
+        poly_val[9] = x*(x*(x*(x*(x*(x*(-1327945.0L/1016064.0L*x + 51572033.0L/11176704.0L) - 20028763.0L/3725568.0L) + 17535659.0L/11176704.0L) + 698249.0L/1397088.0L) + 10.0L/11.0L) - 10.0L/11.0L);
+        poly_val[10] = pow(x, 2)*(pow(x, 2)*(x*(x*((10991207.0L/6985440.0L)*x - 571831.0L/103488.0L) + 8832661.0L/1397088.0L) - 1271555.0L/698544.0L) - 1968329.0L/1270080.0L) + 1;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(-10991207.0L/6985440.0L*x + 6970883.0L/1270080.0L) - 43387097.0L/6985440.0L) + 1841911.0L/931392.0L) - 698249.0L/1397088.0L) + 10.0L/11.0L) + 10.0L/11.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*((1327945.0L/1016064.0L)*x - 4223311.0L/931392.0L) + 9568231.0L/1862784.0L) - 5143529.0L/2794176.0L) + 1650809.0L/3725568.0L) - 15.0L/88.0L) - 15.0L/44.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*(-130810913.0L/145297152.0L*x + 452785043.0L/145297152.0L) - 24637831.0L/6918912.0L) + 197560625.0L/145297152.0L) - 1827209.0L/9081072.0L) + 20.0L/429.0L) + 20.0L/143.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*((37195415.0L/72648576.0L)*x - 10732471.0L/6054048.0L) + 24747451.0L/12108096.0L) - 1111433.0L/1397088.0L) + 1888949.0L/24216192.0L) - 15.0L/1144.0L) - 15.0L/286.0L);
+        poly_val[15] = x*(x*(x*(x*(x*(x*(-720747847.0L/3027024000.0L*x + 227181223.0L/275184000.0L) - 107350871.0L/112112000.0L) + 12483133.0L/33264000.0L) - 9587629.0L/378378000.0L) + 12.0L/3575.0L) + 12.0L/715.0L);
+        poly_val[16] = x*(x*(x*(x*(x*(x*((294222911.0L/3302208000.0L)*x - 255356207.0L/825552000.0L) + 2180676613.0L/6054048000.0L) - 1285312429.0L/9081072000.0L) + 1933049.0L/290594304.0L) - 5.0L/6864.0L) - 5.0L/1144.0L);
+        poly_val[17] = x*(x*(x*(x*(x*(x*(-129283295.0L/4940103168.0L*x + 49920317.0L/548900352.0L) - 174886343.0L/1646701056.0L) + 206342519.0L/4940103168.0L) - 5663.0L/4200768.0L) + 15.0L/119119.0L) + 15.0L/17017.0L);
+        poly_val[18] = x*(x*(x*(x*(x*(x*((14351957.0L/2470051584.0L)*x - 24958441.0L/1235025792.0L) + 9735059.0L/411675264.0L) - 5743835.0L/617512896.0L) + 487121.0L/2470051584.0L) - 5.0L/311168.0L) - 5.0L/38896.0L);
+        poly_val[19] = x*(x*(x*(x*(x*(x*(-531225.0L/579394816.0L*x + 149757889.0L/46930980096.0L) - 175509947.0L/46930980096.0L) + 31049.0L/21111552.0L) - 11419.0L/617512896.0L) + 5.0L/3741309.0L) + 5.0L/415701.0L);
+        poly_val[20] = x*(x*(x*(x*(x*(x*((97750271.0L/1066613184000.0L)*x - 936082391.0L/2933186256000.0L) + 16516831.0L/44108064000.0L) - 431798291.0L/2933186256000.0L) + 514639.0L/617512896000.0L) - 1.0L/18475600.0L) - 1.0L/1847560.0L);
+        poly_val[21] = pow(x, 4)*(x*(x*(-51185699.0L/11732745024000.0L*x + 59441219.0L/3910915008000.0L) - 69813539.0L/3910915008000.0L) + 82302659.0L/11732745024000.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*((51185699.0L/1676106432000.0L)*x - 4090369.0L/44442216000.0L) + 35733059.0L/391091500800.0L) - 1072961.0L/38594556000.0L) - 514639.0L/205837632000.0L) - 1.0L/9237800.0L) + 1.0L/1847560.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(-97750271.0L/152373312000.0L*x + 3782441303.0L/1955457504000.0L) - 237253277.0L/123502579200.0L) + 18781351.0L/32232816000.0L) + 11419.0L/205837632.0L) + 10.0L/3741309.0L) - 5.0L/415701.0L;
+        poly_val[2] = x*(x*(x*(x*(x*((531225.0L/82770688.0L)*x - 75723343.0L/3910915008.0L) + 451440845.0L/23465490048.0L) - 1311199.0L/225629712.0L) - 487121.0L/823350528.0L) - 5.0L/155584.0L) + 5.0L/38896.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(-14351957.0L/352864512.0L*x + 5616313.0L/45741696.0L) - 100500265.0L/823350528.0L) + 22641695.0L/617512896.0L) + 5663.0L/1400256.0L) + 30.0L/119119.0L) - 15.0L/17017.0L;
+        poly_val[4] = x*(x*(x*(x*(x*((129283295.0L/705729024.0L)*x - 10356823.0L/18712512.0L) + 453259255.0L/823350528.0L) - 50656289.0L/308756448.0L) - 1933049.0L/96864768.0L) - 5.0L/3432.0L) + 5.0L/1144.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(-294222911.0L/471744000.0L*x + 346045183.0L/183456000.0L) - 4545171157.0L/2421619200.0L) + 5019772789.0L/9081072000.0L) + 9587629.0L/126126000.0L) + 24.0L/3575.0L) - 12.0L/715.0L;
+        poly_val[6] = x*(x*(x*(x*(x*((720747847.0L/432432000.0L)*x - 636560369.0L/126126000.0L) + 24128711.0L/4804800.0L) - 21109141.0L/14553000.0L) - 1888949.0L/8072064.0L) - 15.0L/572.0L) + 15.0L/286.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(-37195415.0L/10378368.0L*x + 131578253.0L/12108096.0L) - 261417515.0L/24216192.0L) + 54623759.0L/18162144.0L) + 1827209.0L/3027024.0L) + 40.0L/429.0L) - 20.0L/143.0L;
+        poly_val[8] = x*(x*(x*(x*(x*((130810913.0L/20756736.0L)*x - 4286031.0L/224224.0L) + 456427805.0L/24216192.0L) - 6286355.0L/1297296.0L) - 1650809.0L/1241856.0L) - 15.0L/44.0L) + 15.0L/44.0L;
+        poly_val[9] = x*(x*(x*(x*(x*(-1327945.0L/145152.0L*x + 51572033.0L/1862784.0L) - 100143815.0L/3725568.0L) + 17535659.0L/2794176.0L) + 698249.0L/465696.0L) + 20.0L/11.0L) - 10.0L/11.0L;
+        poly_val[10] = x*(pow(x, 2)*(x*(x*((10991207.0L/997920.0L)*x - 571831.0L/17248.0L) + 44163305.0L/1397088.0L) - 1271555.0L/174636.0L) - 1968329.0L/635040.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(-10991207.0L/997920.0L*x + 6970883.0L/211680.0L) - 43387097.0L/1397088.0L) + 1841911.0L/232848.0L) - 698249.0L/465696.0L) + 20.0L/11.0L) + 10.0L/11.0L;
+        poly_val[12] = x*(x*(x*(x*(x*((1327945.0L/145152.0L)*x - 4223311.0L/155232.0L) + 47841155.0L/1862784.0L) - 5143529.0L/698544.0L) + 1650809.0L/1241856.0L) - 15.0L/44.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(-130810913.0L/20756736.0L*x + 452785043.0L/24216192.0L) - 123189155.0L/6918912.0L) + 197560625.0L/36324288.0L) - 1827209.0L/3027024.0L) + 40.0L/429.0L) + 20.0L/143.0L;
+        poly_val[14] = x*(x*(x*(x*(x*((37195415.0L/10378368.0L)*x - 10732471.0L/1009008.0L) + 123737255.0L/12108096.0L) - 1111433.0L/349272.0L) + 1888949.0L/8072064.0L) - 15.0L/572.0L) - 15.0L/286.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(-720747847.0L/432432000.0L*x + 227181223.0L/45864000.0L) - 107350871.0L/22422400.0L) + 12483133.0L/8316000.0L) - 9587629.0L/126126000.0L) + 24.0L/3575.0L) + 12.0L/715.0L;
+        poly_val[16] = x*(x*(x*(x*(x*((294222911.0L/471744000.0L)*x - 255356207.0L/137592000.0L) + 2180676613.0L/1210809600.0L) - 1285312429.0L/2270268000.0L) + 1933049.0L/96864768.0L) - 5.0L/3432.0L) - 5.0L/1144.0L;
+        poly_val[17] = x*(x*(x*(x*(x*(-129283295.0L/705729024.0L*x + 49920317.0L/91483392.0L) - 874431715.0L/1646701056.0L) + 206342519.0L/1235025792.0L) - 5663.0L/1400256.0L) + 30.0L/119119.0L) + 15.0L/17017.0L;
+        poly_val[18] = x*(x*(x*(x*(x*((14351957.0L/352864512.0L)*x - 24958441.0L/205837632.0L) + 48675295.0L/411675264.0L) - 5743835.0L/154378224.0L) + 487121.0L/823350528.0L) - 5.0L/155584.0L) - 5.0L/38896.0L;
+        poly_val[19] = x*(x*(x*(x*(x*(-531225.0L/82770688.0L*x + 149757889.0L/7821830016.0L) - 877549735.0L/46930980096.0L) + 31049.0L/5277888.0L) - 11419.0L/205837632.0L) + 10.0L/3741309.0L) + 5.0L/415701.0L;
+        poly_val[20] = x*(x*(x*(x*(x*((97750271.0L/152373312000.0L)*x - 936082391.0L/488864376000.0L) + 16516831.0L/8821612800.0L) - 431798291.0L/733296564000.0L) + 514639.0L/205837632000.0L) - 1.0L/9237800.0L) - 1.0L/1847560.0L;
+        poly_val[21] = pow(x, 3)*(x*(x*(-51185699.0L/1676106432000.0L*x + 59441219.0L/651819168000.0L) - 69813539.0L/782183001600.0L) + 82302659.0L/2933186256000.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*((51185699.0L/279351072000.0L)*x - 4090369.0L/8888443200.0L) + 35733059.0L/97772875200.0L) - 1072961.0L/12864852000.0L) - 514639.0L/102918816000.0L) - 1.0L/9237800.0L;
+        poly_val[1] = x*(x*(x*(x*(-97750271.0L/25395552000.0L*x + 3782441303.0L/391091500800.0L) - 237253277.0L/30875644800.0L) + 18781351.0L/10744272000.0L) + 11419.0L/102918816.0L) + 10.0L/3741309.0L;
+        poly_val[2] = x*(x*(x*(x*((1593675.0L/41385344.0L)*x - 378616715.0L/3910915008.0L) + 451440845.0L/5866372512.0L) - 1311199.0L/75209904.0L) - 487121.0L/411675264.0L) - 5.0L/155584.0L;
+        poly_val[3] = x*(x*(x*(x*(-14351957.0L/58810752.0L*x + 28081565.0L/45741696.0L) - 100500265.0L/205837632.0L) + 22641695.0L/205837632.0L) + 5663.0L/700128.0L) + 30.0L/119119.0L;
+        poly_val[4] = x*(x*(x*(x*((129283295.0L/117621504.0L)*x - 51784115.0L/18712512.0L) + 453259255.0L/205837632.0L) - 50656289.0L/102918816.0L) - 1933049.0L/48432384.0L) - 5.0L/3432.0L;
+        poly_val[5] = x*(x*(x*(x*(-294222911.0L/78624000.0L*x + 346045183.0L/36691200.0L) - 4545171157.0L/605404800.0L) + 5019772789.0L/3027024000.0L) + 9587629.0L/63063000.0L) + 24.0L/3575.0L;
+        poly_val[6] = x*(x*(x*(x*((720747847.0L/72072000.0L)*x - 636560369.0L/25225200.0L) + 24128711.0L/1201200.0L) - 21109141.0L/4851000.0L) - 1888949.0L/4036032.0L) - 15.0L/572.0L;
+        poly_val[7] = x*(x*(x*(x*(-37195415.0L/1729728.0L*x + 657891265.0L/12108096.0L) - 261417515.0L/6054048.0L) + 54623759.0L/6054048.0L) + 1827209.0L/1513512.0L) + 40.0L/429.0L;
+        poly_val[8] = x*(x*(x*(x*((130810913.0L/3459456.0L)*x - 21430155.0L/224224.0L) + 456427805.0L/6054048.0L) - 6286355.0L/432432.0L) - 1650809.0L/620928.0L) - 15.0L/44.0L;
+        poly_val[9] = x*(x*(x*(x*(-1327945.0L/24192.0L*x + 257860165.0L/1862784.0L) - 100143815.0L/931392.0L) + 17535659.0L/931392.0L) + 698249.0L/232848.0L) + 20.0L/11.0L;
+        poly_val[10] = pow(x, 2)*(x*(x*((10991207.0L/166320.0L)*x - 2859155.0L/17248.0L) + 44163305.0L/349272.0L) - 1271555.0L/58212.0L) - 1968329.0L/635040.0L;
+        poly_val[11] = x*(x*(x*(x*(-10991207.0L/166320.0L*x + 6970883.0L/42336.0L) - 43387097.0L/349272.0L) + 1841911.0L/77616.0L) - 698249.0L/232848.0L) + 20.0L/11.0L;
+        poly_val[12] = x*(x*(x*(x*((1327945.0L/24192.0L)*x - 21116555.0L/155232.0L) + 47841155.0L/465696.0L) - 5143529.0L/232848.0L) + 1650809.0L/620928.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(x*(x*(x*(-130810913.0L/3459456.0L*x + 2263925215.0L/24216192.0L) - 123189155.0L/1729728.0L) + 197560625.0L/12108096.0L) - 1827209.0L/1513512.0L) + 40.0L/429.0L;
+        poly_val[14] = x*(x*(x*(x*((37195415.0L/1729728.0L)*x - 53662355.0L/1009008.0L) + 123737255.0L/3027024.0L) - 1111433.0L/116424.0L) + 1888949.0L/4036032.0L) - 15.0L/572.0L;
+        poly_val[15] = x*(x*(x*(x*(-720747847.0L/72072000.0L*x + 227181223.0L/9172800.0L) - 107350871.0L/5605600.0L) + 12483133.0L/2772000.0L) - 9587629.0L/63063000.0L) + 24.0L/3575.0L;
+        poly_val[16] = x*(x*(x*(x*((294222911.0L/78624000.0L)*x - 255356207.0L/27518400.0L) + 2180676613.0L/302702400.0L) - 1285312429.0L/756756000.0L) + 1933049.0L/48432384.0L) - 5.0L/3432.0L;
+        poly_val[17] = x*(x*(x*(x*(-129283295.0L/117621504.0L*x + 249601585.0L/91483392.0L) - 874431715.0L/411675264.0L) + 206342519.0L/411675264.0L) - 5663.0L/700128.0L) + 30.0L/119119.0L;
+        poly_val[18] = x*(x*(x*(x*((14351957.0L/58810752.0L)*x - 124792205.0L/205837632.0L) + 48675295.0L/102918816.0L) - 5743835.0L/51459408.0L) + 487121.0L/411675264.0L) - 5.0L/155584.0L;
+        poly_val[19] = x*(x*(x*(x*(-1593675.0L/41385344.0L*x + 748789445.0L/7821830016.0L) - 877549735.0L/11732745024.0L) + 31049.0L/1759296.0L) - 11419.0L/102918816.0L) + 10.0L/3741309.0L;
+        poly_val[20] = x*(x*(x*(x*((97750271.0L/25395552000.0L)*x - 936082391.0L/97772875200.0L) + 16516831.0L/2205403200.0L) - 431798291.0L/244432188000.0L) + 514639.0L/102918816000.0L) - 1.0L/9237800.0L;
+        poly_val[21] = pow(x, 2)*(x*(x*(-51185699.0L/279351072000.0L*x + 59441219.0L/130363833600.0L) - 69813539.0L/195545750400.0L) + 82302659.0L/977728752000.0L);
+        break;
+    }
+}
+void beta_n10_m4(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*(x*(-33637859.0L/2394437760000.0L*x + 1483649773.0L/23465490048000.0L) - 316964689.0L/2933186256000.0L) + 324820967.0L/3910915008000.0L) - 1736957.0L/72648576000.0L) + 514639.0L/6175128960000.0L) - 514639.0L/617512896000.0L) - 1.0L/18475600.0L) + 1.0L/1847560.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*(x*((311524262719.0L/1055947052160000.0L)*x - 701042962783.0L/527973526080000.0L) + 74885259587.0L/32998345380000.0L) - 70831176221.0L/40613348160000.0L) + 75682379687.0L/150849578880000.0L) - 11419.0L/5557616064.0L) + 11419.0L/617512896.0L) + 5.0L/3741309.0L) - 5.0L/415701.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*(x*(-9968948243.0L/3379030566912.0L*x + 44868219719.0L/3379030566912.0L) - 12780882041.0L/563171761152.0L) + 29463096031.0L/1689515283456.0L) - 16937158895.0L/3379030566912.0L) + 487121.0L/19760412672.0L) - 487121.0L/2470051584.0L) - 5.0L/311168.0L) + 5.0L/38896.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*(x*((4795181.0L/256628736.0L)*x - 31958747.0L/380007936.0L) + 473385725.0L/3293402112.0L) - 41964919.0L/380007936.0L) + 6885539.0L/217147392.0L) - 809.0L/4200768.0L) + 5663.0L/4200768.0L) + 15.0L/119119.0L) - 15.0L/17017.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*(x*(-356053741.0L/4234374144.0L*x + 11218117517.0L/29640619008.0L) - 684750301.0L/1058593536.0L) + 7363490045.0L/14820309504.0L) - 4223360627.0L/29640619008.0L) + 1933049.0L/1743565824.0L) - 1933049.0L/290594304.0L) - 5.0L/6864.0L) + 5.0L/1144.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*(x*((311561305079.0L/1089728640000.0L)*x - 140236087829.0L/108972864000.0L) + 39945615029.0L/18162144000.0L) - 184035443699.0L/108972864000.0L) + 105391706569.0L/217945728000.0L) - 9587629.0L/1891890000.0L) + 9587629.0L/378378000.0L) + 12.0L/3575.0L) - 12.0L/715.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*(x*(-46160205953.0L/60540480000.0L*x + 5327562143.0L/1552320000.0L) - 3623292631.0L/617760000.0L) + 136260296441.0L/30270240000.0L) - 25964084431.0L/20180160000.0L) + 1888949.0L/96864768.0L) - 1888949.0L/24216192.0L) - 15.0L/1144.0L) + 15.0L/286.0L);
+        poly_val[7] = x*(x*(x*(x*(x*(x*(x*(x*((18499877.0L/11321856.0L)*x - 801489739.0L/108972864.0L) + 782601527.0L/62270208.0L) - 262586183.0L/27243216.0L) + 2398107605.0L/871782912.0L) - 1827209.0L/27243216.0L) + 1827209.0L/9081072.0L) + 20.0L/429.0L) - 20.0L/143.0L);
+        poly_val[8] = x*(x*(x*(x*(x*(x*(x*(x*(-2493086731.0L/871782912.0L*x + 11221599217.0L/871782912.0L) - 399388835.0L/18162144.0L) + 7345256297.0L/435891456.0L) - 46195777.0L/9580032.0L) + 1650809.0L/7451136.0L) - 1650809.0L/3725568.0L) - 15.0L/88.0L) + 15.0L/44.0L);
+        poly_val[9] = x*(x*(x*(x*(x*(x*(x*(x*((92343961.0L/22353408.0L)*x - 207809573.0L/11176704.0L) + 88727773.0L/2794176.0L) - 90615265.0L/3725568.0L) + 157144591.0L/22353408.0L) - 698249.0L/1397088.0L) + 698249.0L/1397088.0L) + 10.0L/11.0L) - 10.0L/11.0L);
+        poly_val[10] = pow(x, 2)*(pow(x, 2)*(x*(x*(x*(x*(-178100340673.0L/35925120000.0L*x + 1122102226711.0L/50295168000.0L) - 957933723511.0L/25147584000.0L) + 733946977711.0L/25147584000.0L) - 61475136673.0L/7185024000.0L) + 307869749.0L/466560000.0L) - 1968329.0L/1270080.0L) + 1;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*(x*((178100340673.0L/35925120000.0L)*x - 1402452582211.0L/62868960000.0L) + 228012714673.0L/5987520000.0L) - 1836144861211.0L/62868960000.0L) + 2176770052711.0L/251475840000.0L) - 698249.0L/1397088.0L) - 698249.0L/1397088.0L) + 10.0L/11.0L) + 10.0L/11.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*(x*(-92343961.0L/22353408.0L*x + 415476503.0L/22353408.0L) - 59104301.0L/1862784.0L) + 272310167.0L/11176704.0L) - 161927825.0L/22353408.0L) + 1650809.0L/7451136.0L) + 1650809.0L/3725568.0L) - 15.0L/88.0L) - 15.0L/44.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*(x*((2493086731.0L/871782912.0L)*x - 5608090681.0L/435891456.0L) + 683892595.0L/31135104.0L) - 7359321647.0L/435891456.0L) + 4364057777.0L/871782912.0L) - 1827209.0L/27243216.0L) - 1827209.0L/9081072.0L) + 20.0L/429.0L) + 20.0L/143.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*(x*(-18499877.0L/11321856.0L*x + 6408496849.0L/871782912.0L) - 1823789521.0L/145297152.0L) + 323680565.0L/33530112.0L) - 2484812989.0L/871782912.0L) + 1888949.0L/96864768.0L) + 1888949.0L/24216192.0L) - 15.0L/1144.0L) - 15.0L/286.0L);
+        poly_val[15] = x*(x*(x*(x*(x*(x*(x*(x*((46160205953.0L/60540480000.0L)*x - 6922231.0L/2018016.0L) + 35465070353.0L/6054048000.0L) - 6820439797.0L/1513512000.0L) + 254905271.0L/192192000.0L) - 9587629.0L/1891890000.0L) - 9587629.0L/378378000.0L) + 12.0L/3575.0L) + 12.0L/715.0L);
+        poly_val[16] = x*(x*(x*(x*(x*(x*(x*(x*(-311561305079.0L/1089728640000.0L*x + 107822374417.0L/83825280000.0L) - 299257107283.0L/136216080000.0L) + 70840342681.0L/41912640000.0L) - 41601700243.0L/83825280000.0L) + 1933049.0L/1743565824.0L) + 1933049.0L/290594304.0L) - 5.0L/6864.0L) - 5.0L/1144.0L);
+        poly_val[17] = x*(x*(x*(x*(x*(x*(x*(x*((356053741.0L/4234374144.0L)*x - 5606634083.0L/14820309504.0L) + 399033563.0L/617512896.0L) - 7368194069.0L/14820309504.0L) + 5185445.0L/35582976.0L) - 809.0L/4200768.0L) - 5663.0L/4200768.0L) + 15.0L/119119.0L) + 15.0L/17017.0L);
+        poly_val[18] = x*(x*(x*(x*(x*(x*(x*(x*(-4795181.0L/256628736.0L*x + 1661205589.0L/19760412672.0L) - 202694095.0L/1411458048.0L) + 40431847.0L/365933568.0L) - 639105469.0L/19760412672.0L) + 487121.0L/19760412672.0L) + 487121.0L/2470051584.0L) - 5.0L/311168.0L) - 5.0L/38896.0L);
+        poly_val[19] = x*(x*(x*(x*(x*(x*(x*(x*((9968948243.0L/3379030566912.0L)*x - 862544509.0L/64981357056.0L) + 38310835621.0L/1689515283456.0L) - 14738088485.0L/844757641728.0L) + 907279897.0L/177843714048.0L) - 11419.0L/5557616064.0L) - 11419.0L/617512896.0L) + 5.0L/3741309.0L) + 5.0L/415701.0L);
+        poly_val[20] = x*(x*(x*(x*(x*(x*(x*(x*(-311524262719.0L/1055947052160000.0L*x + 280326487781.0L/211189410432000.0L) - 5701224667.0L/2514159648000.0L) + 184231971829.0L/105594705216000.0L) - 107650576139.0L/211189410432000.0L) + 514639.0L/6175128960000.0L) + 514639.0L/617512896000.0L) - 1.0L/18475600.0L) - 1.0L/1847560.0L);
+        poly_val[21] = pow(x, 5)*(x*(x*(x*((33637859.0L/2394437760000.0L)*x - 3708023477.0L/58663725120000.0L) + 39104259.0L/362121760000.0L) - 4873971667.0L/58663725120000.0L) + 218919637.0L/9025188480000.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*(-33637859.0L/266048640000.0L*x + 1483649773.0L/2933186256000.0L) - 316964689.0L/419026608000.0L) + 324820967.0L/651819168000.0L) - 1736957.0L/14529715200.0L) + 514639.0L/1543782240000.0L) - 514639.0L/205837632000.0L) - 1.0L/9237800.0L) + 1.0L/1847560.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*((311524262719.0L/117327450240000.0L)*x - 701042962783.0L/65996690760000.0L) + 74885259587.0L/4714049340000.0L) - 70831176221.0L/6768891360000.0L) + 75682379687.0L/30169915776000.0L) - 11419.0L/1389404016.0L) + 11419.0L/205837632.0L) + 10.0L/3741309.0L) - 5.0L/415701.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*(-9968948243.0L/375447840768.0L*x + 44868219719.0L/422378820864.0L) - 12780882041.0L/80453108736.0L) + 29463096031.0L/281585880576.0L) - 84685794475.0L/3379030566912.0L) + 487121.0L/4940103168.0L) - 487121.0L/823350528.0L) - 5.0L/155584.0L) + 5.0L/38896.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*((4795181.0L/28514304.0L)*x - 31958747.0L/47500992.0L) + 473385725.0L/470486016.0L) - 41964919.0L/63334656.0L) + 34427695.0L/217147392.0L) - 809.0L/1050192.0L) + 5663.0L/1400256.0L) + 30.0L/119119.0L) - 15.0L/17017.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*(-356053741.0L/470486016.0L*x + 11218117517.0L/3705077376.0L) - 684750301.0L/151227648.0L) + 7363490045.0L/2470051584.0L) - 21116803135.0L/29640619008.0L) + 1933049.0L/435891456.0L) - 1933049.0L/96864768.0L) - 5.0L/3432.0L) + 5.0L/1144.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*((311561305079.0L/121080960000.0L)*x - 140236087829.0L/13621608000.0L) + 39945615029.0L/2594592000.0L) - 184035443699.0L/18162144000.0L) + 105391706569.0L/43589145600.0L) - 9587629.0L/472972500.0L) + 9587629.0L/126126000.0L) + 24.0L/3575.0L) - 12.0L/715.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*(-46160205953.0L/6726720000.0L*x + 5327562143.0L/194040000.0L) - 25363048417.0L/617760000.0L) + 136260296441.0L/5045040000.0L) - 25964084431.0L/4036032000.0L) + 1888949.0L/24216192.0L) - 1888949.0L/8072064.0L) - 15.0L/572.0L) + 15.0L/286.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(x*(x*((18499877.0L/1257984.0L)*x - 801489739.0L/13621608.0L) + 782601527.0L/8895744.0L) - 262586183.0L/4540536.0L) + 11990538025.0L/871782912.0L) - 1827209.0L/6810804.0L) + 1827209.0L/3027024.0L) + 40.0L/429.0L) - 20.0L/143.0L;
+        poly_val[8] = x*(x*(x*(x*(x*(x*(x*(-2493086731.0L/96864768.0L*x + 11221599217.0L/108972864.0L) - 399388835.0L/2594592.0L) + 7345256297.0L/72648576.0L) - 230978885.0L/9580032.0L) + 1650809.0L/1862784.0L) - 1650809.0L/1241856.0L) - 15.0L/44.0L) + 15.0L/44.0L;
+        poly_val[9] = x*(x*(x*(x*(x*(x*(x*((92343961.0L/2483712.0L)*x - 207809573.0L/1397088.0L) + 88727773.0L/399168.0L) - 90615265.0L/620928.0L) + 785722955.0L/22353408.0L) - 698249.0L/349272.0L) + 698249.0L/465696.0L) + 20.0L/11.0L) - 10.0L/11.0L;
+        poly_val[10] = x*(pow(x, 2)*(x*(x*(x*(x*(-178100340673.0L/3991680000.0L*x + 1122102226711.0L/6286896000.0L) - 957933723511.0L/3592512000.0L) + 733946977711.0L/4191264000.0L) - 61475136673.0L/1437004800.0L) + 307869749.0L/116640000.0L) - 1968329.0L/635040.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*((178100340673.0L/3991680000.0L)*x - 1402452582211.0L/7858620000.0L) + 228012714673.0L/855360000.0L) - 1836144861211.0L/10478160000.0L) + 2176770052711.0L/50295168000.0L) - 698249.0L/349272.0L) - 698249.0L/465696.0L) + 20.0L/11.0L) + 10.0L/11.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*(-92343961.0L/2483712.0L*x + 415476503.0L/2794176.0L) - 59104301.0L/266112.0L) + 272310167.0L/1862784.0L) - 809639125.0L/22353408.0L) + 1650809.0L/1862784.0L) + 1650809.0L/1241856.0L) - 15.0L/44.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*((2493086731.0L/96864768.0L)*x - 5608090681.0L/54486432.0L) + 683892595.0L/4447872.0L) - 7359321647.0L/72648576.0L) + 21820288885.0L/871782912.0L) - 1827209.0L/6810804.0L) - 1827209.0L/3027024.0L) + 40.0L/429.0L) + 20.0L/143.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*(-18499877.0L/1257984.0L*x + 6408496849.0L/108972864.0L) - 1823789521.0L/20756736.0L) + 323680565.0L/5588352.0L) - 12424064945.0L/871782912.0L) + 1888949.0L/24216192.0L) + 1888949.0L/8072064.0L) - 15.0L/572.0L) - 15.0L/286.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(x*(x*((46160205953.0L/6726720000.0L)*x - 6922231.0L/252252.0L) + 35465070353.0L/864864000.0L) - 6820439797.0L/252252000.0L) + 254905271.0L/38438400.0L) - 9587629.0L/472972500.0L) - 9587629.0L/126126000.0L) + 24.0L/3575.0L) + 12.0L/715.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(x*(x*(-311561305079.0L/121080960000.0L*x + 107822374417.0L/10478160000.0L) - 299257107283.0L/19459440000.0L) + 70840342681.0L/6985440000.0L) - 41601700243.0L/16765056000.0L) + 1933049.0L/435891456.0L) + 1933049.0L/96864768.0L) - 5.0L/3432.0L) - 5.0L/1144.0L;
+        poly_val[17] = x*(x*(x*(x*(x*(x*(x*((356053741.0L/470486016.0L)*x - 5606634083.0L/1852538688.0L) + 399033563.0L/88216128.0L) - 7368194069.0L/2470051584.0L) + 25927225.0L/35582976.0L) - 809.0L/1050192.0L) - 5663.0L/1400256.0L) + 30.0L/119119.0L) + 15.0L/17017.0L;
+        poly_val[18] = x*(x*(x*(x*(x*(x*(x*(-4795181.0L/28514304.0L*x + 1661205589.0L/2470051584.0L) - 202694095.0L/201636864.0L) + 40431847.0L/60988928.0L) - 3195527345.0L/19760412672.0L) + 487121.0L/4940103168.0L) + 487121.0L/823350528.0L) - 5.0L/155584.0L) - 5.0L/38896.0L;
+        poly_val[19] = x*(x*(x*(x*(x*(x*(x*((9968948243.0L/375447840768.0L)*x - 862544509.0L/8122669632.0L) + 38310835621.0L/241359326208.0L) - 14738088485.0L/140792940288.0L) + 4536399485.0L/177843714048.0L) - 11419.0L/1389404016.0L) - 11419.0L/205837632.0L) + 10.0L/3741309.0L) + 5.0L/415701.0L;
+        poly_val[20] = x*(x*(x*(x*(x*(x*(x*(-311524262719.0L/117327450240000.0L*x + 280326487781.0L/26398676304000.0L) - 5701224667.0L/359165664000.0L) + 184231971829.0L/17599117536000.0L) - 107650576139.0L/42237882086400.0L) + 514639.0L/1543782240000.0L) + 514639.0L/205837632000.0L) - 1.0L/9237800.0L) - 1.0L/1847560.0L;
+        poly_val[21] = pow(x, 4)*(x*(x*(x*((33637859.0L/266048640000.0L)*x - 3708023477.0L/7332965640000.0L) + 39104259.0L/51731680000.0L) - 4873971667.0L/9777287520000.0L) + 218919637.0L/1805037696000.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(-33637859.0L/33256080000.0L*x + 1483649773.0L/419026608000.0L) - 316964689.0L/69837768000.0L) + 324820967.0L/130363833600.0L) - 1736957.0L/3632428800.0L) + 514639.0L/514594080000.0L) - 514639.0L/102918816000.0L) - 1.0L/9237800.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*((311524262719.0L/14665931280000.0L)*x - 701042962783.0L/9428098680000.0L) + 74885259587.0L/785674890000.0L) - 70831176221.0L/1353778272000.0L) + 75682379687.0L/7542478944000.0L) - 11419.0L/463134672.0L) + 11419.0L/102918816.0L) + 10.0L/3741309.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*(-9968948243.0L/46930980096.0L*x + 44868219719.0L/60339831552.0L) - 12780882041.0L/13408851456.0L) + 147315480155.0L/281585880576.0L) - 84685794475.0L/844757641728.0L) + 487121.0L/1646701056.0L) - 487121.0L/411675264.0L) - 5.0L/155584.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*((4795181.0L/3564288.0L)*x - 31958747.0L/6785856.0L) + 473385725.0L/78414336.0L) - 209824595.0L/63334656.0L) + 34427695.0L/54286848.0L) - 809.0L/350064.0L) + 5663.0L/700128.0L) + 30.0L/119119.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*(-356053741.0L/58810752.0L*x + 11218117517.0L/529296768.0L) - 684750301.0L/25204608.0L) + 36817450225.0L/2470051584.0L) - 21116803135.0L/7410154752.0L) + 1933049.0L/145297152.0L) - 1933049.0L/48432384.0L) - 5.0L/3432.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*((311561305079.0L/15135120000.0L)*x - 140236087829.0L/1945944000.0L) + 39945615029.0L/432432000.0L) - 184035443699.0L/3632428800.0L) + 105391706569.0L/10897286400.0L) - 9587629.0L/157657500.0L) + 9587629.0L/63063000.0L) + 24.0L/3575.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*(-46160205953.0L/840840000.0L*x + 5327562143.0L/27720000.0L) - 25363048417.0L/102960000.0L) + 136260296441.0L/1009008000.0L) - 25964084431.0L/1009008000.0L) + 1888949.0L/8072064.0L) - 1888949.0L/4036032.0L) - 15.0L/572.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(x*((18499877.0L/157248.0L)*x - 801489739.0L/1945944.0L) + 782601527.0L/1482624.0L) - 1312930915.0L/4540536.0L) + 11990538025.0L/217945728.0L) - 1827209.0L/2270268.0L) + 1827209.0L/1513512.0L) + 40.0L/429.0L;
+        poly_val[8] = x*(x*(x*(x*(x*(x*(-2493086731.0L/12108096.0L*x + 11221599217.0L/15567552.0L) - 399388835.0L/432432.0L) + 36726281485.0L/72648576.0L) - 230978885.0L/2395008.0L) + 1650809.0L/620928.0L) - 1650809.0L/620928.0L) - 15.0L/44.0L;
+        poly_val[9] = x*(x*(x*(x*(x*(x*((92343961.0L/310464.0L)*x - 207809573.0L/199584.0L) + 88727773.0L/66528.0L) - 453076325.0L/620928.0L) + 785722955.0L/5588352.0L) - 698249.0L/116424.0L) + 698249.0L/232848.0L) + 20.0L/11.0L;
+        poly_val[10] = pow(x, 2)*(x*(x*(x*(x*(-178100340673.0L/498960000.0L*x + 1122102226711.0L/898128000.0L) - 957933723511.0L/598752000.0L) + 733946977711.0L/838252800.0L) - 61475136673.0L/359251200.0L) + 307869749.0L/38880000.0L) - 1968329.0L/635040.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*((178100340673.0L/498960000.0L)*x - 1402452582211.0L/1122660000.0L) + 228012714673.0L/142560000.0L) - 1836144861211.0L/2095632000.0L) + 2176770052711.0L/12573792000.0L) - 698249.0L/116424.0L) - 698249.0L/232848.0L) + 20.0L/11.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*(-92343961.0L/310464.0L*x + 415476503.0L/399168.0L) - 59104301.0L/44352.0L) + 1361550835.0L/1862784.0L) - 809639125.0L/5588352.0L) + 1650809.0L/620928.0L) + 1650809.0L/620928.0L) - 15.0L/44.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*((2493086731.0L/12108096.0L)*x - 5608090681.0L/7783776.0L) + 683892595.0L/741312.0L) - 36796608235.0L/72648576.0L) + 21820288885.0L/217945728.0L) - 1827209.0L/2270268.0L) - 1827209.0L/1513512.0L) + 40.0L/429.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*(-18499877.0L/157248.0L*x + 6408496849.0L/15567552.0L) - 1823789521.0L/3459456.0L) + 1618402825.0L/5588352.0L) - 12424064945.0L/217945728.0L) + 1888949.0L/8072064.0L) + 1888949.0L/4036032.0L) - 15.0L/572.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(x*((46160205953.0L/840840000.0L)*x - 6922231.0L/36036.0L) + 35465070353.0L/144144000.0L) - 6820439797.0L/50450400.0L) + 254905271.0L/9609600.0L) - 9587629.0L/157657500.0L) - 9587629.0L/63063000.0L) + 24.0L/3575.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(x*(-311561305079.0L/15135120000.0L*x + 107822374417.0L/1496880000.0L) - 299257107283.0L/3243240000.0L) + 70840342681.0L/1397088000.0L) - 41601700243.0L/4191264000.0L) + 1933049.0L/145297152.0L) + 1933049.0L/48432384.0L) - 5.0L/3432.0L;
+        poly_val[17] = x*(x*(x*(x*(x*(x*((356053741.0L/58810752.0L)*x - 5606634083.0L/264648384.0L) + 399033563.0L/14702688.0L) - 36840970345.0L/2470051584.0L) + 25927225.0L/8895744.0L) - 809.0L/350064.0L) - 5663.0L/700128.0L) + 30.0L/119119.0L;
+        poly_val[18] = x*(x*(x*(x*(x*(x*(-4795181.0L/3564288.0L*x + 1661205589.0L/352864512.0L) - 202694095.0L/33606144.0L) + 202159235.0L/60988928.0L) - 3195527345.0L/4940103168.0L) + 487121.0L/1646701056.0L) + 487121.0L/411675264.0L) - 5.0L/155584.0L;
+        poly_val[19] = x*(x*(x*(x*(x*(x*((9968948243.0L/46930980096.0L)*x - 862544509.0L/1160381376.0L) + 38310835621.0L/40226554368.0L) - 73690442425.0L/140792940288.0L) + 4536399485.0L/44460928512.0L) - 11419.0L/463134672.0L) - 11419.0L/102918816.0L) + 10.0L/3741309.0L;
+        poly_val[20] = x*(x*(x*(x*(x*(x*(-311524262719.0L/14665931280000.0L*x + 280326487781.0L/3771239472000.0L) - 5701224667.0L/59860944000.0L) + 184231971829.0L/3519823507200.0L) - 107650576139.0L/10559470521600.0L) + 514639.0L/514594080000.0L) + 514639.0L/102918816000.0L) - 1.0L/9237800.0L;
+        poly_val[21] = pow(x, 3)*(x*(x*(x*((33637859.0L/33256080000.0L)*x - 3708023477.0L/1047566520000.0L) + 117312777.0L/25865840000.0L) - 4873971667.0L/1955457504000.0L) + 218919637.0L/451259424000.0L);
+        break;
+    }
+}
diff --git a/bfps/cpp/spline_n10.hpp b/bfps/cpp/spline_n10.hpp
new file mode 100644
index 00000000..4853f197
--- /dev/null
+++ b/bfps/cpp/spline_n10.hpp
@@ -0,0 +1,38 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2015 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#ifndef SPLINE_N10
+
+#define SPLINE_N10
+
+void beta_n10_m0(const int deriv, const double x, double *__restrict__ poly_val);
+void beta_n10_m1(const int deriv, const double x, double *__restrict__ poly_val);
+void beta_n10_m2(const int deriv, const double x, double *__restrict__ poly_val);
+void beta_n10_m3(const int deriv, const double x, double *__restrict__ poly_val);
+void beta_n10_m4(const int deriv, const double x, double *__restrict__ poly_val);
+
+#endif//SPLINE_N10
+
diff --git a/bfps/cpp/spline_n7.cpp b/bfps/cpp/spline_n7.cpp
new file mode 100644
index 00000000..84a3fdbc
--- /dev/null
+++ b/bfps/cpp/spline_n7.cpp
@@ -0,0 +1,324 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2015 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#include "spline_n7.hpp"
+#include <cmath>
+
+void beta_n7_m0(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = -x + 1;
+        poly_val[8] = x;
+        poly_val[9] = 0;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        break;
+    case 1:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = -1;
+        poly_val[8] = 1;
+        poly_val[9] = 0;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        break;
+    case 2:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = 0;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        break;
+    }
+}
+void beta_n7_m1(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(-1.0L/24024.0L*x + 1.0L/12012.0L) - 1.0L/24024.0L);
+        poly_val[1] = x*(x*((23.0L/36036.0L)*x - 95.0L/72072.0L) + 7.0L/10296.0L);
+        poly_val[2] = x*(x*(-119.0L/25740.0L*x + 511.0L/51480.0L) - 7.0L/1320.0L);
+        poly_val[3] = x*(x*((7.0L/330.0L)*x - 21.0L/440.0L) + 7.0L/264.0L);
+        poly_val[4] = x*(x*(-7.0L/99.0L*x + 133.0L/792.0L) - 7.0L/72.0L);
+        poly_val[5] = x*(x*((7.0L/36.0L)*x - 35.0L/72.0L) + 7.0L/24.0L);
+        poly_val[6] = x*(x*(-7.0L/12.0L*x + 35.0L/24.0L) - 7.0L/8.0L);
+        poly_val[7] = pow(x, 2)*((9.0L/8.0L)*x - 17.0L/8.0L) + 1;
+        poly_val[8] = x*(x*(-9.0L/8.0L*x + 5.0L/4.0L) + 7.0L/8.0L);
+        poly_val[9] = x*(x*((7.0L/12.0L)*x - 7.0L/24.0L) - 7.0L/24.0L);
+        poly_val[10] = x*(x*(-7.0L/36.0L*x + 7.0L/72.0L) + 7.0L/72.0L);
+        poly_val[11] = x*(x*((7.0L/99.0L)*x - 35.0L/792.0L) - 7.0L/264.0L);
+        poly_val[12] = x*(x*(-7.0L/330.0L*x + 7.0L/440.0L) + 7.0L/1320.0L);
+        poly_val[13] = x*(x*((119.0L/25740.0L)*x - 203.0L/51480.0L) - 7.0L/10296.0L);
+        poly_val[14] = x*(x*(-23.0L/36036.0L*x + 43.0L/72072.0L) + 1.0L/24024.0L);
+        poly_val[15] = pow(x, 2)*((1.0L/24024.0L)*x - 1.0L/24024.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(-1.0L/8008.0L*x + 1.0L/6006.0L) - 1.0L/24024.0L;
+        poly_val[1] = x*((23.0L/12012.0L)*x - 95.0L/36036.0L) + 7.0L/10296.0L;
+        poly_val[2] = x*(-119.0L/8580.0L*x + 511.0L/25740.0L) - 7.0L/1320.0L;
+        poly_val[3] = x*((7.0L/110.0L)*x - 21.0L/220.0L) + 7.0L/264.0L;
+        poly_val[4] = x*(-7.0L/33.0L*x + 133.0L/396.0L) - 7.0L/72.0L;
+        poly_val[5] = x*((7.0L/12.0L)*x - 35.0L/36.0L) + 7.0L/24.0L;
+        poly_val[6] = x*(-7.0L/4.0L*x + 35.0L/12.0L) - 7.0L/8.0L;
+        poly_val[7] = x*((27.0L/8.0L)*x - 17.0L/4.0L);
+        poly_val[8] = x*(-27.0L/8.0L*x + 5.0L/2.0L) + 7.0L/8.0L;
+        poly_val[9] = x*((7.0L/4.0L)*x - 7.0L/12.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(-7.0L/12.0L*x + 7.0L/36.0L) + 7.0L/72.0L;
+        poly_val[11] = x*((7.0L/33.0L)*x - 35.0L/396.0L) - 7.0L/264.0L;
+        poly_val[12] = x*(-7.0L/110.0L*x + 7.0L/220.0L) + 7.0L/1320.0L;
+        poly_val[13] = x*((119.0L/8580.0L)*x - 203.0L/25740.0L) - 7.0L/10296.0L;
+        poly_val[14] = x*(-23.0L/12012.0L*x + 43.0L/36036.0L) + 1.0L/24024.0L;
+        poly_val[15] = x*((1.0L/8008.0L)*x - 1.0L/12012.0L);
+        break;
+    case 2:
+        poly_val[0] = -1.0L/4004.0L*x + 1.0L/6006.0L;
+        poly_val[1] = (23.0L/6006.0L)*x - 95.0L/36036.0L;
+        poly_val[2] = -119.0L/4290.0L*x + 511.0L/25740.0L;
+        poly_val[3] = (7.0L/55.0L)*x - 21.0L/220.0L;
+        poly_val[4] = -14.0L/33.0L*x + 133.0L/396.0L;
+        poly_val[5] = (7.0L/6.0L)*x - 35.0L/36.0L;
+        poly_val[6] = -7.0L/2.0L*x + 35.0L/12.0L;
+        poly_val[7] = (27.0L/4.0L)*x - 17.0L/4.0L;
+        poly_val[8] = -27.0L/4.0L*x + 5.0L/2.0L;
+        poly_val[9] = (7.0L/2.0L)*x - 7.0L/12.0L;
+        poly_val[10] = -7.0L/6.0L*x + 7.0L/36.0L;
+        poly_val[11] = (14.0L/33.0L)*x - 35.0L/396.0L;
+        poly_val[12] = -7.0L/55.0L*x + 7.0L/220.0L;
+        poly_val[13] = (119.0L/4290.0L)*x - 203.0L/25740.0L;
+        poly_val[14] = -23.0L/6006.0L*x + 43.0L/36036.0L;
+        poly_val[15] = (1.0L/4004.0L)*x - 1.0L/12012.0L;
+        break;
+    }
+}
+void beta_n7_m2(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*((5.0L/42042.0L)*x - 53.0L/168168.0L) + 1.0L/4312.0L) + 1.0L/168168.0L) - 1.0L/24024.0L);
+        poly_val[1] = x*(x*(x*(x*(-5435.0L/3027024.0L*x + 1613.0L/336336.0L) - 3599.0L/1009008.0L) - 7.0L/61776.0L) + 7.0L/10296.0L);
+        poly_val[2] = x*(x*(x*(x*((19607.0L/1544400.0L)*x - 26453.0L/772200.0L) + 39851.0L/1544400.0L) + 7.0L/6600.0L) - 7.0L/1320.0L);
+        poly_val[3] = x*(x*(x*(x*(-1477.0L/26400.0L*x + 4039.0L/26400.0L) - 1029.0L/8800.0L) - 7.0L/1056.0L) + 7.0L/264.0L);
+        poly_val[4] = x*(x*(x*(x*((1645.0L/9504.0L)*x - 763.0L/1584.0L) + 1183.0L/3168.0L) + 7.0L/216.0L) - 7.0L/72.0L);
+        poly_val[5] = x*(x*(x*(x*(-175.0L/432.0L*x + 497.0L/432.0L) - 385.0L/432.0L) - 7.0L/48.0L) + 7.0L/24.0L);
+        poly_val[6] = x*(x*(x*(x*((35.0L/48.0L)*x - 49.0L/24.0L) + 21.0L/16.0L) + 7.0L/8.0L) - 7.0L/8.0L);
+        poly_val[7] = pow(x, 2)*(x*(x*(-174319.0L/176400.0L*x + 152269.0L/58800.0L) - 64069.0L/58800.0L) - 266681.0L/176400.0L) + 1;
+        poly_val[8] = x*(x*(x*(x*((174319.0L/176400.0L)*x - 103697.0L/44100.0L) + 108169.0L/176400.0L) + 7.0L/8.0L) + 7.0L/8.0L);
+        poly_val[9] = x*(x*(x*(x*(-35.0L/48.0L*x + 77.0L/48.0L) - 7.0L/16.0L) - 7.0L/48.0L) - 7.0L/24.0L);
+        poly_val[10] = x*(x*(x*(x*((175.0L/432.0L)*x - 7.0L/8.0L) + 49.0L/144.0L) + 7.0L/216.0L) + 7.0L/72.0L);
+        poly_val[11] = x*(x*(x*(x*(-1645.0L/9504.0L*x + 3647.0L/9504.0L) - 1687.0L/9504.0L) - 7.0L/1056.0L) - 7.0L/264.0L);
+        poly_val[12] = x*(x*(x*(x*((1477.0L/26400.0L)*x - 1673.0L/13200.0L) + 567.0L/8800.0L) + 7.0L/6600.0L) + 7.0L/1320.0L);
+        poly_val[13] = x*(x*(x*(x*(-19607.0L/1544400.0L*x + 15043.0L/514800.0L) - 623.0L/39600.0L) - 7.0L/61776.0L) - 7.0L/10296.0L);
+        poly_val[14] = x*(x*(x*(x*((5435.0L/3027024.0L)*x - 6329.0L/1513512.0L) + 7079.0L/3027024.0L) + 1.0L/168168.0L) + 1.0L/24024.0L);
+        poly_val[15] = pow(x, 3)*(x*(-5.0L/42042.0L*x + 47.0L/168168.0L) - 9.0L/56056.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*((25.0L/42042.0L)*x - 53.0L/42042.0L) + 3.0L/4312.0L) + 1.0L/84084.0L) - 1.0L/24024.0L;
+        poly_val[1] = x*(x*(x*(-27175.0L/3027024.0L*x + 1613.0L/84084.0L) - 3599.0L/336336.0L) - 7.0L/30888.0L) + 7.0L/10296.0L;
+        poly_val[2] = x*(x*(x*((19607.0L/308880.0L)*x - 26453.0L/193050.0L) + 39851.0L/514800.0L) + 7.0L/3300.0L) - 7.0L/1320.0L;
+        poly_val[3] = x*(x*(x*(-1477.0L/5280.0L*x + 4039.0L/6600.0L) - 3087.0L/8800.0L) - 7.0L/528.0L) + 7.0L/264.0L;
+        poly_val[4] = x*(x*(x*((8225.0L/9504.0L)*x - 763.0L/396.0L) + 1183.0L/1056.0L) + 7.0L/108.0L) - 7.0L/72.0L;
+        poly_val[5] = x*(x*(x*(-875.0L/432.0L*x + 497.0L/108.0L) - 385.0L/144.0L) - 7.0L/24.0L) + 7.0L/24.0L;
+        poly_val[6] = x*(x*(x*((175.0L/48.0L)*x - 49.0L/6.0L) + 63.0L/16.0L) + 7.0L/4.0L) - 7.0L/8.0L;
+        poly_val[7] = x*(x*(x*(-174319.0L/35280.0L*x + 152269.0L/14700.0L) - 64069.0L/19600.0L) - 266681.0L/88200.0L);
+        poly_val[8] = x*(x*(x*((174319.0L/35280.0L)*x - 103697.0L/11025.0L) + 108169.0L/58800.0L) + 7.0L/4.0L) + 7.0L/8.0L;
+        poly_val[9] = x*(x*(x*(-175.0L/48.0L*x + 77.0L/12.0L) - 21.0L/16.0L) - 7.0L/24.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(x*(x*((875.0L/432.0L)*x - 7.0L/2.0L) + 49.0L/48.0L) + 7.0L/108.0L) + 7.0L/72.0L;
+        poly_val[11] = x*(x*(x*(-8225.0L/9504.0L*x + 3647.0L/2376.0L) - 1687.0L/3168.0L) - 7.0L/528.0L) - 7.0L/264.0L;
+        poly_val[12] = x*(x*(x*((1477.0L/5280.0L)*x - 1673.0L/3300.0L) + 1701.0L/8800.0L) + 7.0L/3300.0L) + 7.0L/1320.0L;
+        poly_val[13] = x*(x*(x*(-19607.0L/308880.0L*x + 15043.0L/128700.0L) - 623.0L/13200.0L) - 7.0L/30888.0L) - 7.0L/10296.0L;
+        poly_val[14] = x*(x*(x*((27175.0L/3027024.0L)*x - 6329.0L/378378.0L) + 7079.0L/1009008.0L) + 1.0L/84084.0L) + 1.0L/24024.0L;
+        poly_val[15] = pow(x, 2)*(x*(-25.0L/42042.0L*x + 47.0L/42042.0L) - 27.0L/56056.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*((50.0L/21021.0L)*x - 53.0L/14014.0L) + 3.0L/2156.0L) + 1.0L/84084.0L;
+        poly_val[1] = x*(x*(-27175.0L/756756.0L*x + 1613.0L/28028.0L) - 3599.0L/168168.0L) - 7.0L/30888.0L;
+        poly_val[2] = x*(x*((19607.0L/77220.0L)*x - 26453.0L/64350.0L) + 39851.0L/257400.0L) + 7.0L/3300.0L;
+        poly_val[3] = x*(x*(-1477.0L/1320.0L*x + 4039.0L/2200.0L) - 3087.0L/4400.0L) - 7.0L/528.0L;
+        poly_val[4] = x*(x*((8225.0L/2376.0L)*x - 763.0L/132.0L) + 1183.0L/528.0L) + 7.0L/108.0L;
+        poly_val[5] = x*(x*(-875.0L/108.0L*x + 497.0L/36.0L) - 385.0L/72.0L) - 7.0L/24.0L;
+        poly_val[6] = x*(x*((175.0L/12.0L)*x - 49.0L/2.0L) + 63.0L/8.0L) + 7.0L/4.0L;
+        poly_val[7] = x*(x*(-174319.0L/8820.0L*x + 152269.0L/4900.0L) - 64069.0L/9800.0L) - 266681.0L/88200.0L;
+        poly_val[8] = x*(x*((174319.0L/8820.0L)*x - 103697.0L/3675.0L) + 108169.0L/29400.0L) + 7.0L/4.0L;
+        poly_val[9] = x*(x*(-175.0L/12.0L*x + 77.0L/4.0L) - 21.0L/8.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(x*((875.0L/108.0L)*x - 21.0L/2.0L) + 49.0L/24.0L) + 7.0L/108.0L;
+        poly_val[11] = x*(x*(-8225.0L/2376.0L*x + 3647.0L/792.0L) - 1687.0L/1584.0L) - 7.0L/528.0L;
+        poly_val[12] = x*(x*((1477.0L/1320.0L)*x - 1673.0L/1100.0L) + 1701.0L/4400.0L) + 7.0L/3300.0L;
+        poly_val[13] = x*(x*(-19607.0L/77220.0L*x + 15043.0L/42900.0L) - 623.0L/6600.0L) - 7.0L/30888.0L;
+        poly_val[14] = x*(x*((27175.0L/756756.0L)*x - 6329.0L/126126.0L) + 7079.0L/504504.0L) + 1.0L/84084.0L;
+        poly_val[15] = x*(x*(-50.0L/21021.0L*x + 47.0L/14014.0L) - 27.0L/28028.0L);
+        break;
+    }
+}
+void beta_n7_m3(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(-200017.0L/605404800.0L*x + 175717.0L/151351200.0L) - 139417.0L/100900800.0L) + 6109.0L/11642400.0L) + 59.0L/950400.0L) + 1.0L/168168.0L) - 1.0L/24024.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*((4502941.0L/908107200.0L)*x - 2878489.0L/165110400.0L) + 119663.0L/5765760.0L) - 1094837.0L/139708800.0L) - 20137.0L/19958400.0L) - 7.0L/61776.0L) + 7.0L/10296.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*(-901357.0L/25945920.0L*x + 10570201.0L/86486400.0L) - 4195157.0L/28828800.0L) + 14135041.0L/259459200.0L) + 2077.0L/266112.0L) + 7.0L/6600.0L) - 7.0L/1320.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*((200569.0L/1330560.0L)*x - 3530803.0L/6652800.0L) + 93403.0L/147840.0L) - 1551821.0L/6652800.0L) - 31957.0L/831600.0L) - 7.0L/1056.0L) + 7.0L/264.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*(-9044677.0L/19958400.0L*x + 56909.0L/35640.0L) - 6314093.0L/3326400.0L) + 213061.0L/311850.0L) + 247081.0L/1814400.0L) + 7.0L/216.0L) - 7.0L/72.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*((906869.0L/907200.0L)*x - 2130157.0L/604800.0L) + 503599.0L/120960.0L) - 2574109.0L/1814400.0L) - 222581.0L/604800.0L) - 7.0L/48.0L) + 7.0L/24.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*(-505069.0L/302400.0L*x + 394819.0L/67200.0L) - 277219.0L/40320.0L) + 1344209.0L/604800.0L) + 90281.0L/201600.0L) + 7.0L/8.0L) - 7.0L/8.0L);
+        poly_val[7] = pow(x, 2)*(pow(x, 2)*(x*(x*((121399.0L/56448.0L)*x - 1182509.0L/156800.0L) + 12323341.0L/1411200.0L) - 3993487.0L/1411200.0L) - 266681.0L/176400.0L) + 1;
+        poly_val[8] = x*(x*(x*(x*(x*(x*(-121399.0L/56448.0L*x + 2650561.0L/352800.0L) - 174319.0L/20160.0L) + 350719.0L/117600.0L) - 90281.0L/201600.0L) + 7.0L/8.0L) + 7.0L/8.0L);
+        poly_val[9] = x*(x*(x*(x*(x*(x*((505069.0L/302400.0L)*x - 703519.0L/120960.0L) + 1350319.0L/201600.0L) - 1501481.0L/604800.0L) + 222581.0L/604800.0L) - 7.0L/48.0L) - 7.0L/24.0L);
+        poly_val[10] = x*(x*(x*(x*(x*(x*(-906869.0L/907200.0L*x + 1261139.0L/362880.0L) - 811073.0L/201600.0L) + 2819581.0L/1814400.0L) - 247081.0L/1814400.0L) + 7.0L/216.0L) + 7.0L/72.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*((9044677.0L/19958400.0L)*x - 1497319.0L/950400.0L) + 813523.0L/443520.0L) - 14314981.0L/19958400.0L) + 31957.0L/831600.0L) - 7.0L/1056.0L) - 7.0L/264.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*(-200569.0L/1330560.0L*x + 39649.0L/75600.0L) - 226559.0L/369600.0L) + 200173.0L/831600.0L) - 2077.0L/266112.0L) + 7.0L/6600.0L) + 7.0L/1320.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*((901357.0L/25945920.0L)*x - 31384387.0L/259459200.0L) + 2451851.0L/17297280.0L) - 1112533.0L/19958400.0L) + 20137.0L/19958400.0L) - 7.0L/61776.0L) - 7.0L/10296.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*(-4502941.0L/908107200.0L*x + 2091853.0L/121080960.0L) - 12279031.0L/605404800.0L) + 1114733.0L/139708800.0L) - 59.0L/950400.0L) + 1.0L/168168.0L) + 1.0L/24024.0L);
+        poly_val[15] = pow(x, 4)*(x*(x*((200017.0L/605404800.0L)*x - 232417.0L/201801600.0L) + 39031.0L/28828800.0L) - 322417.0L/605404800.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*(-200017.0L/86486400.0L*x + 175717.0L/25225200.0L) - 139417.0L/20180160.0L) + 6109.0L/2910600.0L) + 59.0L/316800.0L) + 1.0L/84084.0L) - 1.0L/24024.0L;
+        poly_val[1] = x*(x*(x*(x*(x*((4502941.0L/129729600.0L)*x - 2878489.0L/27518400.0L) + 119663.0L/1153152.0L) - 1094837.0L/34927200.0L) - 20137.0L/6652800.0L) - 7.0L/30888.0L) + 7.0L/10296.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(-901357.0L/3706560.0L*x + 10570201.0L/14414400.0L) - 4195157.0L/5765760.0L) + 14135041.0L/64864800.0L) + 2077.0L/88704.0L) + 7.0L/3300.0L) - 7.0L/1320.0L;
+        poly_val[3] = x*(x*(x*(x*(x*((200569.0L/190080.0L)*x - 3530803.0L/1108800.0L) + 93403.0L/29568.0L) - 1551821.0L/1663200.0L) - 31957.0L/277200.0L) - 7.0L/528.0L) + 7.0L/264.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(-9044677.0L/2851200.0L*x + 56909.0L/5940.0L) - 6314093.0L/665280.0L) + 426122.0L/155925.0L) + 247081.0L/604800.0L) + 7.0L/108.0L) - 7.0L/72.0L;
+        poly_val[5] = x*(x*(x*(x*(x*((906869.0L/129600.0L)*x - 2130157.0L/100800.0L) + 503599.0L/24192.0L) - 2574109.0L/453600.0L) - 222581.0L/201600.0L) - 7.0L/24.0L) + 7.0L/24.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(-505069.0L/43200.0L*x + 394819.0L/11200.0L) - 277219.0L/8064.0L) + 1344209.0L/151200.0L) + 90281.0L/67200.0L) + 7.0L/4.0L) - 7.0L/8.0L;
+        poly_val[7] = x*(pow(x, 2)*(x*(x*((121399.0L/8064.0L)*x - 3547527.0L/78400.0L) + 12323341.0L/282240.0L) - 3993487.0L/352800.0L) - 266681.0L/88200.0L);
+        poly_val[8] = x*(x*(x*(x*(x*(-121399.0L/8064.0L*x + 2650561.0L/58800.0L) - 174319.0L/4032.0L) + 350719.0L/29400.0L) - 90281.0L/67200.0L) + 7.0L/4.0L) + 7.0L/8.0L;
+        poly_val[9] = x*(x*(x*(x*(x*((505069.0L/43200.0L)*x - 703519.0L/20160.0L) + 1350319.0L/40320.0L) - 1501481.0L/151200.0L) + 222581.0L/201600.0L) - 7.0L/24.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(x*(x*(x*(x*(-906869.0L/129600.0L*x + 1261139.0L/60480.0L) - 811073.0L/40320.0L) + 2819581.0L/453600.0L) - 247081.0L/604800.0L) + 7.0L/108.0L) + 7.0L/72.0L;
+        poly_val[11] = x*(x*(x*(x*(x*((9044677.0L/2851200.0L)*x - 1497319.0L/158400.0L) + 813523.0L/88704.0L) - 14314981.0L/4989600.0L) + 31957.0L/277200.0L) - 7.0L/528.0L) - 7.0L/264.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(-200569.0L/190080.0L*x + 39649.0L/12600.0L) - 226559.0L/73920.0L) + 200173.0L/207900.0L) - 2077.0L/88704.0L) + 7.0L/3300.0L) + 7.0L/1320.0L;
+        poly_val[13] = x*(x*(x*(x*(x*((901357.0L/3706560.0L)*x - 31384387.0L/43243200.0L) + 2451851.0L/3459456.0L) - 1112533.0L/4989600.0L) + 20137.0L/6652800.0L) - 7.0L/30888.0L) - 7.0L/10296.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(-4502941.0L/129729600.0L*x + 2091853.0L/20180160.0L) - 12279031.0L/121080960.0L) + 1114733.0L/34927200.0L) - 59.0L/316800.0L) + 1.0L/84084.0L) + 1.0L/24024.0L;
+        poly_val[15] = pow(x, 3)*(x*(x*((200017.0L/86486400.0L)*x - 232417.0L/33633600.0L) + 39031.0L/5765760.0L) - 322417.0L/151351200.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*(-200017.0L/14414400.0L*x + 175717.0L/5045040.0L) - 139417.0L/5045040.0L) + 6109.0L/970200.0L) + 59.0L/158400.0L) + 1.0L/84084.0L;
+        poly_val[1] = x*(x*(x*(x*((4502941.0L/21621600.0L)*x - 2878489.0L/5503680.0L) + 119663.0L/288288.0L) - 1094837.0L/11642400.0L) - 20137.0L/3326400.0L) - 7.0L/30888.0L;
+        poly_val[2] = x*(x*(x*(x*(-901357.0L/617760.0L*x + 10570201.0L/2882880.0L) - 4195157.0L/1441440.0L) + 14135041.0L/21621600.0L) + 2077.0L/44352.0L) + 7.0L/3300.0L;
+        poly_val[3] = x*(x*(x*(x*((200569.0L/31680.0L)*x - 3530803.0L/221760.0L) + 93403.0L/7392.0L) - 1551821.0L/554400.0L) - 31957.0L/138600.0L) - 7.0L/528.0L;
+        poly_val[4] = x*(x*(x*(x*(-9044677.0L/475200.0L*x + 56909.0L/1188.0L) - 6314093.0L/166320.0L) + 426122.0L/51975.0L) + 247081.0L/302400.0L) + 7.0L/108.0L;
+        poly_val[5] = x*(x*(x*(x*((906869.0L/21600.0L)*x - 2130157.0L/20160.0L) + 503599.0L/6048.0L) - 2574109.0L/151200.0L) - 222581.0L/100800.0L) - 7.0L/24.0L;
+        poly_val[6] = x*(x*(x*(x*(-505069.0L/7200.0L*x + 394819.0L/2240.0L) - 277219.0L/2016.0L) + 1344209.0L/50400.0L) + 90281.0L/33600.0L) + 7.0L/4.0L;
+        poly_val[7] = pow(x, 2)*(x*(x*((121399.0L/1344.0L)*x - 3547527.0L/15680.0L) + 12323341.0L/70560.0L) - 3993487.0L/117600.0L) - 266681.0L/88200.0L;
+        poly_val[8] = x*(x*(x*(x*(-121399.0L/1344.0L*x + 2650561.0L/11760.0L) - 174319.0L/1008.0L) + 350719.0L/9800.0L) - 90281.0L/33600.0L) + 7.0L/4.0L;
+        poly_val[9] = x*(x*(x*(x*((505069.0L/7200.0L)*x - 703519.0L/4032.0L) + 1350319.0L/10080.0L) - 1501481.0L/50400.0L) + 222581.0L/100800.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(x*(x*(x*(-906869.0L/21600.0L*x + 1261139.0L/12096.0L) - 811073.0L/10080.0L) + 2819581.0L/151200.0L) - 247081.0L/302400.0L) + 7.0L/108.0L;
+        poly_val[11] = x*(x*(x*(x*((9044677.0L/475200.0L)*x - 1497319.0L/31680.0L) + 813523.0L/22176.0L) - 14314981.0L/1663200.0L) + 31957.0L/138600.0L) - 7.0L/528.0L;
+        poly_val[12] = x*(x*(x*(x*(-200569.0L/31680.0L*x + 39649.0L/2520.0L) - 226559.0L/18480.0L) + 200173.0L/69300.0L) - 2077.0L/44352.0L) + 7.0L/3300.0L;
+        poly_val[13] = x*(x*(x*(x*((901357.0L/617760.0L)*x - 31384387.0L/8648640.0L) + 2451851.0L/864864.0L) - 1112533.0L/1663200.0L) + 20137.0L/3326400.0L) - 7.0L/30888.0L;
+        poly_val[14] = x*(x*(x*(x*(-4502941.0L/21621600.0L*x + 2091853.0L/4036032.0L) - 12279031.0L/30270240.0L) + 1114733.0L/11642400.0L) - 59.0L/158400.0L) + 1.0L/84084.0L;
+        poly_val[15] = pow(x, 2)*(x*(x*((200017.0L/14414400.0L)*x - 232417.0L/6726720.0L) + 39031.0L/1441440.0L) - 322417.0L/50450400.0L);
+        break;
+    }
+}
+void beta_n7_m4(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*(x*((322727.0L/302702400.0L)*x - 414979.0L/86486400.0L) + 141853.0L/17297280.0L) - 6059.0L/960960.0L) + 11.0L/6048.0L) - 59.0L/6652800.0L) + 59.0L/950400.0L) + 1.0L/168168.0L) - 1.0L/24024.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*(x*(-13405813.0L/838252800.0L*x + 60333233.0L/838252800.0L) - 670268567.0L/5448643200.0L) + 3680359.0L/38918880.0L) - 42433073.0L/1556755200.0L) + 20137.0L/119750400.0L) - 20137.0L/19958400.0L) - 7.0L/61776.0L) + 7.0L/10296.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*(x*((174279691.0L/1556755200.0L)*x - 1120513.0L/2223936.0L) + 44685269.0L/51891840.0L) - 515148581.0L/778377600.0L) + 296702557.0L/1556755200.0L) - 2077.0L/1330560.0L) + 2077.0L/266112.0L) + 7.0L/6600.0L) - 7.0L/1320.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*(x*(-28817.0L/59400.0L*x + 4841917.0L/2217600.0L) - 2256829.0L/604800.0L) + 19073623.0L/6652800.0L) - 609701.0L/739200.0L) + 31957.0L/3326400.0L) - 31957.0L/831600.0L) - 7.0L/1056.0L) + 7.0L/264.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*(x*((3112349.0L/2138400.0L)*x - 56029813.0L/8553600.0L) + 60931183.0L/5443200.0L) - 36766399.0L/4276800.0L) + 14799451.0L/5987520.0L) - 247081.0L/5443200.0L) + 247081.0L/1814400.0L) + 7.0L/216.0L) - 7.0L/72.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*(x*(-4979933.0L/1555200.0L*x + 156886007.0L/10886400.0L) - 8935543.0L/362880.0L) + 51445649.0L/2721600.0L) - 59327153.0L/10886400.0L) + 222581.0L/1209600.0L) - 222581.0L/604800.0L) - 7.0L/48.0L) + 7.0L/24.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*(x*((6455647.0L/1209600.0L)*x - 7263173.0L/302400.0L) + 8272337.0L/201600.0L) - 3809647.0L/120960.0L) + 11059493.0L/1209600.0L) - 90281.0L/201600.0L) + 90281.0L/201600.0L) + 7.0L/8.0L) - 7.0L/8.0L);
+        poly_val[7] = pow(x, 2)*(pow(x, 2)*(x*(x*(x*(x*(-43576279.0L/6350400.0L*x + 11205641.0L/362880.0L) - 19141411.0L/362880.0L) + 73478603.0L/1814400.0L) - 21513043.0L/1814400.0L) + 54613.0L/90720.0L) - 266681.0L/176400.0L) + 1;
+        poly_val[8] = x*(x*(x*(x*(x*(x*(x*(x*((43576279.0L/6350400.0L)*x - 392175587.0L/12700800.0L) + 223287331.0L/4233600.0L) - 36755869.0L/907200.0L) + 1353509.0L/113400.0L) - 90281.0L/201600.0L) - 90281.0L/201600.0L) + 7.0L/8.0L) + 7.0L/8.0L);
+        poly_val[9] = x*(x*(x*(x*(x*(x*(x*(x*(-6455647.0L/1209600.0L*x + 4149733.0L/172800.0L) - 24807889.0L/604800.0L) + 794597.0L/25200.0L) - 2251181.0L/241920.0L) + 222581.0L/1209600.0L) + 222581.0L/604800.0L) - 7.0L/48.0L) - 7.0L/24.0L);
+        poly_val[10] = x*(x*(x*(x*(x*(x*(x*(x*((4979933.0L/1555200.0L)*x - 39212443.0L/2721600.0L) + 5358427.0L/217728.0L) - 103036921.0L/5443200.0L) + 60708181.0L/10886400.0L) - 247081.0L/5443200.0L) - 247081.0L/1814400.0L) + 7.0L/216.0L) + 7.0L/72.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*(x*(-3112349.0L/2138400.0L*x + 56014751.0L/8553600.0L) - 223273759.0L/19958400.0L) + 14724943.0L/1710720.0L) - 13763713.0L/5443200.0L) + 31957.0L/3326400.0L) + 31957.0L/831600.0L) - 7.0L/1056.0L) - 7.0L/264.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*(x*((28817.0L/59400.0L)*x - 968119.0L/443520.0L) + 4961851.0L/1330560.0L) - 9545759.0L/3326400.0L) + 932753.0L/1108800.0L) - 2077.0L/1330560.0L) - 2077.0L/266112.0L) + 7.0L/6600.0L) + 7.0L/1320.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*(x*(-174279691.0L/1556755200.0L*x + 784158119.0L/1556755200.0L) - 669877073.0L/778377600.0L) + 257762143.0L/389188800.0L) - 23213117.0L/119750400.0L) + 20137.0L/119750400.0L) + 20137.0L/19958400.0L) - 7.0L/61776.0L) - 7.0L/10296.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*(x*((13405813.0L/838252800.0L)*x - 2154253.0L/29937600.0L) + 2900003.0L/23587200.0L) - 73650743.0L/778377600.0L) + 1722493.0L/62270208.0L) - 59.0L/6652800.0L) - 59.0L/950400.0L) + 1.0L/168168.0L) + 1.0L/24024.0L);
+        poly_val[15] = pow(x, 5)*(x*(x*(x*(-322727.0L/302702400.0L*x + 2904233.0L/605404800.0L) - 2005.0L/244608.0L) + 545581.0L/86486400.0L) - 159353.0L/86486400.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*((322727.0L/33633600.0L)*x - 414979.0L/10810800.0L) + 141853.0L/2471040.0L) - 6059.0L/160160.0L) + 55.0L/6048.0L) - 59.0L/1663200.0L) + 59.0L/316800.0L) + 1.0L/84084.0L) - 1.0L/24024.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*(-13405813.0L/93139200.0L*x + 60333233.0L/104781600.0L) - 670268567.0L/778377600.0L) + 3680359.0L/6486480.0L) - 42433073.0L/311351040.0L) + 20137.0L/29937600.0L) - 20137.0L/6652800.0L) - 7.0L/30888.0L) + 7.0L/10296.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*((174279691.0L/172972800.0L)*x - 1120513.0L/277992.0L) + 44685269.0L/7413120.0L) - 515148581.0L/129729600.0L) + 296702557.0L/311351040.0L) - 2077.0L/332640.0L) + 2077.0L/88704.0L) + 7.0L/3300.0L) - 7.0L/1320.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*(-28817.0L/6600.0L*x + 4841917.0L/277200.0L) - 2256829.0L/86400.0L) + 19073623.0L/1108800.0L) - 609701.0L/147840.0L) + 31957.0L/831600.0L) - 31957.0L/277200.0L) - 7.0L/528.0L) + 7.0L/264.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*((3112349.0L/237600.0L)*x - 56029813.0L/1069200.0L) + 60931183.0L/777600.0L) - 36766399.0L/712800.0L) + 14799451.0L/1197504.0L) - 247081.0L/1360800.0L) + 247081.0L/604800.0L) + 7.0L/108.0L) - 7.0L/72.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*(-4979933.0L/172800.0L*x + 156886007.0L/1360800.0L) - 8935543.0L/51840.0L) + 51445649.0L/453600.0L) - 59327153.0L/2177280.0L) + 222581.0L/302400.0L) - 222581.0L/201600.0L) - 7.0L/24.0L) + 7.0L/24.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*((6455647.0L/134400.0L)*x - 7263173.0L/37800.0L) + 8272337.0L/28800.0L) - 3809647.0L/20160.0L) + 11059493.0L/241920.0L) - 90281.0L/50400.0L) + 90281.0L/67200.0L) + 7.0L/4.0L) - 7.0L/8.0L;
+        poly_val[7] = x*(pow(x, 2)*(x*(x*(x*(x*(-43576279.0L/705600.0L*x + 11205641.0L/45360.0L) - 19141411.0L/51840.0L) + 73478603.0L/302400.0L) - 21513043.0L/362880.0L) + 54613.0L/22680.0L) - 266681.0L/88200.0L);
+        poly_val[8] = x*(x*(x*(x*(x*(x*(x*((43576279.0L/705600.0L)*x - 392175587.0L/1587600.0L) + 223287331.0L/604800.0L) - 36755869.0L/151200.0L) + 1353509.0L/22680.0L) - 90281.0L/50400.0L) - 90281.0L/67200.0L) + 7.0L/4.0L) + 7.0L/8.0L;
+        poly_val[9] = x*(x*(x*(x*(x*(x*(x*(-6455647.0L/134400.0L*x + 4149733.0L/21600.0L) - 24807889.0L/86400.0L) + 794597.0L/4200.0L) - 2251181.0L/48384.0L) + 222581.0L/302400.0L) + 222581.0L/201600.0L) - 7.0L/24.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(x*(x*(x*(x*(x*(x*((4979933.0L/172800.0L)*x - 39212443.0L/340200.0L) + 5358427.0L/31104.0L) - 103036921.0L/907200.0L) + 60708181.0L/2177280.0L) - 247081.0L/1360800.0L) - 247081.0L/604800.0L) + 7.0L/108.0L) + 7.0L/72.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*(-3112349.0L/237600.0L*x + 56014751.0L/1069200.0L) - 223273759.0L/2851200.0L) + 14724943.0L/285120.0L) - 13763713.0L/1088640.0L) + 31957.0L/831600.0L) + 31957.0L/277200.0L) - 7.0L/528.0L) - 7.0L/264.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*((28817.0L/6600.0L)*x - 968119.0L/55440.0L) + 4961851.0L/190080.0L) - 9545759.0L/554400.0L) + 932753.0L/221760.0L) - 2077.0L/332640.0L) - 2077.0L/88704.0L) + 7.0L/3300.0L) + 7.0L/1320.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*(-174279691.0L/172972800.0L*x + 784158119.0L/194594400.0L) - 669877073.0L/111196800.0L) + 257762143.0L/64864800.0L) - 23213117.0L/23950080.0L) + 20137.0L/29937600.0L) + 20137.0L/6652800.0L) - 7.0L/30888.0L) - 7.0L/10296.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*((13405813.0L/93139200.0L)*x - 2154253.0L/3742200.0L) + 2900003.0L/3369600.0L) - 73650743.0L/129729600.0L) + 8612465.0L/62270208.0L) - 59.0L/1663200.0L) - 59.0L/316800.0L) + 1.0L/84084.0L) + 1.0L/24024.0L;
+        poly_val[15] = pow(x, 4)*(x*(x*(x*(-322727.0L/33633600.0L*x + 2904233.0L/75675600.0L) - 2005.0L/34944.0L) + 545581.0L/14414400.0L) - 159353.0L/17297280.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*(x*(x*((322727.0L/4204200.0L)*x - 414979.0L/1544400.0L) + 141853.0L/411840.0L) - 6059.0L/32032.0L) + 55.0L/1512.0L) - 59.0L/554400.0L) + 59.0L/158400.0L) + 1.0L/84084.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*(-13405813.0L/11642400.0L*x + 60333233.0L/14968800.0L) - 670268567.0L/129729600.0L) + 3680359.0L/1297296.0L) - 42433073.0L/77837760.0L) + 20137.0L/9979200.0L) - 20137.0L/3326400.0L) - 7.0L/30888.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*((174279691.0L/21621600.0L)*x - 7843591.0L/277992.0L) + 44685269.0L/1235520.0L) - 515148581.0L/25945920.0L) + 296702557.0L/77837760.0L) - 2077.0L/110880.0L) + 2077.0L/44352.0L) + 7.0L/3300.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*(-28817.0L/825.0L*x + 4841917.0L/39600.0L) - 2256829.0L/14400.0L) + 19073623.0L/221760.0L) - 609701.0L/36960.0L) + 31957.0L/277200.0L) - 31957.0L/138600.0L) - 7.0L/528.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*((3112349.0L/29700.0L)*x - 392208691.0L/1069200.0L) + 60931183.0L/129600.0L) - 36766399.0L/142560.0L) + 14799451.0L/299376.0L) - 247081.0L/453600.0L) + 247081.0L/302400.0L) + 7.0L/108.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*(-4979933.0L/21600.0L*x + 156886007.0L/194400.0L) - 8935543.0L/8640.0L) + 51445649.0L/90720.0L) - 59327153.0L/544320.0L) + 222581.0L/100800.0L) - 222581.0L/100800.0L) - 7.0L/24.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*((6455647.0L/16800.0L)*x - 7263173.0L/5400.0L) + 8272337.0L/4800.0L) - 3809647.0L/4032.0L) + 11059493.0L/60480.0L) - 90281.0L/16800.0L) + 90281.0L/33600.0L) + 7.0L/4.0L;
+        poly_val[7] = pow(x, 2)*(x*(x*(x*(x*(-43576279.0L/88200.0L*x + 11205641.0L/6480.0L) - 19141411.0L/8640.0L) + 73478603.0L/60480.0L) - 21513043.0L/90720.0L) + 54613.0L/7560.0L) - 266681.0L/88200.0L;
+        poly_val[8] = x*(x*(x*(x*(x*(x*((43576279.0L/88200.0L)*x - 392175587.0L/226800.0L) + 223287331.0L/100800.0L) - 36755869.0L/30240.0L) + 1353509.0L/5670.0L) - 90281.0L/16800.0L) - 90281.0L/33600.0L) + 7.0L/4.0L;
+        poly_val[9] = x*(x*(x*(x*(x*(x*(-6455647.0L/16800.0L*x + 29048131.0L/21600.0L) - 24807889.0L/14400.0L) + 794597.0L/840.0L) - 2251181.0L/12096.0L) + 222581.0L/100800.0L) + 222581.0L/100800.0L) - 7.0L/24.0L;
+        poly_val[10] = x*(x*(x*(x*(x*(x*((4979933.0L/21600.0L)*x - 39212443.0L/48600.0L) + 5358427.0L/5184.0L) - 103036921.0L/181440.0L) + 60708181.0L/544320.0L) - 247081.0L/453600.0L) - 247081.0L/302400.0L) + 7.0L/108.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(-3112349.0L/29700.0L*x + 392103257.0L/1069200.0L) - 223273759.0L/475200.0L) + 14724943.0L/57024.0L) - 13763713.0L/272160.0L) + 31957.0L/277200.0L) + 31957.0L/138600.0L) - 7.0L/528.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*((28817.0L/825.0L)*x - 968119.0L/7920.0L) + 4961851.0L/31680.0L) - 9545759.0L/110880.0L) + 932753.0L/55440.0L) - 2077.0L/110880.0L) - 2077.0L/44352.0L) + 7.0L/3300.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*(-174279691.0L/21621600.0L*x + 784158119.0L/27799200.0L) - 669877073.0L/18532800.0L) + 257762143.0L/12972960.0L) - 23213117.0L/5987520.0L) + 20137.0L/9979200.0L) + 20137.0L/3326400.0L) - 7.0L/30888.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*((13405813.0L/11642400.0L)*x - 2154253.0L/534600.0L) + 2900003.0L/561600.0L) - 73650743.0L/25945920.0L) + 8612465.0L/15567552.0L) - 59.0L/554400.0L) - 59.0L/158400.0L) + 1.0L/84084.0L;
+        poly_val[15] = pow(x, 3)*(x*(x*(x*(-322727.0L/4204200.0L*x + 2904233.0L/10810800.0L) - 2005.0L/5824.0L) + 545581.0L/2882880.0L) - 159353.0L/4324320.0L);
+        break;
+    }
+}
diff --git a/bfps/cpp/spline_n7.hpp b/bfps/cpp/spline_n7.hpp
new file mode 100644
index 00000000..22a0ac2b
--- /dev/null
+++ b/bfps/cpp/spline_n7.hpp
@@ -0,0 +1,38 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2017 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#ifndef SPLINE_N7
+
+#define SPLINE_N7
+
+void beta_n7_m0(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n7_m1(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n7_m2(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n7_m3(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n7_m4(const int deriv, const double x, double *__restrict__ poly_val)
+
+#endif//SPLINE_N7
+
diff --git a/bfps/cpp/spline_n8.cpp b/bfps/cpp/spline_n8.cpp
new file mode 100644
index 00000000..d6cea769
--- /dev/null
+++ b/bfps/cpp/spline_n8.cpp
@@ -0,0 +1,354 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2015 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#include "spline_n8.hpp"
+#include <cmath>
+
+void beta_n8_m0(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = -x + 1;
+        poly_val[9] = x;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        break;
+    case 1:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = -1;
+        poly_val[9] = 1;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        break;
+    case 2:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = 0;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        break;
+    }
+}
+void beta_n8_m1(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*((1.0L/102960.0L)*x - 1.0L/51480.0L) + 1.0L/102960.0L);
+        poly_val[1] = x*(x*(-11.0L/65520.0L*x + 83.0L/240240.0L) - 8.0L/45045.0L);
+        poly_val[2] = x*(x*((62.0L/45045.0L)*x - 4.0L/1365.0L) + 2.0L/1287.0L);
+        poly_val[3] = x*(x*(-46.0L/6435.0L*x + 34.0L/2145.0L) - 56.0L/6435.0L);
+        poly_val[4] = x*(x*((343.0L/12870.0L)*x - 133.0L/2145.0L) + 7.0L/198.0L);
+        poly_val[5] = x*(x*(-7.0L/90.0L*x + 21.0L/110.0L) - 56.0L/495.0L);
+        poly_val[6] = x*(x*((98.0L/495.0L)*x - 28.0L/55.0L) + 14.0L/45.0L);
+        poly_val[7] = x*(x*(-26.0L/45.0L*x + 22.0L/15.0L) - 8.0L/9.0L);
+        poly_val[8] = pow(x, 2)*((10.0L/9.0L)*x - 19.0L/9.0L) + 1;
+        poly_val[9] = x*(x*(-10.0L/9.0L*x + 11.0L/9.0L) + 8.0L/9.0L);
+        poly_val[10] = x*(x*((26.0L/45.0L)*x - 4.0L/15.0L) - 14.0L/45.0L);
+        poly_val[11] = x*(x*(-98.0L/495.0L*x + 14.0L/165.0L) + 56.0L/495.0L);
+        poly_val[12] = x*(x*((7.0L/90.0L)*x - 7.0L/165.0L) - 7.0L/198.0L);
+        poly_val[13] = x*(x*(-343.0L/12870.0L*x + 7.0L/390.0L) + 56.0L/6435.0L);
+        poly_val[14] = x*(x*((46.0L/6435.0L)*x - 4.0L/715.0L) - 2.0L/1287.0L);
+        poly_val[15] = x*(x*(-62.0L/45045.0L*x + 6.0L/5005.0L) + 8.0L/45045.0L);
+        poly_val[16] = x*(x*((11.0L/65520.0L)*x - 19.0L/120120.0L) - 1.0L/102960.0L);
+        poly_val[17] = pow(x, 2)*(-1.0L/102960.0L*x + 1.0L/102960.0L);
+        break;
+    case 1:
+        poly_val[0] = x*((1.0L/34320.0L)*x - 1.0L/25740.0L) + 1.0L/102960.0L;
+        poly_val[1] = x*(-11.0L/21840.0L*x + 83.0L/120120.0L) - 8.0L/45045.0L;
+        poly_val[2] = x*((62.0L/15015.0L)*x - 8.0L/1365.0L) + 2.0L/1287.0L;
+        poly_val[3] = x*(-46.0L/2145.0L*x + 68.0L/2145.0L) - 56.0L/6435.0L;
+        poly_val[4] = x*((343.0L/4290.0L)*x - 266.0L/2145.0L) + 7.0L/198.0L;
+        poly_val[5] = x*(-7.0L/30.0L*x + 21.0L/55.0L) - 56.0L/495.0L;
+        poly_val[6] = x*((98.0L/165.0L)*x - 56.0L/55.0L) + 14.0L/45.0L;
+        poly_val[7] = x*(-26.0L/15.0L*x + 44.0L/15.0L) - 8.0L/9.0L;
+        poly_val[8] = x*((10.0L/3.0L)*x - 38.0L/9.0L);
+        poly_val[9] = x*(-10.0L/3.0L*x + 22.0L/9.0L) + 8.0L/9.0L;
+        poly_val[10] = x*((26.0L/15.0L)*x - 8.0L/15.0L) - 14.0L/45.0L;
+        poly_val[11] = x*(-98.0L/165.0L*x + 28.0L/165.0L) + 56.0L/495.0L;
+        poly_val[12] = x*((7.0L/30.0L)*x - 14.0L/165.0L) - 7.0L/198.0L;
+        poly_val[13] = x*(-343.0L/4290.0L*x + 7.0L/195.0L) + 56.0L/6435.0L;
+        poly_val[14] = x*((46.0L/2145.0L)*x - 8.0L/715.0L) - 2.0L/1287.0L;
+        poly_val[15] = x*(-62.0L/15015.0L*x + 12.0L/5005.0L) + 8.0L/45045.0L;
+        poly_val[16] = x*((11.0L/21840.0L)*x - 19.0L/60060.0L) - 1.0L/102960.0L;
+        poly_val[17] = x*(-1.0L/34320.0L*x + 1.0L/51480.0L);
+        break;
+    case 2:
+        poly_val[0] = (1.0L/17160.0L)*x - 1.0L/25740.0L;
+        poly_val[1] = -11.0L/10920.0L*x + 83.0L/120120.0L;
+        poly_val[2] = (124.0L/15015.0L)*x - 8.0L/1365.0L;
+        poly_val[3] = -92.0L/2145.0L*x + 68.0L/2145.0L;
+        poly_val[4] = (343.0L/2145.0L)*x - 266.0L/2145.0L;
+        poly_val[5] = -7.0L/15.0L*x + 21.0L/55.0L;
+        poly_val[6] = (196.0L/165.0L)*x - 56.0L/55.0L;
+        poly_val[7] = -52.0L/15.0L*x + 44.0L/15.0L;
+        poly_val[8] = (20.0L/3.0L)*x - 38.0L/9.0L;
+        poly_val[9] = -20.0L/3.0L*x + 22.0L/9.0L;
+        poly_val[10] = (52.0L/15.0L)*x - 8.0L/15.0L;
+        poly_val[11] = -196.0L/165.0L*x + 28.0L/165.0L;
+        poly_val[12] = (7.0L/15.0L)*x - 14.0L/165.0L;
+        poly_val[13] = -343.0L/2145.0L*x + 7.0L/195.0L;
+        poly_val[14] = (92.0L/2145.0L)*x - 8.0L/715.0L;
+        poly_val[15] = -124.0L/15015.0L*x + 12.0L/5005.0L;
+        poly_val[16] = (11.0L/10920.0L)*x - 19.0L/60060.0L;
+        poly_val[17] = -1.0L/17160.0L*x + 1.0L/51480.0L;
+        break;
+    }
+}
+void beta_n8_m2(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(-23.0L/823680.0L*x + 61.0L/823680.0L) - 1.0L/18304.0L) - 1.0L/823680.0L) + 1.0L/102960.0L);
+        poly_val[1] = x*(x*(x*(x*((3851.0L/8072064.0L)*x - 5143.0L/4036032.0L) + 12773.0L/13453440.0L) + 8.0L/315315.0L) - 8.0L/45045.0L);
+        poly_val[2] = x*(x*(x*(x*(-3637.0L/945945.0L*x + 33.0L/3185.0L) - 821.0L/105105.0L) - 1.0L/3861.0L) + 2.0L/1287.0L);
+        poly_val[3] = x*(x*(x*(x*((1877.0L/96525.0L)*x - 5116.0L/96525.0L) + 3911.0L/96525.0L) + 56.0L/32175.0L) - 56.0L/6435.0L);
+        poly_val[4] = x*(x*(x*(x*(-17857.0L/257400.0L*x + 49399.0L/257400.0L) - 4263.0L/28600.0L) - 7.0L/792.0L) + 7.0L/198.0L);
+        poly_val[5] = x*(x*(x*(x*((2219.0L/11880.0L)*x - 1043.0L/1980.0L) + 329.0L/792.0L) + 56.0L/1485.0L) - 56.0L/495.0L);
+        poly_val[6] = x*(x*(x*(x*(-119.0L/297.0L*x + 343.0L/297.0L) - 1351.0L/1485.0L) - 7.0L/45.0L) + 14.0L/45.0L);
+        poly_val[7] = x*(x*(x*(x*((31.0L/45.0L)*x - 88.0L/45.0L) + 19.0L/15.0L) + 8.0L/9.0L) - 8.0L/9.0L);
+        poly_val[8] = pow(x, 2)*(x*(x*(-647051.0L/705600.0L*x + 568651.0L/235200.0L) - 686753.0L/705600.0L) - 1077749.0L/705600.0L) + 1;
+        poly_val[9] = x*(x*(x*(x*((647051.0L/705600.0L)*x - 764651.0L/352800.0L) + 333451.0L/705600.0L) + 8.0L/9.0L) + 8.0L/9.0L);
+        poly_val[10] = x*(x*(x*(x*(-31.0L/45.0L*x + 67.0L/45.0L) - 1.0L/3.0L) - 7.0L/45.0L) - 14.0L/45.0L);
+        poly_val[11] = x*(x*(x*(x*((119.0L/297.0L)*x - 28.0L/33.0L) + 49.0L/165.0L) + 56.0L/1485.0L) + 56.0L/495.0L);
+        poly_val[12] = x*(x*(x*(x*(-2219.0L/11880.0L*x + 4837.0L/11880.0L) - 2093.0L/11880.0L) - 7.0L/792.0L) - 7.0L/198.0L);
+        poly_val[13] = x*(x*(x*(x*((17857.0L/257400.0L)*x - 1813.0L/11700.0L) + 2149.0L/28600.0L) + 56.0L/32175.0L) + 56.0L/6435.0L);
+        poly_val[14] = x*(x*(x*(x*(-1877.0L/96525.0L*x + 1423.0L/32175.0L) - 739.0L/32175.0L) - 1.0L/3861.0L) - 2.0L/1287.0L);
+        poly_val[15] = x*(x*(x*(x*((3637.0L/945945.0L)*x - 8384.0L/945945.0L) + 911.0L/189189.0L) + 8.0L/315315.0L) + 8.0L/45045.0L);
+        poly_val[16] = x*(x*(x*(x*(-3851.0L/8072064.0L*x + 8969.0L/8072064.0L) - 8383.0L/13453440.0L) - 1.0L/823680.0L) - 1.0L/102960.0L);
+        poly_val[17] = pow(x, 3)*(x*((23.0L/823680.0L)*x - 3.0L/45760.0L) + 31.0L/823680.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(-23.0L/164736.0L*x + 61.0L/205920.0L) - 3.0L/18304.0L) - 1.0L/411840.0L) + 1.0L/102960.0L;
+        poly_val[1] = x*(x*(x*((19255.0L/8072064.0L)*x - 5143.0L/1009008.0L) + 12773.0L/4484480.0L) + 16.0L/315315.0L) - 8.0L/45045.0L;
+        poly_val[2] = x*(x*(x*(-3637.0L/189189.0L*x + 132.0L/3185.0L) - 821.0L/35035.0L) - 2.0L/3861.0L) + 2.0L/1287.0L;
+        poly_val[3] = x*(x*(x*((1877.0L/19305.0L)*x - 20464.0L/96525.0L) + 3911.0L/32175.0L) + 112.0L/32175.0L) - 56.0L/6435.0L;
+        poly_val[4] = x*(x*(x*(-17857.0L/51480.0L*x + 49399.0L/64350.0L) - 12789.0L/28600.0L) - 7.0L/396.0L) + 7.0L/198.0L;
+        poly_val[5] = x*(x*(x*((2219.0L/2376.0L)*x - 1043.0L/495.0L) + 329.0L/264.0L) + 112.0L/1485.0L) - 56.0L/495.0L;
+        poly_val[6] = x*(x*(x*(-595.0L/297.0L*x + 1372.0L/297.0L) - 1351.0L/495.0L) - 14.0L/45.0L) + 14.0L/45.0L;
+        poly_val[7] = x*(x*(x*((31.0L/9.0L)*x - 352.0L/45.0L) + 19.0L/5.0L) + 16.0L/9.0L) - 8.0L/9.0L;
+        poly_val[8] = x*(x*(x*(-647051.0L/141120.0L*x + 568651.0L/58800.0L) - 686753.0L/235200.0L) - 1077749.0L/352800.0L);
+        poly_val[9] = x*(x*(x*((647051.0L/141120.0L)*x - 764651.0L/88200.0L) + 333451.0L/235200.0L) + 16.0L/9.0L) + 8.0L/9.0L;
+        poly_val[10] = x*(x*(x*(-31.0L/9.0L*x + 268.0L/45.0L) - 1) - 14.0L/45.0L) - 14.0L/45.0L;
+        poly_val[11] = x*(x*(x*((595.0L/297.0L)*x - 112.0L/33.0L) + 49.0L/55.0L) + 112.0L/1485.0L) + 56.0L/495.0L;
+        poly_val[12] = x*(x*(x*(-2219.0L/2376.0L*x + 4837.0L/2970.0L) - 2093.0L/3960.0L) - 7.0L/396.0L) - 7.0L/198.0L;
+        poly_val[13] = x*(x*(x*((17857.0L/51480.0L)*x - 1813.0L/2925.0L) + 6447.0L/28600.0L) + 112.0L/32175.0L) + 56.0L/6435.0L;
+        poly_val[14] = x*(x*(x*(-1877.0L/19305.0L*x + 5692.0L/32175.0L) - 739.0L/10725.0L) - 2.0L/3861.0L) - 2.0L/1287.0L;
+        poly_val[15] = x*(x*(x*((3637.0L/189189.0L)*x - 33536.0L/945945.0L) + 911.0L/63063.0L) + 16.0L/315315.0L) + 8.0L/45045.0L;
+        poly_val[16] = x*(x*(x*(-19255.0L/8072064.0L*x + 8969.0L/2018016.0L) - 8383.0L/4484480.0L) - 1.0L/411840.0L) - 1.0L/102960.0L;
+        poly_val[17] = pow(x, 2)*(x*((23.0L/164736.0L)*x - 3.0L/11440.0L) + 31.0L/274560.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(-23.0L/41184.0L*x + 61.0L/68640.0L) - 3.0L/9152.0L) - 1.0L/411840.0L;
+        poly_val[1] = x*(x*((19255.0L/2018016.0L)*x - 5143.0L/336336.0L) + 12773.0L/2242240.0L) + 16.0L/315315.0L;
+        poly_val[2] = x*(x*(-14548.0L/189189.0L*x + 396.0L/3185.0L) - 1642.0L/35035.0L) - 2.0L/3861.0L;
+        poly_val[3] = x*(x*((7508.0L/19305.0L)*x - 20464.0L/32175.0L) + 7822.0L/32175.0L) + 112.0L/32175.0L;
+        poly_val[4] = x*(x*(-17857.0L/12870.0L*x + 49399.0L/21450.0L) - 12789.0L/14300.0L) - 7.0L/396.0L;
+        poly_val[5] = x*(x*((2219.0L/594.0L)*x - 1043.0L/165.0L) + 329.0L/132.0L) + 112.0L/1485.0L;
+        poly_val[6] = x*(x*(-2380.0L/297.0L*x + 1372.0L/99.0L) - 2702.0L/495.0L) - 14.0L/45.0L;
+        poly_val[7] = x*(x*((124.0L/9.0L)*x - 352.0L/15.0L) + 38.0L/5.0L) + 16.0L/9.0L;
+        poly_val[8] = x*(x*(-647051.0L/35280.0L*x + 568651.0L/19600.0L) - 686753.0L/117600.0L) - 1077749.0L/352800.0L;
+        poly_val[9] = x*(x*((647051.0L/35280.0L)*x - 764651.0L/29400.0L) + 333451.0L/117600.0L) + 16.0L/9.0L;
+        poly_val[10] = x*(x*(-124.0L/9.0L*x + 268.0L/15.0L) - 2) - 14.0L/45.0L;
+        poly_val[11] = x*(x*((2380.0L/297.0L)*x - 112.0L/11.0L) + 98.0L/55.0L) + 112.0L/1485.0L;
+        poly_val[12] = x*(x*(-2219.0L/594.0L*x + 4837.0L/990.0L) - 2093.0L/1980.0L) - 7.0L/396.0L;
+        poly_val[13] = x*(x*((17857.0L/12870.0L)*x - 1813.0L/975.0L) + 6447.0L/14300.0L) + 112.0L/32175.0L;
+        poly_val[14] = x*(x*(-7508.0L/19305.0L*x + 5692.0L/10725.0L) - 1478.0L/10725.0L) - 2.0L/3861.0L;
+        poly_val[15] = x*(x*((14548.0L/189189.0L)*x - 33536.0L/315315.0L) + 1822.0L/63063.0L) + 16.0L/315315.0L;
+        poly_val[16] = x*(x*(-19255.0L/2018016.0L*x + 8969.0L/672672.0L) - 8383.0L/2242240.0L) - 1.0L/411840.0L;
+        poly_val[17] = x*(x*((23.0L/41184.0L)*x - 9.0L/11440.0L) + 31.0L/137280.0L);
+        break;
+    }
+}
+void beta_n8_m3(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*((1409119.0L/18162144000.0L)*x - 225133.0L/825552000.0L) + 982819.0L/3027024000.0L) - 280097.0L/2270268000.0L) - 266681.0L/18162144000.0L) - 1.0L/823680.0L) + 1.0L/102960.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*(-3423751.0L/2594592000.0L*x + 84281297.0L/18162144000.0L) - 1239279.0L/224224000.0L) + 584159.0L/279417600.0L) + 21701.0L/81081000.0L) + 8.0L/315315.0L) - 8.0L/45045.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*((1142023.0L/108108000.0L)*x - 2637197.0L/70945875.0L) + 16757869.0L/378378000.0L) - 1574527.0L/94594500.0L) - 1058149.0L/454053600.0L) - 1.0L/3861.0L) + 2.0L/1287.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*(-8002307.0L/151351200.0L*x + 84540767.0L/454053600.0L) - 33583789.0L/151351200.0L) + 961571.0L/11642400.0L) + 41981.0L/3243240.0L) + 56.0L/32175.0L) - 56.0L/6435.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*((6870101.0L/37065600.0L)*x - 8475431.0L/12972960.0L) + 1246801.0L/1601600.0L) - 18501503.0L/64864800.0L) - 1033649.0L/19958400.0L) - 7.0L/792.0L) + 7.0L/198.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*(-16071287.0L/33264000.0L*x + 24300857.0L/14256000.0L) - 22488359.0L/11088000.0L) + 24013303.0L/33264000.0L) + 999349.0L/6237000.0L) + 56.0L/1485.0L) - 56.0L/495.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*((383939.0L/396000.0L)*x - 2667076.0L/779625.0L) + 5606353.0L/1386000.0L) - 25547.0L/18900.0L) - 901349.0L/2268000.0L) - 7.0L/45.0L) + 14.0L/45.0L);
+        poly_val[7] = x*(x*(x*(x*(x*(x*(-24268063.0L/15876000.0L*x + 85470809.0L/15876000.0L) - 1232929.0L/196000.0L) + 31221523.0L/15876000.0L) + 372149.0L/793800.0L) + 8.0L/9.0L) - 8.0L/9.0L);
+        poly_val[8] = pow(x, 2)*(pow(x, 2)*(x*(x*((434251.0L/226800.0L)*x - 14219287.0L/2116800.0L) + 4099663.0L/529200.0L) - 7673891.0L/3175200.0L) - 1077749.0L/705600.0L) + 1;
+        poly_val[9] = x*(x*(x*(x*(x*(x*(-434251.0L/226800.0L*x + 8491067.0L/1270080.0L) - 8098063.0L/1058400.0L) + 16330063.0L/6350400.0L) - 372149.0L/793800.0L) + 8.0L/9.0L) + 8.0L/9.0L);
+        poly_val[10] = x*(x*(x*(x*(x*(x*((24268063.0L/15876000.0L)*x - 2637676.0L/496125.0L) + 596739.0L/98000.0L) - 4429349.0L/1984500.0L) + 901349.0L/2268000.0L) - 7.0L/45.0L) - 14.0L/45.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*(-383939.0L/396000.0L*x + 7633697.0L/2268000.0L) - 32262353.0L/8316000.0L) + 2482583.0L/1663200.0L) - 999349.0L/6237000.0L) + 56.0L/1485.0L) + 56.0L/495.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*((16071287.0L/33264000.0L)*x - 5978251.0L/3564000.0L) + 32375053.0L/16632000.0L) - 6319283.0L/8316000.0L) + 1033649.0L/19958400.0L) - 7.0L/792.0L) - 7.0L/198.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*(-6870101.0L/37065600.0L*x + 167126329.0L/259459200.0L) - 2405369.0L/3203200.0L) + 76448243.0L/259459200.0L) - 41981.0L/3243240.0L) + 56.0L/32175.0L) + 56.0L/6435.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*((8002307.0L/151351200.0L)*x - 521923.0L/2837835.0L) + 5425117.0L/25225200.0L) - 41011.0L/485100.0L) + 1058149.0L/454053600.0L) - 1.0L/3861.0L) - 2.0L/1287.0L);
+        poly_val[15] = x*(x*(x*(x*(x*(x*(-1142023.0L/108108000.0L*x + 83487077.0L/2270268000.0L) - 10870837.0L/252252000.0L) + 12826589.0L/756756000.0L) - 21701.0L/81081000.0L) + 8.0L/315315.0L) + 8.0L/45045.0L);
+        poly_val[16] = x*(x*(x*(x*(x*(x*((3423751.0L/2594592000.0L)*x - 41741251.0L/9081072000.0L) + 604847.0L/112112000.0L) - 7411.0L/3492720.0L) + 266681.0L/18162144000.0L) - 1.0L/823680.0L) - 1.0L/102960.0L);
+        poly_val[17] = pow(x, 4)*(x*(x*(-1409119.0L/18162144000.0L*x + 1636969.0L/6054048000.0L) - 1923619.0L/6054048000.0L) + 206279.0L/1651104000.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*((1409119.0L/2594592000.0L)*x - 225133.0L/137592000.0L) + 982819.0L/605404800.0L) - 280097.0L/567567000.0L) - 266681.0L/6054048000.0L) - 1.0L/411840.0L) + 1.0L/102960.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(-3423751.0L/370656000.0L*x + 84281297.0L/3027024000.0L) - 1239279.0L/44844800.0L) + 584159.0L/69854400.0L) + 21701.0L/27027000.0L) + 16.0L/315315.0L) - 8.0L/45045.0L;
+        poly_val[2] = x*(x*(x*(x*(x*((1142023.0L/15444000.0L)*x - 5274394.0L/23648625.0L) + 16757869.0L/75675600.0L) - 1574527.0L/23648625.0L) - 1058149.0L/151351200.0L) - 2.0L/3861.0L) + 2.0L/1287.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(-8002307.0L/21621600.0L*x + 84540767.0L/75675600.0L) - 33583789.0L/30270240.0L) + 961571.0L/2910600.0L) + 41981.0L/1081080.0L) + 112.0L/32175.0L) - 56.0L/6435.0L;
+        poly_val[4] = x*(x*(x*(x*(x*((48090707.0L/37065600.0L)*x - 8475431.0L/2162160.0L) + 1246801.0L/320320.0L) - 18501503.0L/16216200.0L) - 1033649.0L/6652800.0L) - 7.0L/396.0L) + 7.0L/198.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(-16071287.0L/4752000.0L*x + 24300857.0L/2376000.0L) - 22488359.0L/2217600.0L) + 24013303.0L/8316000.0L) + 999349.0L/2079000.0L) + 112.0L/1485.0L) - 56.0L/495.0L;
+        poly_val[6] = x*(x*(x*(x*(x*((2687573.0L/396000.0L)*x - 5334152.0L/259875.0L) + 5606353.0L/277200.0L) - 25547.0L/4725.0L) - 901349.0L/756000.0L) - 14.0L/45.0L) + 14.0L/45.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(-24268063.0L/2268000.0L*x + 85470809.0L/2646000.0L) - 1232929.0L/39200.0L) + 31221523.0L/3969000.0L) + 372149.0L/264600.0L) + 16.0L/9.0L) - 8.0L/9.0L;
+        poly_val[8] = x*(pow(x, 2)*(x*(x*((434251.0L/32400.0L)*x - 14219287.0L/352800.0L) + 4099663.0L/105840.0L) - 7673891.0L/793800.0L) - 1077749.0L/352800.0L);
+        poly_val[9] = x*(x*(x*(x*(x*(-434251.0L/32400.0L*x + 8491067.0L/211680.0L) - 8098063.0L/211680.0L) + 16330063.0L/1587600.0L) - 372149.0L/264600.0L) + 16.0L/9.0L) + 8.0L/9.0L;
+        poly_val[10] = x*(x*(x*(x*(x*((24268063.0L/2268000.0L)*x - 5275352.0L/165375.0L) + 596739.0L/19600.0L) - 4429349.0L/496125.0L) + 901349.0L/756000.0L) - 14.0L/45.0L) - 14.0L/45.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(-2687573.0L/396000.0L*x + 7633697.0L/378000.0L) - 32262353.0L/1663200.0L) + 2482583.0L/415800.0L) - 999349.0L/2079000.0L) + 112.0L/1485.0L) + 56.0L/495.0L;
+        poly_val[12] = x*(x*(x*(x*(x*((16071287.0L/4752000.0L)*x - 5978251.0L/594000.0L) + 32375053.0L/3326400.0L) - 6319283.0L/2079000.0L) + 1033649.0L/6652800.0L) - 7.0L/396.0L) - 7.0L/198.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(-48090707.0L/37065600.0L*x + 167126329.0L/43243200.0L) - 2405369.0L/640640.0L) + 76448243.0L/64864800.0L) - 41981.0L/1081080.0L) + 112.0L/32175.0L) + 56.0L/6435.0L;
+        poly_val[14] = x*(x*(x*(x*(x*((8002307.0L/21621600.0L)*x - 1043846.0L/945945.0L) + 5425117.0L/5045040.0L) - 41011.0L/121275.0L) + 1058149.0L/151351200.0L) - 2.0L/3861.0L) - 2.0L/1287.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(-1142023.0L/15444000.0L*x + 83487077.0L/378378000.0L) - 10870837.0L/50450400.0L) + 12826589.0L/189189000.0L) - 21701.0L/27027000.0L) + 16.0L/315315.0L) + 8.0L/45045.0L;
+        poly_val[16] = x*(x*(x*(x*(x*((3423751.0L/370656000.0L)*x - 41741251.0L/1513512000.0L) + 604847.0L/22422400.0L) - 7411.0L/873180.0L) + 266681.0L/6054048000.0L) - 1.0L/411840.0L) - 1.0L/102960.0L;
+        poly_val[17] = pow(x, 3)*(x*(x*(-1409119.0L/2594592000.0L*x + 1636969.0L/1009008000.0L) - 1923619.0L/1210809600.0L) + 206279.0L/412776000.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*((1409119.0L/432432000.0L)*x - 225133.0L/27518400.0L) + 982819.0L/151351200.0L) - 280097.0L/189189000.0L) - 266681.0L/3027024000.0L) - 1.0L/411840.0L;
+        poly_val[1] = x*(x*(x*(x*(-3423751.0L/61776000.0L*x + 84281297.0L/605404800.0L) - 1239279.0L/11211200.0L) + 584159.0L/23284800.0L) + 21701.0L/13513500.0L) + 16.0L/315315.0L;
+        poly_val[2] = x*(x*(x*(x*((1142023.0L/2574000.0L)*x - 5274394.0L/4729725.0L) + 16757869.0L/18918900.0L) - 1574527.0L/7882875.0L) - 1058149.0L/75675600.0L) - 2.0L/3861.0L;
+        poly_val[3] = x*(x*(x*(x*(-8002307.0L/3603600.0L*x + 84540767.0L/15135120.0L) - 33583789.0L/7567560.0L) + 961571.0L/970200.0L) + 41981.0L/540540.0L) + 112.0L/32175.0L;
+        poly_val[4] = x*(x*(x*(x*((48090707.0L/6177600.0L)*x - 8475431.0L/432432.0L) + 1246801.0L/80080.0L) - 18501503.0L/5405400.0L) - 1033649.0L/3326400.0L) - 7.0L/396.0L;
+        poly_val[5] = x*(x*(x*(x*(-16071287.0L/792000.0L*x + 24300857.0L/475200.0L) - 22488359.0L/554400.0L) + 24013303.0L/2772000.0L) + 999349.0L/1039500.0L) + 112.0L/1485.0L;
+        poly_val[6] = x*(x*(x*(x*((2687573.0L/66000.0L)*x - 5334152.0L/51975.0L) + 5606353.0L/69300.0L) - 25547.0L/1575.0L) - 901349.0L/378000.0L) - 14.0L/45.0L;
+        poly_val[7] = x*(x*(x*(x*(-24268063.0L/378000.0L*x + 85470809.0L/529200.0L) - 1232929.0L/9800.0L) + 31221523.0L/1323000.0L) + 372149.0L/132300.0L) + 16.0L/9.0L;
+        poly_val[8] = pow(x, 2)*(x*(x*((434251.0L/5400.0L)*x - 14219287.0L/70560.0L) + 4099663.0L/26460.0L) - 7673891.0L/264600.0L) - 1077749.0L/352800.0L;
+        poly_val[9] = x*(x*(x*(x*(-434251.0L/5400.0L*x + 8491067.0L/42336.0L) - 8098063.0L/52920.0L) + 16330063.0L/529200.0L) - 372149.0L/132300.0L) + 16.0L/9.0L;
+        poly_val[10] = x*(x*(x*(x*((24268063.0L/378000.0L)*x - 5275352.0L/33075.0L) + 596739.0L/4900.0L) - 4429349.0L/165375.0L) + 901349.0L/378000.0L) - 14.0L/45.0L;
+        poly_val[11] = x*(x*(x*(x*(-2687573.0L/66000.0L*x + 7633697.0L/75600.0L) - 32262353.0L/415800.0L) + 2482583.0L/138600.0L) - 999349.0L/1039500.0L) + 112.0L/1485.0L;
+        poly_val[12] = x*(x*(x*(x*((16071287.0L/792000.0L)*x - 5978251.0L/118800.0L) + 32375053.0L/831600.0L) - 6319283.0L/693000.0L) + 1033649.0L/3326400.0L) - 7.0L/396.0L;
+        poly_val[13] = x*(x*(x*(x*(-48090707.0L/6177600.0L*x + 167126329.0L/8648640.0L) - 2405369.0L/160160.0L) + 76448243.0L/21621600.0L) - 41981.0L/540540.0L) + 112.0L/32175.0L;
+        poly_val[14] = x*(x*(x*(x*((8002307.0L/3603600.0L)*x - 1043846.0L/189189.0L) + 5425117.0L/1261260.0L) - 41011.0L/40425.0L) + 1058149.0L/75675600.0L) - 2.0L/3861.0L;
+        poly_val[15] = x*(x*(x*(x*(-1142023.0L/2574000.0L*x + 83487077.0L/75675600.0L) - 10870837.0L/12612600.0L) + 12826589.0L/63063000.0L) - 21701.0L/13513500.0L) + 16.0L/315315.0L;
+        poly_val[16] = x*(x*(x*(x*((3423751.0L/61776000.0L)*x - 41741251.0L/302702400.0L) + 604847.0L/5605600.0L) - 7411.0L/291060.0L) + 266681.0L/3027024000.0L) - 1.0L/411840.0L;
+        poly_val[17] = pow(x, 2)*(x*(x*(-1409119.0L/432432000.0L*x + 1636969.0L/201801600.0L) - 1923619.0L/302702400.0L) + 206279.0L/137592000.0L);
+        break;
+    }
+}
+void beta_n8_m4(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*(x*(-1101377.0L/4402944000.0L*x + 14870423.0L/13208832000.0L) - 159755.0L/83026944.0L) + 1953779.0L/1320883200.0L) - 952949.0L/2235340800.0L) + 266681.0L/145297152000.0L) - 266681.0L/18162144000.0L) - 1.0L/823680.0L) + 1.0L/102960.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*(x*((617882417.0L/145297152000.0L)*x - 4729333.0L/247104000.0L) + 43207609.0L/1320883200.0L) - 913297027.0L/36324288000.0L) + 38966747.0L/5381376000.0L) - 21701.0L/567567000.0L) + 21701.0L/81081000.0L) + 8.0L/315315.0L) - 8.0L/45045.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*(x*(-463422059.0L/13621608000.0L*x + 189610079.0L/1238328000.0L) - 891181997.0L/3405402000.0L) + 273948221.0L/1362160800.0L) - 788229307.0L/13621608000.0L) + 1058149.0L/2724321600.0L) - 1058149.0L/454053600.0L) - 1.0L/3861.0L) + 2.0L/1287.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*(x*((42130577.0L/247665600.0L)*x - 18961871.0L/24766560.0L) + 7617133.0L/5821200.0L) - 1369431659.0L/1362160800.0L) + 787169833.0L/2724321600.0L) - 41981.0L/16216200.0L) + 41981.0L/3243240.0L) + 56.0L/32175.0L) - 56.0L/6435.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*(x*(-617941241.0L/1037836800.0L*x + 34336129.0L/12812800.0L) - 216051389.0L/47174400.0L) + 1825249697.0L/518918400.0L) - 349286711.0L/345945600.0L) + 1033649.0L/79833600.0L) - 1033649.0L/19958400.0L) - 7.0L/792.0L) + 7.0L/198.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*(x*((264845533.0L/171072000.0L)*x - 149002003.0L/21384000.0L) + 1425869503.0L/119750400.0L) - 177679.0L/19440.0L) + 627784987.0L/239500800.0L) - 999349.0L/18711000.0L) + 999349.0L/6237000.0L) + 56.0L/1485.0L) - 56.0L/495.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*(x*(-42136729.0L/13608000.0L*x + 189644803.0L/13608000.0L) - 5940337.0L/249480.0L) + 1367199013.0L/74844000.0L) - 786324923.0L/149688000.0L) + 901349.0L/4536000.0L) - 901349.0L/2268000.0L) - 7.0L/45.0L) + 14.0L/45.0L);
+        poly_val[7] = x*(x*(x*(x*(x*(x*(x*(x*((154508033.0L/31752000.0L)*x - 115893523.0L/5292000.0L) + 2651402.0L/70875.0L) - 18221291.0L/635040.0L) + 88029853.0L/10584000.0L) - 372149.0L/793800.0L) + 372149.0L/793800.0L) + 8.0L/9.0L) - 8.0L/9.0L);
+        poly_val[8] = pow(x, 2)*(pow(x, 2)*(x*(x*(x*(x*(-618047281.0L/101606400.0L*x + 5297753.0L/193536.0L) - 2375132021.0L/50803200.0L) + 1822225277.0L/50803200.0L) - 355812263.0L/33868800.0L) + 63566689.0L/101606400.0L) - 1077749.0L/705600.0L) + 1;
+        poly_val[9] = x*(x*(x*(x*(x*(x*(x*(x*((618047281.0L/101606400.0L)*x - 231758767.0L/8467200.0L) + 2374701779.0L/50803200.0L) - 303866687.0L/8467200.0L) + 119588617.0L/11289600.0L) - 372149.0L/793800.0L) - 372149.0L/793800.0L) + 8.0L/9.0L) + 8.0L/9.0L);
+        poly_val[10] = x*(x*(x*(x*(x*(x*(x*(x*(-154508033.0L/31752000.0L*x + 231737053.0L/10584000.0L) - 59361409.0L/1587600.0L) + 91229503.0L/3175200.0L) - 5997349.0L/705600.0L) + 901349.0L/4536000.0L) + 901349.0L/2268000.0L) - 7.0L/45.0L) - 14.0L/45.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*(x*((42136729.0L/13608000.0L)*x - 94792879.0L/6804000.0L) + 178080211.0L/7484400.0L) - 124488893.0L/6804000.0L) + 808490713.0L/149688000.0L) - 999349.0L/18711000.0L) - 999349.0L/6237000.0L) + 56.0L/1485.0L) + 56.0L/495.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*(x*(-264845533.0L/171072000.0L*x + 1191593773.0L/171072000.0L) - 23984633.0L/2016000.0L) + 156569593.0L/17107200.0L) - 3224840863.0L/1197504000.0L) + 1033649.0L/79833600.0L) + 1033649.0L/19958400.0L) - 7.0L/792.0L) - 7.0L/198.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*(x*((617941241.0L/1037836800.0L)*x - 351041.0L/131040.0L) + 2374601821.0L/518918400.0L) - 456767273.0L/129729600.0L) + 27500531.0L/26611200.0L) - 41981.0L/16216200.0L) - 41981.0L/3243240.0L) + 56.0L/32175.0L) + 56.0L/6435.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*(x*(-42130577.0L/247665600.0L*x + 189556483.0L/247665600.0L) - 7951072.0L/6081075.0L) + 1370477429.0L/1362160800.0L) - 803027411.0L/2724321600.0L) + 1058149.0L/2724321600.0L) + 1058149.0L/454053600.0L) - 1.0L/3861.0L) - 2.0L/1287.0L);
+        poly_val[15] = x*(x*(x*(x*(x*(x*(x*(x*((463422059.0L/13621608000.0L)*x - 148934833.0L/972972000.0L) + 2698663.0L/10319400.0L) - 274116233.0L/1362160800.0L) + 160398913.0L/2724321600.0L) - 21701.0L/567567000.0L) - 21701.0L/81081000.0L) + 8.0L/315315.0L) + 8.0L/45045.0L);
+        poly_val[16] = x*(x*(x*(x*(x*(x*(x*(x*(-617882417.0L/145297152000.0L*x + 926697983.0L/48432384000.0L) - 36537089.0L/1117670400.0L) + 166138879.0L/6604416000.0L) - 356085943.0L/48432384000.0L) + 266681.0L/145297152000.0L) + 266681.0L/18162144000.0L) - 1.0L/823680.0L) - 1.0L/102960.0L);
+        poly_val[17] = pow(x, 5)*(x*(x*(x*((1101377.0L/4402944000.0L)*x - 3716689.0L/3302208000.0L) + 46568317.0L/24216192000.0L) - 1194499.0L/807206400.0L) + 62788793.0L/145297152000.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*(-1101377.0L/489216000.0L*x + 14870423.0L/1651104000.0L) - 159755.0L/11860992.0L) + 1953779.0L/220147200.0L) - 952949.0L/447068160.0L) + 266681.0L/36324288000.0L) - 266681.0L/6054048000.0L) - 1.0L/411840.0L) + 1.0L/102960.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*((617882417.0L/16144128000.0L)*x - 4729333.0L/30888000.0L) + 43207609.0L/188697600.0L) - 913297027.0L/6054048000.0L) + 38966747.0L/1076275200.0L) - 21701.0L/141891750.0L) + 21701.0L/27027000.0L) + 16.0L/315315.0L) - 8.0L/45045.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*(-463422059.0L/1513512000.0L*x + 189610079.0L/154791000.0L) - 891181997.0L/486486000.0L) + 273948221.0L/227026800.0L) - 788229307.0L/2724321600.0L) + 1058149.0L/681080400.0L) - 1058149.0L/151351200.0L) - 2.0L/3861.0L) + 2.0L/1287.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*((42130577.0L/27518400.0L)*x - 18961871.0L/3095820.0L) + 7617133.0L/831600.0L) - 1369431659.0L/227026800.0L) + 787169833.0L/544864320.0L) - 41981.0L/4054050.0L) + 41981.0L/1081080.0L) + 112.0L/32175.0L) - 56.0L/6435.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*(-617941241.0L/115315200.0L*x + 34336129.0L/1601600.0L) - 216051389.0L/6739200.0L) + 1825249697.0L/86486400.0L) - 349286711.0L/69189120.0L) + 1033649.0L/19958400.0L) - 1033649.0L/6652800.0L) - 7.0L/396.0L) + 7.0L/198.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*((264845533.0L/19008000.0L)*x - 149002003.0L/2673000.0L) + 1425869503.0L/17107200.0L) - 177679.0L/3240.0L) + 627784987.0L/47900160.0L) - 999349.0L/4677750.0L) + 999349.0L/2079000.0L) + 112.0L/1485.0L) - 56.0L/495.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*(-42136729.0L/1512000.0L*x + 189644803.0L/1701000.0L) - 5940337.0L/35640.0L) + 1367199013.0L/12474000.0L) - 786324923.0L/29937600.0L) + 901349.0L/1134000.0L) - 901349.0L/756000.0L) - 14.0L/45.0L) + 14.0L/45.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(x*(x*((154508033.0L/3528000.0L)*x - 115893523.0L/661500.0L) + 2651402.0L/10125.0L) - 18221291.0L/105840.0L) + 88029853.0L/2116800.0L) - 372149.0L/198450.0L) + 372149.0L/264600.0L) + 16.0L/9.0L) - 8.0L/9.0L;
+        poly_val[8] = x*(pow(x, 2)*(x*(x*(x*(x*(-618047281.0L/11289600.0L*x + 5297753.0L/24192.0L) - 2375132021.0L/7257600.0L) + 1822225277.0L/8467200.0L) - 355812263.0L/6773760.0L) + 63566689.0L/25401600.0L) - 1077749.0L/352800.0L);
+        poly_val[9] = x*(x*(x*(x*(x*(x*(x*((618047281.0L/11289600.0L)*x - 231758767.0L/1058400.0L) + 2374701779.0L/7257600.0L) - 303866687.0L/1411200.0L) + 119588617.0L/2257920.0L) - 372149.0L/198450.0L) - 372149.0L/264600.0L) + 16.0L/9.0L) + 8.0L/9.0L;
+        poly_val[10] = x*(x*(x*(x*(x*(x*(x*(-154508033.0L/3528000.0L*x + 231737053.0L/1323000.0L) - 59361409.0L/226800.0L) + 91229503.0L/529200.0L) - 5997349.0L/141120.0L) + 901349.0L/1134000.0L) + 901349.0L/756000.0L) - 14.0L/45.0L) - 14.0L/45.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*((42136729.0L/1512000.0L)*x - 94792879.0L/850500.0L) + 178080211.0L/1069200.0L) - 124488893.0L/1134000.0L) + 808490713.0L/29937600.0L) - 999349.0L/4677750.0L) - 999349.0L/2079000.0L) + 112.0L/1485.0L) + 56.0L/495.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*(-264845533.0L/19008000.0L*x + 1191593773.0L/21384000.0L) - 23984633.0L/288000.0L) + 156569593.0L/2851200.0L) - 3224840863.0L/239500800.0L) + 1033649.0L/19958400.0L) + 1033649.0L/6652800.0L) - 7.0L/396.0L) - 7.0L/198.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*((617941241.0L/115315200.0L)*x - 351041.0L/16380.0L) + 2374601821.0L/74131200.0L) - 456767273.0L/21621600.0L) + 27500531.0L/5322240.0L) - 41981.0L/4054050.0L) - 41981.0L/1081080.0L) + 112.0L/32175.0L) + 56.0L/6435.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*(-42130577.0L/27518400.0L*x + 189556483.0L/30958200.0L) - 7951072.0L/868725.0L) + 1370477429.0L/227026800.0L) - 803027411.0L/544864320.0L) + 1058149.0L/681080400.0L) + 1058149.0L/151351200.0L) - 2.0L/3861.0L) - 2.0L/1287.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(x*(x*((463422059.0L/1513512000.0L)*x - 148934833.0L/121621500.0L) + 2698663.0L/1474200.0L) - 274116233.0L/227026800.0L) + 160398913.0L/544864320.0L) - 21701.0L/141891750.0L) - 21701.0L/27027000.0L) + 16.0L/315315.0L) + 8.0L/45045.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(x*(x*(-617882417.0L/16144128000.0L*x + 926697983.0L/6054048000.0L) - 36537089.0L/159667200.0L) + 166138879.0L/1100736000.0L) - 356085943.0L/9686476800.0L) + 266681.0L/36324288000.0L) + 266681.0L/6054048000.0L) - 1.0L/411840.0L) - 1.0L/102960.0L;
+        poly_val[17] = pow(x, 4)*(x*(x*(x*((1101377.0L/489216000.0L)*x - 3716689.0L/412776000.0L) + 46568317.0L/3459456000.0L) - 1194499.0L/134534400.0L) + 62788793.0L/29059430400.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(-1101377.0L/61152000.0L*x + 14870423.0L/235872000.0L) - 159755.0L/1976832.0L) + 1953779.0L/44029440.0L) - 952949.0L/111767040.0L) + 266681.0L/12108096000.0L) - 266681.0L/3027024000.0L) - 1.0L/411840.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*((617882417.0L/2018016000.0L)*x - 33105331.0L/30888000.0L) + 43207609.0L/31449600.0L) - 913297027.0L/1210809600.0L) + 38966747.0L/269068800.0L) - 21701.0L/47297250.0L) + 21701.0L/13513500.0L) + 16.0L/315315.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*(-463422059.0L/189189000.0L*x + 189610079.0L/22113000.0L) - 891181997.0L/81081000.0L) + 273948221.0L/45405360.0L) - 788229307.0L/681080400.0L) + 1058149.0L/227026800.0L) - 1058149.0L/75675600.0L) - 2.0L/3861.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*((42130577.0L/3439800.0L)*x - 18961871.0L/442260.0L) + 7617133.0L/138600.0L) - 1369431659.0L/45405360.0L) + 787169833.0L/136216080.0L) - 41981.0L/1351350.0L) + 41981.0L/540540.0L) + 112.0L/32175.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*(-617941241.0L/14414400.0L*x + 34336129.0L/228800.0L) - 216051389.0L/1123200.0L) + 1825249697.0L/17297280.0L) - 349286711.0L/17297280.0L) + 1033649.0L/6652800.0L) - 1033649.0L/3326400.0L) - 7.0L/396.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*((264845533.0L/2376000.0L)*x - 1043014021.0L/2673000.0L) + 1425869503.0L/2851200.0L) - 177679.0L/648.0L) + 627784987.0L/11975040.0L) - 999349.0L/1559250.0L) + 999349.0L/1039500.0L) + 112.0L/1485.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*(-42136729.0L/189000.0L*x + 189644803.0L/243000.0L) - 5940337.0L/5940.0L) + 1367199013.0L/2494800.0L) - 786324923.0L/7484400.0L) + 901349.0L/378000.0L) - 901349.0L/378000.0L) - 14.0L/45.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(x*((154508033.0L/441000.0L)*x - 115893523.0L/94500.0L) + 5302804.0L/3375.0L) - 18221291.0L/21168.0L) + 88029853.0L/529200.0L) - 372149.0L/66150.0L) + 372149.0L/132300.0L) + 16.0L/9.0L;
+        poly_val[8] = pow(x, 2)*(x*(x*(x*(x*(-618047281.0L/1411200.0L*x + 5297753.0L/3456.0L) - 2375132021.0L/1209600.0L) + 1822225277.0L/1693440.0L) - 355812263.0L/1693440.0L) + 63566689.0L/8467200.0L) - 1077749.0L/352800.0L;
+        poly_val[9] = x*(x*(x*(x*(x*(x*((618047281.0L/1411200.0L)*x - 231758767.0L/151200.0L) + 2374701779.0L/1209600.0L) - 303866687.0L/282240.0L) + 119588617.0L/564480.0L) - 372149.0L/66150.0L) - 372149.0L/132300.0L) + 16.0L/9.0L;
+        poly_val[10] = x*(x*(x*(x*(x*(x*(-154508033.0L/441000.0L*x + 231737053.0L/189000.0L) - 59361409.0L/37800.0L) + 91229503.0L/105840.0L) - 5997349.0L/35280.0L) + 901349.0L/378000.0L) + 901349.0L/378000.0L) - 14.0L/45.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*((42136729.0L/189000.0L)*x - 94792879.0L/121500.0L) + 178080211.0L/178200.0L) - 124488893.0L/226800.0L) + 808490713.0L/7484400.0L) - 999349.0L/1559250.0L) - 999349.0L/1039500.0L) + 112.0L/1485.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*(-264845533.0L/2376000.0L*x + 8341156411.0L/21384000.0L) - 23984633.0L/48000.0L) + 156569593.0L/570240.0L) - 3224840863.0L/59875200.0L) + 1033649.0L/6652800.0L) + 1033649.0L/3326400.0L) - 7.0L/396.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*((617941241.0L/14414400.0L)*x - 351041.0L/2340.0L) + 2374601821.0L/12355200.0L) - 456767273.0L/4324320.0L) + 27500531.0L/1330560.0L) - 41981.0L/1351350.0L) - 41981.0L/540540.0L) + 112.0L/32175.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*(-42130577.0L/3439800.0L*x + 189556483.0L/4422600.0L) - 15902144.0L/289575.0L) + 1370477429.0L/45405360.0L) - 803027411.0L/136216080.0L) + 1058149.0L/227026800.0L) + 1058149.0L/75675600.0L) - 2.0L/3861.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(x*((463422059.0L/189189000.0L)*x - 148934833.0L/17374500.0L) + 2698663.0L/245700.0L) - 274116233.0L/45405360.0L) + 160398913.0L/136216080.0L) - 21701.0L/47297250.0L) - 21701.0L/13513500.0L) + 16.0L/315315.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(x*(-617882417.0L/2018016000.0L*x + 926697983.0L/864864000.0L) - 36537089.0L/26611200.0L) + 166138879.0L/220147200.0L) - 356085943.0L/2421619200.0L) + 266681.0L/12108096000.0L) + 266681.0L/3027024000.0L) - 1.0L/411840.0L;
+        poly_val[17] = pow(x, 3)*(x*(x*(x*((1101377.0L/61152000.0L)*x - 3716689.0L/58968000.0L) + 46568317.0L/576576000.0L) - 1194499.0L/26906880.0L) + 62788793.0L/7264857600.0L);
+        break;
+    }
+}
diff --git a/bfps/cpp/spline_n8.hpp b/bfps/cpp/spline_n8.hpp
new file mode 100644
index 00000000..39dd4206
--- /dev/null
+++ b/bfps/cpp/spline_n8.hpp
@@ -0,0 +1,38 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2017 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#ifndef SPLINE_N8
+
+#define SPLINE_N8
+
+void beta_n8_m0(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n8_m1(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n8_m2(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n8_m3(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n8_m4(const int deriv, const double x, double *__restrict__ poly_val)
+
+#endif//SPLINE_N8
+
diff --git a/bfps/cpp/spline_n9.cpp b/bfps/cpp/spline_n9.cpp
new file mode 100644
index 00000000..4587a3f9
--- /dev/null
+++ b/bfps/cpp/spline_n9.cpp
@@ -0,0 +1,384 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2015 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#include "spline_n9.hpp"
+#include <cmath>
+
+void beta_n9_m0(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = -x + 1;
+        poly_val[10] = x;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        poly_val[18] = 0;
+        poly_val[19] = 0;
+        break;
+    case 1:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = -1;
+        poly_val[10] = 1;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        poly_val[18] = 0;
+        poly_val[19] = 0;
+        break;
+    case 2:
+        poly_val[0] = 0;
+        poly_val[1] = 0;
+        poly_val[2] = 0;
+        poly_val[3] = 0;
+        poly_val[4] = 0;
+        poly_val[5] = 0;
+        poly_val[6] = 0;
+        poly_val[7] = 0;
+        poly_val[8] = 0;
+        poly_val[9] = 0;
+        poly_val[10] = 0;
+        poly_val[11] = 0;
+        poly_val[12] = 0;
+        poly_val[13] = 0;
+        poly_val[14] = 0;
+        poly_val[15] = 0;
+        poly_val[16] = 0;
+        poly_val[17] = 0;
+        poly_val[18] = 0;
+        poly_val[19] = 0;
+        break;
+    }
+}
+void beta_n9_m1(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(-1.0L/437580.0L*x + 1.0L/218790.0L) - 1.0L/437580.0L);
+        poly_val[1] = x*(x*((7.0L/159120.0L)*x - 79.0L/875160.0L) + 9.0L/194480.0L);
+        poly_val[2] = x*(x*(-549.0L/1361360.0L*x + 1161.0L/1361360.0L) - 9.0L/20020.0L);
+        poly_val[3] = x*(x*((47.0L/20020.0L)*x - 103.0L/20020.0L) + 2.0L/715.0L);
+        poly_val[4] = x*(x*(-7.0L/715.0L*x + 16.0L/715.0L) - 9.0L/715.0L);
+        poly_val[5] = x*(x*((9.0L/286.0L)*x - 54.0L/715.0L) + 63.0L/1430.0L);
+        poly_val[6] = x*(x*(-119.0L/1430.0L*x + 301.0L/1430.0L) - 7.0L/55.0L);
+        poly_val[7] = x*(x*((1.0L/5.0L)*x - 29.0L/55.0L) + 18.0L/55.0L);
+        poly_val[8] = x*(x*(-63.0L/110.0L*x + 81.0L/55.0L) - 9.0L/10.0L);
+        poly_val[9] = pow(x, 2)*((11.0L/10.0L)*x - 21.0L/10.0L) + 1;
+        poly_val[10] = x*(x*(-11.0L/10.0L*x + 6.0L/5.0L) + 9.0L/10.0L);
+        poly_val[11] = x*(x*((63.0L/110.0L)*x - 27.0L/110.0L) - 18.0L/55.0L);
+        poly_val[12] = x*(x*(-1.0L/5.0L*x + 4.0L/55.0L) + 7.0L/55.0L);
+        poly_val[13] = x*(x*((119.0L/1430.0L)*x - 28.0L/715.0L) - 63.0L/1430.0L);
+        poly_val[14] = x*(x*(-9.0L/286.0L*x + 27.0L/1430.0L) + 9.0L/715.0L);
+        poly_val[15] = x*(x*((7.0L/715.0L)*x - 1.0L/143.0L) - 2.0L/715.0L);
+        poly_val[16] = x*(x*(-47.0L/20020.0L*x + 19.0L/10010.0L) + 9.0L/20020.0L);
+        poly_val[17] = x*(x*((549.0L/1361360.0L)*x - 243.0L/680680.0L) - 9.0L/194480.0L);
+        poly_val[18] = x*(x*(-7.0L/159120.0L*x + 73.0L/1750320.0L) + 1.0L/437580.0L);
+        poly_val[19] = pow(x, 2)*((1.0L/437580.0L)*x - 1.0L/437580.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(-1.0L/145860.0L*x + 1.0L/109395.0L) - 1.0L/437580.0L;
+        poly_val[1] = x*((7.0L/53040.0L)*x - 79.0L/437580.0L) + 9.0L/194480.0L;
+        poly_val[2] = x*(-1647.0L/1361360.0L*x + 1161.0L/680680.0L) - 9.0L/20020.0L;
+        poly_val[3] = x*((141.0L/20020.0L)*x - 103.0L/10010.0L) + 2.0L/715.0L;
+        poly_val[4] = x*(-21.0L/715.0L*x + 32.0L/715.0L) - 9.0L/715.0L;
+        poly_val[5] = x*((27.0L/286.0L)*x - 108.0L/715.0L) + 63.0L/1430.0L;
+        poly_val[6] = x*(-357.0L/1430.0L*x + 301.0L/715.0L) - 7.0L/55.0L;
+        poly_val[7] = x*((3.0L/5.0L)*x - 58.0L/55.0L) + 18.0L/55.0L;
+        poly_val[8] = x*(-189.0L/110.0L*x + 162.0L/55.0L) - 9.0L/10.0L;
+        poly_val[9] = x*((33.0L/10.0L)*x - 21.0L/5.0L);
+        poly_val[10] = x*(-33.0L/10.0L*x + 12.0L/5.0L) + 9.0L/10.0L;
+        poly_val[11] = x*((189.0L/110.0L)*x - 27.0L/55.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(-3.0L/5.0L*x + 8.0L/55.0L) + 7.0L/55.0L;
+        poly_val[13] = x*((357.0L/1430.0L)*x - 56.0L/715.0L) - 63.0L/1430.0L;
+        poly_val[14] = x*(-27.0L/286.0L*x + 27.0L/715.0L) + 9.0L/715.0L;
+        poly_val[15] = x*((21.0L/715.0L)*x - 2.0L/143.0L) - 2.0L/715.0L;
+        poly_val[16] = x*(-141.0L/20020.0L*x + 19.0L/5005.0L) + 9.0L/20020.0L;
+        poly_val[17] = x*((1647.0L/1361360.0L)*x - 243.0L/340340.0L) - 9.0L/194480.0L;
+        poly_val[18] = x*(-7.0L/53040.0L*x + 73.0L/875160.0L) + 1.0L/437580.0L;
+        poly_val[19] = x*((1.0L/145860.0L)*x - 1.0L/218790.0L);
+        break;
+    case 2:
+        poly_val[0] = -1.0L/72930.0L*x + 1.0L/109395.0L;
+        poly_val[1] = (7.0L/26520.0L)*x - 79.0L/437580.0L;
+        poly_val[2] = -1647.0L/680680.0L*x + 1161.0L/680680.0L;
+        poly_val[3] = (141.0L/10010.0L)*x - 103.0L/10010.0L;
+        poly_val[4] = -42.0L/715.0L*x + 32.0L/715.0L;
+        poly_val[5] = (27.0L/143.0L)*x - 108.0L/715.0L;
+        poly_val[6] = -357.0L/715.0L*x + 301.0L/715.0L;
+        poly_val[7] = (6.0L/5.0L)*x - 58.0L/55.0L;
+        poly_val[8] = -189.0L/55.0L*x + 162.0L/55.0L;
+        poly_val[9] = (33.0L/5.0L)*x - 21.0L/5.0L;
+        poly_val[10] = -33.0L/5.0L*x + 12.0L/5.0L;
+        poly_val[11] = (189.0L/55.0L)*x - 27.0L/55.0L;
+        poly_val[12] = -6.0L/5.0L*x + 8.0L/55.0L;
+        poly_val[13] = (357.0L/715.0L)*x - 56.0L/715.0L;
+        poly_val[14] = -27.0L/143.0L*x + 27.0L/715.0L;
+        poly_val[15] = (42.0L/715.0L)*x - 2.0L/143.0L;
+        poly_val[16] = -141.0L/10010.0L*x + 19.0L/5005.0L;
+        poly_val[17] = (1647.0L/680680.0L)*x - 243.0L/340340.0L;
+        poly_val[18] = -7.0L/26520.0L*x + 73.0L/875160.0L;
+        poly_val[19] = (1.0L/72930.0L)*x - 1.0L/218790.0L;
+        break;
+    }
+}
+void beta_n9_m2(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*((1.0L/151470.0L)*x - 23.0L/1312740.0L) + 1.0L/77220.0L) + 1.0L/3938220.0L) - 1.0L/437580.0L);
+        poly_val[1] = x*(x*(x*(x*(-15871.0L/126023040.0L*x + 42389.0L/126023040.0L) - 31621.0L/126023040.0L) - 9.0L/1555840.0L) + 9.0L/194480.0L);
+        poly_val[2] = x*(x*(x*(x*((17379.0L/15247232.0L)*x - 23391.0L/7623616.0L) + 176391.0L/76236160.0L) + 9.0L/140140.0L) - 9.0L/20020.0L);
+        poly_val[3] = x*(x*(x*(x*(-1369.0L/210210.0L*x + 2481.0L/140140.0L) - 379.0L/28028.0L) - 1.0L/2145.0L) + 2.0L/715.0L);
+        poly_val[4] = x*(x*(x*(x*((283.0L/10725.0L)*x - 779.0L/10725.0L) + 604.0L/10725.0L) + 9.0L/3575.0L) - 9.0L/715.0L);
+        poly_val[5] = x*(x*(x*(x*(-2313.0L/28600.0L*x + 6471.0L/28600.0L) - 5103.0L/28600.0L) - 63.0L/5720.0L) + 63.0L/1430.0L);
+        poly_val[6] = x*(x*(x*(x*((259.0L/1320.0L)*x - 1603.0L/2860.0L) + 2569.0L/5720.0L) + 7.0L/165.0L) - 7.0L/55.0L);
+        poly_val[7] = x*(x*(x*(x*(-13.0L/33.0L*x + 38.0L/33.0L) - 152.0L/165.0L) - 9.0L/55.0L) + 18.0L/55.0L);
+        poly_val[8] = x*(x*(x*(x*((36.0L/55.0L)*x - 207.0L/110.0L) + 27.0L/22.0L) + 9.0L/10.0L) - 9.0L/10.0L);
+        poly_val[9] = pow(x, 2)*(x*(x*(-5462819.0L/6350400.0L*x + 4827779.0L/2116800.0L) - 1864259.0L/2116800.0L) - 9778141.0L/6350400.0L) + 1;
+        poly_val[10] = x*(x*(x*(x*((5462819.0L/6350400.0L)*x - 6415379.0L/3175200.0L) + 2287619.0L/6350400.0L) + 9.0L/10.0L) + 9.0L/10.0L);
+        poly_val[11] = x*(x*(x*(x*(-36.0L/55.0L*x + 153.0L/110.0L) - 27.0L/110.0L) - 9.0L/55.0L) - 18.0L/55.0L);
+        poly_val[12] = x*(x*(x*(x*((13.0L/33.0L)*x - 9.0L/11.0L) + 14.0L/55.0L) + 7.0L/165.0L) + 7.0L/55.0L);
+        poly_val[13] = x*(x*(x*(x*(-259.0L/1320.0L*x + 7217.0L/17160.0L) - 581.0L/3432.0L) - 63.0L/5720.0L) - 63.0L/1430.0L);
+        poly_val[14] = x*(x*(x*(x*((2313.0L/28600.0L)*x - 2547.0L/14300.0L) + 2349.0L/28600.0L) + 9.0L/3575.0L) + 9.0L/715.0L);
+        poly_val[15] = x*(x*(x*(x*(-283.0L/10725.0L*x + 212.0L/3575.0L) - 106.0L/3575.0L) - 1.0L/2145.0L) - 2.0L/715.0L);
+        poly_val[16] = x*(x*(x*(x*((1369.0L/210210.0L)*x - 6247.0L/420420.0L) + 3293.0L/420420.0L) + 9.0L/140140.0L) + 9.0L/20020.0L);
+        poly_val[17] = x*(x*(x*(x*(-17379.0L/15247232.0L*x + 40113.0L/15247232.0L) - 6453.0L/4484480.0L) - 9.0L/1555840.0L) - 9.0L/194480.0L);
+        poly_val[18] = x*(x*(x*(x*((15871.0L/126023040.0L)*x - 6161.0L/21003840.0L) + 1385.0L/8401536.0L) + 1.0L/3938220.0L) + 1.0L/437580.0L);
+        poly_val[19] = pow(x, 3)*(x*(-1.0L/151470.0L*x + 61.0L/3938220.0L) - 7.0L/787644.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*((1.0L/30294.0L)*x - 23.0L/328185.0L) + 1.0L/25740.0L) + 1.0L/1969110.0L) - 1.0L/437580.0L;
+        poly_val[1] = x*(x*(x*(-15871.0L/25204608.0L*x + 42389.0L/31505760.0L) - 31621.0L/42007680.0L) - 9.0L/777920.0L) + 9.0L/194480.0L;
+        poly_val[2] = x*(x*(x*((86895.0L/15247232.0L)*x - 23391.0L/1905904.0L) + 529173.0L/76236160.0L) + 9.0L/70070.0L) - 9.0L/20020.0L;
+        poly_val[3] = x*(x*(x*(-1369.0L/42042.0L*x + 2481.0L/35035.0L) - 1137.0L/28028.0L) - 2.0L/2145.0L) + 2.0L/715.0L;
+        poly_val[4] = x*(x*(x*((283.0L/2145.0L)*x - 3116.0L/10725.0L) + 604.0L/3575.0L) + 18.0L/3575.0L) - 9.0L/715.0L;
+        poly_val[5] = x*(x*(x*(-2313.0L/5720.0L*x + 6471.0L/7150.0L) - 15309.0L/28600.0L) - 63.0L/2860.0L) + 63.0L/1430.0L;
+        poly_val[6] = x*(x*(x*((259.0L/264.0L)*x - 1603.0L/715.0L) + 7707.0L/5720.0L) + 14.0L/165.0L) - 7.0L/55.0L;
+        poly_val[7] = x*(x*(x*(-65.0L/33.0L*x + 152.0L/33.0L) - 152.0L/55.0L) - 18.0L/55.0L) + 18.0L/55.0L;
+        poly_val[8] = x*(x*(x*((36.0L/11.0L)*x - 414.0L/55.0L) + 81.0L/22.0L) + 9.0L/5.0L) - 9.0L/10.0L;
+        poly_val[9] = x*(x*(x*(-5462819.0L/1270080.0L*x + 4827779.0L/529200.0L) - 1864259.0L/705600.0L) - 9778141.0L/3175200.0L);
+        poly_val[10] = x*(x*(x*((5462819.0L/1270080.0L)*x - 6415379.0L/793800.0L) + 2287619.0L/2116800.0L) + 9.0L/5.0L) + 9.0L/10.0L;
+        poly_val[11] = x*(x*(x*(-36.0L/11.0L*x + 306.0L/55.0L) - 81.0L/110.0L) - 18.0L/55.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(x*(x*((65.0L/33.0L)*x - 36.0L/11.0L) + 42.0L/55.0L) + 14.0L/165.0L) + 7.0L/55.0L;
+        poly_val[13] = x*(x*(x*(-259.0L/264.0L*x + 7217.0L/4290.0L) - 581.0L/1144.0L) - 63.0L/2860.0L) - 63.0L/1430.0L;
+        poly_val[14] = x*(x*(x*((2313.0L/5720.0L)*x - 2547.0L/3575.0L) + 7047.0L/28600.0L) + 18.0L/3575.0L) + 9.0L/715.0L;
+        poly_val[15] = x*(x*(x*(-283.0L/2145.0L*x + 848.0L/3575.0L) - 318.0L/3575.0L) - 2.0L/2145.0L) - 2.0L/715.0L;
+        poly_val[16] = x*(x*(x*((1369.0L/42042.0L)*x - 6247.0L/105105.0L) + 3293.0L/140140.0L) + 9.0L/70070.0L) + 9.0L/20020.0L;
+        poly_val[17] = x*(x*(x*(-86895.0L/15247232.0L*x + 40113.0L/3811808.0L) - 19359.0L/4484480.0L) - 9.0L/777920.0L) - 9.0L/194480.0L;
+        poly_val[18] = x*(x*(x*((15871.0L/25204608.0L)*x - 6161.0L/5250960.0L) + 1385.0L/2800512.0L) + 1.0L/1969110.0L) + 1.0L/437580.0L;
+        poly_val[19] = pow(x, 2)*(x*(-1.0L/30294.0L*x + 61.0L/984555.0L) - 7.0L/262548.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*((2.0L/15147.0L)*x - 23.0L/109395.0L) + 1.0L/12870.0L) + 1.0L/1969110.0L;
+        poly_val[1] = x*(x*(-15871.0L/6301152.0L*x + 42389.0L/10501920.0L) - 31621.0L/21003840.0L) - 9.0L/777920.0L;
+        poly_val[2] = x*(x*((86895.0L/3811808.0L)*x - 70173.0L/1905904.0L) + 529173.0L/38118080.0L) + 9.0L/70070.0L;
+        poly_val[3] = x*(x*(-2738.0L/21021.0L*x + 7443.0L/35035.0L) - 1137.0L/14014.0L) - 2.0L/2145.0L;
+        poly_val[4] = x*(x*((1132.0L/2145.0L)*x - 3116.0L/3575.0L) + 1208.0L/3575.0L) + 18.0L/3575.0L;
+        poly_val[5] = x*(x*(-2313.0L/1430.0L*x + 19413.0L/7150.0L) - 15309.0L/14300.0L) - 63.0L/2860.0L;
+        poly_val[6] = x*(x*((259.0L/66.0L)*x - 4809.0L/715.0L) + 7707.0L/2860.0L) + 14.0L/165.0L;
+        poly_val[7] = x*(x*(-260.0L/33.0L*x + 152.0L/11.0L) - 304.0L/55.0L) - 18.0L/55.0L;
+        poly_val[8] = x*(x*((144.0L/11.0L)*x - 1242.0L/55.0L) + 81.0L/11.0L) + 9.0L/5.0L;
+        poly_val[9] = x*(x*(-5462819.0L/317520.0L*x + 4827779.0L/176400.0L) - 1864259.0L/352800.0L) - 9778141.0L/3175200.0L;
+        poly_val[10] = x*(x*((5462819.0L/317520.0L)*x - 6415379.0L/264600.0L) + 2287619.0L/1058400.0L) + 9.0L/5.0L;
+        poly_val[11] = x*(x*(-144.0L/11.0L*x + 918.0L/55.0L) - 81.0L/55.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(x*((260.0L/33.0L)*x - 108.0L/11.0L) + 84.0L/55.0L) + 14.0L/165.0L;
+        poly_val[13] = x*(x*(-259.0L/66.0L*x + 7217.0L/1430.0L) - 581.0L/572.0L) - 63.0L/2860.0L;
+        poly_val[14] = x*(x*((2313.0L/1430.0L)*x - 7641.0L/3575.0L) + 7047.0L/14300.0L) + 18.0L/3575.0L;
+        poly_val[15] = x*(x*(-1132.0L/2145.0L*x + 2544.0L/3575.0L) - 636.0L/3575.0L) - 2.0L/2145.0L;
+        poly_val[16] = x*(x*((2738.0L/21021.0L)*x - 6247.0L/35035.0L) + 3293.0L/70070.0L) + 9.0L/70070.0L;
+        poly_val[17] = x*(x*(-86895.0L/3811808.0L*x + 120339.0L/3811808.0L) - 19359.0L/2242240.0L) - 9.0L/777920.0L;
+        poly_val[18] = x*(x*((15871.0L/6301152.0L)*x - 6161.0L/1750320.0L) + 1385.0L/1400256.0L) + 1.0L/1969110.0L;
+        poly_val[19] = x*(x*(-2.0L/15147.0L*x + 61.0L/328185.0L) - 7.0L/131274.0L);
+        break;
+    }
+}
+void beta_n9_m3(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(-1888217.0L/102918816000.0L*x + 4978651.0L/77189112000.0L) - 11858753.0L/154378224000.0L) + 44201.0L/1513512000.0L) + 63397.0L/18162144000.0L) + 1.0L/3938220.0L) - 1.0L/437580.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*((3845371.0L/11027016000.0L)*x - 378705053.0L/308756448000.0L) + 451208881.0L/308756448000.0L) - 11393267.0L/20583763200.0L) - 10949.0L/155232000.0L) - 9.0L/1555840.0L) + 9.0L/194480.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*(-53864479.0L/17153136000.0L*x + 34466423.0L/3118752000.0L) - 50212829.0L/3811808000.0L) + 4865737.0L/980179200.0L) + 196909.0L/288288000.0L) + 9.0L/140140.0L) - 9.0L/20020.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*((323440939.0L/18162144000.0L)*x - 1139100889.0L/18162144000.0L) + 452791811.0L/6054048000.0L) - 2074439.0L/74131200.0L) - 9601741.0L/2270268000.0L) - 1.0L/2145.0L) + 2.0L/715.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*(-46260611.0L/648648000.0L*x + 190244191.0L/756756000.0L) - 28367477.0L/94594500.0L) + 252001891.0L/2270268000.0L) + 5861.0L/310464.0L) + 9.0L/3575.0L) - 9.0L/715.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*((216286123.0L/1009008000.0L)*x - 381611761.0L/504504000.0L) + 25287533.0L/28028000.0L) - 12734027.0L/38808000.0L) - 9381241.0L/144144000.0L) - 63.0L/5720.0L) + 63.0L/1430.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*(-650812303.0L/1297296000.0L*x + 328457149.0L/185328000.0L) - 912727037.0L/432432000.0L) + 192796181.0L/259459200.0L) + 9072541.0L/49896000.0L) + 7.0L/165.0L) - 7.0L/55.0L);
+        poly_val[7] = x*(x*(x*(x*(x*(x*((326737249.0L/349272000.0L)*x - 384845203.0L/116424000.0L) + 455197111.0L/116424000.0L) - 89503367.0L/69854400.0L) - 8190541.0L/19404000.0L) - 9.0L/55.0L) + 18.0L/55.0L);
+        poly_val[8] = x*(x*(x*(x*(x*(x*(-15623459.0L/11088000.0L*x + 12051359.0L/2425500.0L) - 24996777.0L/4312000.0L) + 3398939.0L/1940400.0L) + 3427741.0L/7056000.0L) + 9.0L/10.0L) - 9.0L/10.0L);
+        poly_val[9] = pow(x, 2)*(pow(x, 2)*(x*(x*((109653629.0L/63504000.0L)*x - 128296219.0L/21168000.0L) + 442116007.0L/63504000.0L) - 18943367.0L/9072000.0L) - 9778141.0L/6350400.0L) + 1;
+        poly_val[10] = x*(x*(x*(x*(x*(x*(-109653629.0L/63504000.0L*x + 191343373.0L/31752000.0L) - 217755137.0L/31752000.0L) + 10180259.0L/4536000.0L) - 3427741.0L/7056000.0L) + 9.0L/10.0L) + 9.0L/10.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*((15623459.0L/11088000.0L)*x - 379906003.0L/77616000.0L) + 48081059.0L/8624000.0L) - 31369501.0L/15523200.0L) + 8190541.0L/19404000.0L) - 9.0L/55.0L) - 18.0L/55.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*(-326737249.0L/349272000.0L*x + 566312567.0L/174636000.0L) - 108321659.0L/29106000.0L) + 49820941.0L/34927200.0L) - 9072541.0L/49896000.0L) + 7.0L/165.0L) + 7.0L/55.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*((650812303.0L/1297296000.0L)*x - 4884169.0L/2808000.0L) + 54375817.0L/27027000.0L) - 101735461.0L/129729600.0L) + 9381241.0L/144144000.0L) - 63.0L/5720.0L) - 63.0L/1430.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*(-216286123.0L/1009008000.0L*x + 750779339.0L/1009008000.0L) - 97002071.0L/112112000.0L) + 342332713.0L/1009008000.0L) - 5861.0L/310464.0L) + 9.0L/3575.0L) + 9.0L/715.0L);
+        poly_val[15] = x*(x*(x*(x*(x*(x*((46260611.0L/648648000.0L)*x - 1125304793.0L/4540536000.0L) + 437719279.0L/1513512000.0L) - 516063203.0L/4540536000.0L) + 9601741.0L/2270268000.0L) - 1.0L/2145.0L) - 2.0L/715.0L);
+        poly_val[16] = x*(x*(x*(x*(x*(x*(-323440939.0L/18162144000.0L*x + 93748807.0L/1513512000.0L) - 219338303.0L/3027024000.0L) + 3696851.0L/129729600.0L) - 196909.0L/288288000.0L) + 9.0L/140140.0L) + 9.0L/20020.0L);
+        poly_val[17] = x*(x*(x*(x*(x*(x*((53864479.0L/17153136000.0L)*x - 374972053.0L/34306272000.0L) + 48826629.0L/3811808000.0L) - 290471.0L/57657600.0L) + 10949.0L/155232000.0L) - 9.0L/1555840.0L) - 9.0L/194480.0L);
+        poly_val[18] = x*(x*(x*(x*(x*(x*(-3845371.0L/11027016000.0L*x + 374987663.0L/308756448000.0L) - 440056711.0L/308756448000.0L) + 2662049.0L/4750099200.0L) - 63397.0L/18162144000.0L) + 1.0L/3938220.0L) + 1.0L/437580.0L);
+        poly_val[19] = pow(x, 4)*(x*(x*((1888217.0L/102918816000.0L)*x - 19737953.0L/308756448000.0L) + 23187553.0L/308756448000.0L) - 9114251.0L/308756448000.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*(-1888217.0L/14702688000.0L*x + 4978651.0L/12864852000.0L) - 11858753.0L/30875644800.0L) + 44201.0L/378378000.0L) + 63397.0L/6054048000.0L) + 1.0L/1969110.0L) - 1.0L/437580.0L;
+        poly_val[1] = x*(x*(x*(x*(x*((3845371.0L/1575288000.0L)*x - 378705053.0L/51459408000.0L) + 451208881.0L/61751289600.0L) - 11393267.0L/5145940800.0L) - 10949.0L/51744000.0L) - 9.0L/777920.0L) + 9.0L/194480.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(-53864479.0L/2450448000.0L*x + 34466423.0L/519792000.0L) - 50212829.0L/762361600.0L) + 4865737.0L/245044800.0L) + 196909.0L/96096000.0L) + 9.0L/70070.0L) - 9.0L/20020.0L;
+        poly_val[3] = x*(x*(x*(x*(x*((323440939.0L/2594592000.0L)*x - 1139100889.0L/3027024000.0L) + 452791811.0L/1210809600.0L) - 2074439.0L/18532800.0L) - 9601741.0L/756756000.0L) - 2.0L/2145.0L) + 2.0L/715.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(-46260611.0L/92664000.0L*x + 190244191.0L/126126000.0L) - 28367477.0L/18918900.0L) + 252001891.0L/567567000.0L) + 5861.0L/103488.0L) + 18.0L/3575.0L) - 9.0L/715.0L;
+        poly_val[5] = x*(x*(x*(x*(x*((216286123.0L/144144000.0L)*x - 381611761.0L/84084000.0L) + 25287533.0L/5605600.0L) - 12734027.0L/9702000.0L) - 9381241.0L/48048000.0L) - 63.0L/2860.0L) + 63.0L/1430.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(-650812303.0L/185328000.0L*x + 328457149.0L/30888000.0L) - 912727037.0L/86486400.0L) + 192796181.0L/64864800.0L) + 9072541.0L/16632000.0L) + 14.0L/165.0L) - 7.0L/55.0L;
+        poly_val[7] = x*(x*(x*(x*(x*((326737249.0L/49896000.0L)*x - 384845203.0L/19404000.0L) + 455197111.0L/23284800.0L) - 89503367.0L/17463600.0L) - 8190541.0L/6468000.0L) - 18.0L/55.0L) + 18.0L/55.0L;
+        poly_val[8] = x*(x*(x*(x*(x*(-15623459.0L/1584000.0L*x + 12051359.0L/404250.0L) - 24996777.0L/862400.0L) + 3398939.0L/485100.0L) + 3427741.0L/2352000.0L) + 9.0L/5.0L) - 9.0L/10.0L;
+        poly_val[9] = x*(pow(x, 2)*(x*(x*((109653629.0L/9072000.0L)*x - 128296219.0L/3528000.0L) + 442116007.0L/12700800.0L) - 18943367.0L/2268000.0L) - 9778141.0L/3175200.0L);
+        poly_val[10] = x*(x*(x*(x*(x*(-109653629.0L/9072000.0L*x + 191343373.0L/5292000.0L) - 217755137.0L/6350400.0L) + 10180259.0L/1134000.0L) - 3427741.0L/2352000.0L) + 9.0L/5.0L) + 9.0L/10.0L;
+        poly_val[11] = x*(x*(x*(x*(x*((15623459.0L/1584000.0L)*x - 379906003.0L/12936000.0L) + 48081059.0L/1724800.0L) - 31369501.0L/3880800.0L) + 8190541.0L/6468000.0L) - 18.0L/55.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(-326737249.0L/49896000.0L*x + 566312567.0L/29106000.0L) - 108321659.0L/5821200.0L) + 49820941.0L/8731800.0L) - 9072541.0L/16632000.0L) + 14.0L/165.0L) + 7.0L/55.0L;
+        poly_val[13] = x*(x*(x*(x*(x*((650812303.0L/185328000.0L)*x - 4884169.0L/468000.0L) + 54375817.0L/5405400.0L) - 101735461.0L/32432400.0L) + 9381241.0L/48048000.0L) - 63.0L/2860.0L) - 63.0L/1430.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(-216286123.0L/144144000.0L*x + 750779339.0L/168168000.0L) - 97002071.0L/22422400.0L) + 342332713.0L/252252000.0L) - 5861.0L/103488.0L) + 18.0L/3575.0L) + 9.0L/715.0L;
+        poly_val[15] = x*(x*(x*(x*(x*((46260611.0L/92664000.0L)*x - 1125304793.0L/756756000.0L) + 437719279.0L/302702400.0L) - 516063203.0L/1135134000.0L) + 9601741.0L/756756000.0L) - 2.0L/2145.0L) - 2.0L/715.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(-323440939.0L/2594592000.0L*x + 93748807.0L/252252000.0L) - 219338303.0L/605404800.0L) + 3696851.0L/32432400.0L) - 196909.0L/96096000.0L) + 9.0L/70070.0L) + 9.0L/20020.0L;
+        poly_val[17] = x*(x*(x*(x*(x*((53864479.0L/2450448000.0L)*x - 374972053.0L/5717712000.0L) + 48826629.0L/762361600.0L) - 290471.0L/14414400.0L) + 10949.0L/51744000.0L) - 9.0L/777920.0L) - 9.0L/194480.0L;
+        poly_val[18] = x*(x*(x*(x*(x*(-3845371.0L/1575288000.0L*x + 374987663.0L/51459408000.0L) - 440056711.0L/61751289600.0L) + 2662049.0L/1187524800.0L) - 63397.0L/6054048000.0L) + 1.0L/1969110.0L) + 1.0L/437580.0L;
+        poly_val[19] = pow(x, 3)*(x*(x*((1888217.0L/14702688000.0L)*x - 19737953.0L/51459408000.0L) + 23187553.0L/61751289600.0L) - 9114251.0L/77189112000.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*(-1888217.0L/2450448000.0L*x + 4978651.0L/2572970400.0L) - 11858753.0L/7718911200.0L) + 44201.0L/126126000.0L) + 63397.0L/3027024000.0L) + 1.0L/1969110.0L;
+        poly_val[1] = x*(x*(x*(x*((3845371.0L/262548000.0L)*x - 378705053.0L/10291881600.0L) + 451208881.0L/15437822400.0L) - 11393267.0L/1715313600.0L) - 10949.0L/25872000.0L) - 9.0L/777920.0L;
+        poly_val[2] = x*(x*(x*(x*(-53864479.0L/408408000.0L*x + 34466423.0L/103958400.0L) - 50212829.0L/190590400.0L) + 4865737.0L/81681600.0L) + 196909.0L/48048000.0L) + 9.0L/70070.0L;
+        poly_val[3] = x*(x*(x*(x*((323440939.0L/432432000.0L)*x - 1139100889.0L/605404800.0L) + 452791811.0L/302702400.0L) - 2074439.0L/6177600.0L) - 9601741.0L/378378000.0L) - 2.0L/2145.0L;
+        poly_val[4] = x*(x*(x*(x*(-46260611.0L/15444000.0L*x + 190244191.0L/25225200.0L) - 28367477.0L/4729725.0L) + 252001891.0L/189189000.0L) + 5861.0L/51744.0L) + 18.0L/3575.0L;
+        poly_val[5] = x*(x*(x*(x*((216286123.0L/24024000.0L)*x - 381611761.0L/16816800.0L) + 25287533.0L/1401400.0L) - 12734027.0L/3234000.0L) - 9381241.0L/24024000.0L) - 63.0L/2860.0L;
+        poly_val[6] = x*(x*(x*(x*(-650812303.0L/30888000.0L*x + 328457149.0L/6177600.0L) - 912727037.0L/21621600.0L) + 192796181.0L/21621600.0L) + 9072541.0L/8316000.0L) + 14.0L/165.0L;
+        poly_val[7] = x*(x*(x*(x*((326737249.0L/8316000.0L)*x - 384845203.0L/3880800.0L) + 455197111.0L/5821200.0L) - 89503367.0L/5821200.0L) - 8190541.0L/3234000.0L) - 18.0L/55.0L;
+        poly_val[8] = x*(x*(x*(x*(-15623459.0L/264000.0L*x + 12051359.0L/80850.0L) - 24996777.0L/215600.0L) + 3398939.0L/161700.0L) + 3427741.0L/1176000.0L) + 9.0L/5.0L;
+        poly_val[9] = pow(x, 2)*(x*(x*((109653629.0L/1512000.0L)*x - 128296219.0L/705600.0L) + 442116007.0L/3175200.0L) - 18943367.0L/756000.0L) - 9778141.0L/3175200.0L;
+        poly_val[10] = x*(x*(x*(x*(-109653629.0L/1512000.0L*x + 191343373.0L/1058400.0L) - 217755137.0L/1587600.0L) + 10180259.0L/378000.0L) - 3427741.0L/1176000.0L) + 9.0L/5.0L;
+        poly_val[11] = x*(x*(x*(x*((15623459.0L/264000.0L)*x - 379906003.0L/2587200.0L) + 48081059.0L/431200.0L) - 31369501.0L/1293600.0L) + 8190541.0L/3234000.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(x*(x*(x*(-326737249.0L/8316000.0L*x + 566312567.0L/5821200.0L) - 108321659.0L/1455300.0L) + 49820941.0L/2910600.0L) - 9072541.0L/8316000.0L) + 14.0L/165.0L;
+        poly_val[13] = x*(x*(x*(x*((650812303.0L/30888000.0L)*x - 4884169.0L/93600.0L) + 54375817.0L/1351350.0L) - 101735461.0L/10810800.0L) + 9381241.0L/24024000.0L) - 63.0L/2860.0L;
+        poly_val[14] = x*(x*(x*(x*(-216286123.0L/24024000.0L*x + 750779339.0L/33633600.0L) - 97002071.0L/5605600.0L) + 342332713.0L/84084000.0L) - 5861.0L/51744.0L) + 18.0L/3575.0L;
+        poly_val[15] = x*(x*(x*(x*((46260611.0L/15444000.0L)*x - 1125304793.0L/151351200.0L) + 437719279.0L/75675600.0L) - 516063203.0L/378378000.0L) + 9601741.0L/378378000.0L) - 2.0L/2145.0L;
+        poly_val[16] = x*(x*(x*(x*(-323440939.0L/432432000.0L*x + 93748807.0L/50450400.0L) - 219338303.0L/151351200.0L) + 3696851.0L/10810800.0L) - 196909.0L/48048000.0L) + 9.0L/70070.0L;
+        poly_val[17] = x*(x*(x*(x*((53864479.0L/408408000.0L)*x - 374972053.0L/1143542400.0L) + 48826629.0L/190590400.0L) - 290471.0L/4804800.0L) + 10949.0L/25872000.0L) - 9.0L/777920.0L;
+        poly_val[18] = x*(x*(x*(x*(-3845371.0L/262548000.0L*x + 374987663.0L/10291881600.0L) - 440056711.0L/15437822400.0L) + 2662049.0L/395841600.0L) - 63397.0L/3027024000.0L) + 1.0L/1969110.0L;
+        poly_val[19] = pow(x, 2)*(x*(x*((1888217.0L/2450448000.0L)*x - 19737953.0L/10291881600.0L) + 23187553.0L/15437822400.0L) - 9114251.0L/25729704000.0L);
+        break;
+    }
+}
+void beta_n9_m4(int deriv, double x, double *poly_val) {
+    switch(deriv)
+    {
+    case 0:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*(x*((41064761.0L/694702008000.0L)*x - 739266961.0L/2778808032000.0L) + 19438393.0L/42750892800.0L) - 252257.0L/721768320.0L) + 1645439.0L/16345929600.0L) - 63397.0L/163459296000.0L) + 63397.0L/18162144000.0L) + 1.0L/3938220.0L) - 1.0L/437580.0L);
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*(x*(-24967737721.0L/22230464256000.0L*x + 112371677293.0L/22230464256000.0L) - 32009510671.0L/3705077376000.0L) + 73804272761.0L/11115232128000.0L) - 2040029.0L/1067489280.0L) + 10949.0L/1241856000.0L) - 10949.0L/155232000.0L) - 9.0L/1555840.0L) + 9.0L/194480.0L);
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*(x*((2774247673.0L/274450176000.0L)*x - 346838241.0L/7623616000.0L) + 27714803.0L/356428800.0L) - 4099765343.0L/68612544000.0L) + 1571889307.0L/91483392000.0L) - 196909.0L/2018016000.0L) + 196909.0L/288288000.0L) + 9.0L/140140.0L) - 9.0L/20020.0L);
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*(x*(-390139199.0L/6810804000.0L*x + 14047573997.0L/54486432000.0L) - 3429833893.0L/7783776000.0L) + 67075889.0L/198132480.0L) - 58224899.0L/598752000.0L) + 9601741.0L/13621608000.0L) - 9601741.0L/2270268000.0L) - 1.0L/2145.0L) + 2.0L/715.0L);
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*(x*((3121232971.0L/13621608000.0L)*x - 2809674701.0L/2724321600.0L) + 8003230493.0L/4540536000.0L) - 4610296543.0L/3405402000.0L) + 5290082767.0L/13621608000.0L) - 5861.0L/1552320.0L) + 5861.0L/310464.0L) + 9.0L/3575.0L) - 9.0L/715.0L);
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*(x*(-2774576947.0L/4036032000.0L*x + 1387590587.0L/448448000.0L) - 2134234717.0L/403603200.0L) + 234077981.0L/57657600.0L) - 62576029.0L/53813760.0L) + 9381241.0L/576576000.0L) - 9381241.0L/144144000.0L) - 63.0L/5720.0L) + 63.0L/1430.0L);
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*(x*((3567551993.0L/2223936000.0L)*x - 1003596169.0L/138996000.0L) + 96036348283.0L/7783776000.0L) - 119617651.0L/12636000.0L) + 8431990223.0L/3113510400.0L) - 9072541.0L/149688000.0L) + 9072541.0L/49896000.0L) + 7.0L/165.0L) - 7.0L/55.0L);
+        poly_val[7] = x*(x*(x*(x*(x*(x*(x*(x*(-3121831129.0L/1047816000.0L*x + 3512754907.0L/261954000.0L) - 29097643.0L/1270080.0L) + 2629412623.0L/149688000.0L) - 2639918789.0L/523908000.0L) + 8190541.0L/38808000.0L) - 8190541.0L/19404000.0L) - 9.0L/55.0L) + 18.0L/55.0L);
+        poly_val[8] = x*(x*(x*(x*(x*(x*(x*(x*((173445649.0L/38808000.0L)*x - 173469767.0L/8624000.0L) + 2666634419.0L/77616000.0L) - 204389797.0L/7761600.0L) + 7042859.0L/924000.0L) - 3427741.0L/7056000.0L) + 3427741.0L/7056000.0L) + 9.0L/10.0L) - 9.0L/10.0L);
+        poly_val[9] = pow(x, 2)*(pow(x, 2)*(x*(x*(x*(x*(-24977055133.0L/4572288000.0L*x + 4496095937.0L/182891520.0L) - 13710284363.0L/326592000.0L) + 73580652293.0L/2286144000.0L) - 43121414201.0L/4572288000.0L) + 117868837.0L/182891520.0L) - 9778141.0L/6350400.0L) + 1;
+        poly_val[10] = x*(x*(x*(x*(x*(x*(x*(x*((24977055133.0L/4572288000.0L)*x - 28097774443.0L/1143072000.0L) + 913803707.0L/21772800.0L) - 7362601913.0L/228614400.0L) + 1244337839.0L/130636800.0L) - 3427741.0L/7056000.0L) - 3427741.0L/7056000.0L) + 9.0L/10.0L) + 9.0L/10.0L);
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*(x*(-173445649.0L/38808000.0L*x + 173421531.0L/8624000.0L) - 2664897923.0L/77616000.0L) + 186093701.0L/7056000.0L) - 40471741.0L/5174400.0L) + 8190541.0L/38808000.0L) + 8190541.0L/19404000.0L) - 9.0L/55.0L) - 18.0L/55.0L);
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*(x*((3121831129.0L/1047816000.0L)*x - 14045460533.0L/1047816000.0L) + 4796663819.0L/209563200.0L) - 41156842.0L/2338875.0L) + 5454795473.0L/1047816000.0L) - 9072541.0L/149688000.0L) - 9072541.0L/49896000.0L) + 7.0L/165.0L) + 7.0L/55.0L);
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*(x*(-3567551993.0L/2223936000.0L*x + 16050429233.0L/2223936000.0L) - 223628941.0L/18144000.0L) + 2108327369.0L/222393600.0L) - 43498588667.0L/15567552000.0L) + 9381241.0L/576576000.0L) + 9381241.0L/144144000.0L) - 63.0L/5720.0L) - 63.0L/1430.0L);
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*(x*((2774576947.0L/4036032000.0L)*x - 34674659.0L/11211200.0L) + 10660297499.0L/2018016000.0L) - 26627609.0L/6552000.0L) + 1606926733.0L/1345344000.0L) - 5861.0L/1552320.0L) - 5861.0L/310464.0L) + 9.0L/3575.0L) + 9.0L/715.0L);
+        poly_val[15] = x*(x*(x*(x*(x*(x*(x*(x*(-3121232971.0L/13621608000.0L*x + 7021361617.0L/6810804000.0L) - 4797418079.0L/2724321600.0L) + 3691153121.0L/2724321600.0L) - 38663749.0L/97297200.0L) + 9601741.0L/13621608000.0L) + 9601741.0L/2270268000.0L) - 1.0L/2145.0L) - 2.0L/715.0L);
+        poly_val[16] = x*(x*(x*(x*(x*(x*(x*(x*((390139199.0L/6810804000.0L)*x - 14042448331.0L/54486432000.0L) + 1142301647.0L/2594592000.0L) - 9228730547.0L/27243216000.0L) + 41576923.0L/419126400.0L) - 196909.0L/2018016000.0L) - 196909.0L/288288000.0L) + 9.0L/140140.0L) + 9.0L/20020.0L);
+        poly_val[17] = x*(x*(x*(x*(x*(x*(x*(x*(-2774247673.0L/274450176000.0L*x + 1386894709.0L/30494464000.0L) - 304627159.0L/3920716800.0L) + 745799291.0L/12475008000.0L) - 1920359.0L/109824000.0L) + 10949.0L/1241856000.0L) + 10949.0L/155232000.0L) - 9.0L/1555840.0L) - 9.0L/194480.0L);
+        poly_val[18] = x*(x*(x*(x*(x*(x*(x*(x*((24967737721.0L/22230464256000.0L)*x - 28084490549.0L/5557616064000.0L) + 8723736529.0L/1010475648000.0L) - 7383695351.0L/1111523212800.0L) + 2538335281.0L/1307674368000.0L) - 63397.0L/163459296000.0L) - 63397.0L/18162144000.0L) + 1.0L/3938220.0L) + 1.0L/437580.0L);
+        poly_val[19] = pow(x, 5)*(x*(x*(x*(-41064761.0L/694702008000.0L*x + 147812887.0L/555761606400.0L) - 420895147.0L/926269344000.0L) + 138794879.0L/396972576000.0L) - 283684103.0L/2778808032000.0L);
+        break;
+    case 1:
+        poly_val[0] = x*(x*(x*(x*(x*(x*(x*((41064761.0L/77189112000.0L)*x - 739266961.0L/347351004000.0L) + 19438393.0L/6107270400.0L) - 252257.0L/120294720.0L) + 1645439.0L/3269185920.0L) - 63397.0L/40864824000.0L) + 63397.0L/6054048000.0L) + 1.0L/1969110.0L) - 1.0L/437580.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*(x*(-24967737721.0L/2470051584000.0L*x + 112371677293.0L/2778808032000.0L) - 32009510671.0L/529296768000.0L) + 73804272761.0L/1852538688000.0L) - 2040029.0L/213497856.0L) + 10949.0L/310464000.0L) - 10949.0L/51744000.0L) - 9.0L/777920.0L) + 9.0L/194480.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*(x*((2774247673.0L/30494464000.0L)*x - 346838241.0L/952952000.0L) + 27714803.0L/50918400.0L) - 4099765343.0L/11435424000.0L) + 1571889307.0L/18296678400.0L) - 196909.0L/504504000.0L) + 196909.0L/96096000.0L) + 9.0L/70070.0L) - 9.0L/20020.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*(x*(-390139199.0L/756756000.0L*x + 14047573997.0L/6810804000.0L) - 3429833893.0L/1111968000.0L) + 67075889.0L/33022080.0L) - 58224899.0L/119750400.0L) + 9601741.0L/3405402000.0L) - 9601741.0L/756756000.0L) - 2.0L/2145.0L) + 2.0L/715.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*(x*((3121232971.0L/1513512000.0L)*x - 2809674701.0L/340540200.0L) + 8003230493.0L/648648000.0L) - 4610296543.0L/567567000.0L) + 5290082767.0L/2724321600.0L) - 5861.0L/388080.0L) + 5861.0L/103488.0L) + 18.0L/3575.0L) - 9.0L/715.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*(x*(-2774576947.0L/448448000.0L*x + 1387590587.0L/56056000.0L) - 2134234717.0L/57657600.0L) + 234077981.0L/9609600.0L) - 62576029.0L/10762752.0L) + 9381241.0L/144144000.0L) - 9381241.0L/48048000.0L) - 63.0L/2860.0L) + 63.0L/1430.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*(x*((3567551993.0L/247104000.0L)*x - 1003596169.0L/17374500.0L) + 96036348283.0L/1111968000.0L) - 119617651.0L/2106000.0L) + 8431990223.0L/622702080.0L) - 9072541.0L/37422000.0L) + 9072541.0L/16632000.0L) + 14.0L/165.0L) - 7.0L/55.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(x*(x*(-3121831129.0L/116424000.0L*x + 3512754907.0L/32744250.0L) - 29097643.0L/181440.0L) + 2629412623.0L/24948000.0L) - 2639918789.0L/104781600.0L) + 8190541.0L/9702000.0L) - 8190541.0L/6468000.0L) - 18.0L/55.0L) + 18.0L/55.0L;
+        poly_val[8] = x*(x*(x*(x*(x*(x*(x*((173445649.0L/4312000.0L)*x - 173469767.0L/1078000.0L) + 2666634419.0L/11088000.0L) - 204389797.0L/1293600.0L) + 7042859.0L/184800.0L) - 3427741.0L/1764000.0L) + 3427741.0L/2352000.0L) + 9.0L/5.0L) - 9.0L/10.0L;
+        poly_val[9] = x*(pow(x, 2)*(x*(x*(x*(x*(-24977055133.0L/508032000.0L*x + 4496095937.0L/22861440.0L) - 13710284363.0L/46656000.0L) + 73580652293.0L/381024000.0L) - 43121414201.0L/914457600.0L) + 117868837.0L/45722880.0L) - 9778141.0L/3175200.0L);
+        poly_val[10] = x*(x*(x*(x*(x*(x*(x*((24977055133.0L/508032000.0L)*x - 28097774443.0L/142884000.0L) + 913803707.0L/3110400.0L) - 7362601913.0L/38102400.0L) + 1244337839.0L/26127360.0L) - 3427741.0L/1764000.0L) - 3427741.0L/2352000.0L) + 9.0L/5.0L) + 9.0L/10.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(x*(-173445649.0L/4312000.0L*x + 173421531.0L/1078000.0L) - 2664897923.0L/11088000.0L) + 186093701.0L/1176000.0L) - 40471741.0L/1034880.0L) + 8190541.0L/9702000.0L) + 8190541.0L/6468000.0L) - 18.0L/55.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*(x*((3121831129.0L/116424000.0L)*x - 14045460533.0L/130977000.0L) + 4796663819.0L/29937600.0L) - 82313684.0L/779625.0L) + 5454795473.0L/209563200.0L) - 9072541.0L/37422000.0L) - 9072541.0L/16632000.0L) + 14.0L/165.0L) + 7.0L/55.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*(x*(-3567551993.0L/247104000.0L*x + 16050429233.0L/277992000.0L) - 223628941.0L/2592000.0L) + 2108327369.0L/37065600.0L) - 43498588667.0L/3113510400.0L) + 9381241.0L/144144000.0L) + 9381241.0L/48048000.0L) - 63.0L/2860.0L) - 63.0L/1430.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*(x*((2774576947.0L/448448000.0L)*x - 34674659.0L/1401400.0L) + 10660297499.0L/288288000.0L) - 26627609.0L/1092000.0L) + 1606926733.0L/269068800.0L) - 5861.0L/388080.0L) - 5861.0L/103488.0L) + 18.0L/3575.0L) + 9.0L/715.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(x*(x*(-3121232971.0L/1513512000.0L*x + 7021361617.0L/851350500.0L) - 4797418079.0L/389188800.0L) + 3691153121.0L/454053600.0L) - 38663749.0L/19459440.0L) + 9601741.0L/3405402000.0L) + 9601741.0L/756756000.0L) - 2.0L/2145.0L) - 2.0L/715.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(x*(x*((390139199.0L/756756000.0L)*x - 14042448331.0L/6810804000.0L) + 1142301647.0L/370656000.0L) - 9228730547.0L/4540536000.0L) + 41576923.0L/83825280.0L) - 196909.0L/504504000.0L) - 196909.0L/96096000.0L) + 9.0L/70070.0L) + 9.0L/20020.0L;
+        poly_val[17] = x*(x*(x*(x*(x*(x*(x*(-2774247673.0L/30494464000.0L*x + 1386894709.0L/3811808000.0L) - 304627159.0L/560102400.0L) + 745799291.0L/2079168000.0L) - 1920359.0L/21964800.0L) + 10949.0L/310464000.0L) + 10949.0L/51744000.0L) - 9.0L/777920.0L) - 9.0L/194480.0L;
+        poly_val[18] = x*(x*(x*(x*(x*(x*(x*((24967737721.0L/2470051584000.0L)*x - 28084490549.0L/694702008000.0L) + 8723736529.0L/144353664000.0L) - 7383695351.0L/185253868800.0L) + 2538335281.0L/261534873600.0L) - 63397.0L/40864824000.0L) - 63397.0L/6054048000.0L) + 1.0L/1969110.0L) + 1.0L/437580.0L;
+        poly_val[19] = pow(x, 4)*(x*(x*(x*(-41064761.0L/77189112000.0L*x + 147812887.0L/69470200800.0L) - 420895147.0L/132324192000.0L) + 138794879.0L/66162096000.0L) - 283684103.0L/555761606400.0L);
+        break;
+    case 2:
+        poly_val[0] = x*(x*(x*(x*(x*(x*((41064761.0L/9648639000.0L)*x - 739266961.0L/49621572000.0L) + 19438393.0L/1017878400.0L) - 252257.0L/24058944.0L) + 1645439.0L/817296480.0L) - 63397.0L/13621608000.0L) + 63397.0L/3027024000.0L) + 1.0L/1969110.0L;
+        poly_val[1] = x*(x*(x*(x*(x*(x*(-24967737721.0L/308756448000.0L*x + 112371677293.0L/396972576000.0L) - 32009510671.0L/88216128000.0L) + 73804272761.0L/370507737600.0L) - 2040029.0L/53374464.0L) + 10949.0L/103488000.0L) - 10949.0L/25872000.0L) - 9.0L/777920.0L;
+        poly_val[2] = x*(x*(x*(x*(x*(x*((2774247673.0L/3811808000.0L)*x - 346838241.0L/136136000.0L) + 27714803.0L/8486400.0L) - 4099765343.0L/2287084800.0L) + 1571889307.0L/4574169600.0L) - 196909.0L/168168000.0L) + 196909.0L/48048000.0L) + 9.0L/70070.0L;
+        poly_val[3] = x*(x*(x*(x*(x*(x*(-390139199.0L/94594500.0L*x + 14047573997.0L/972972000.0L) - 3429833893.0L/185328000.0L) + 67075889.0L/6604416.0L) - 58224899.0L/29937600.0L) + 9601741.0L/1135134000.0L) - 9601741.0L/378378000.0L) - 2.0L/2145.0L;
+        poly_val[4] = x*(x*(x*(x*(x*(x*((3121232971.0L/189189000.0L)*x - 2809674701.0L/48648600.0L) + 8003230493.0L/108108000.0L) - 4610296543.0L/113513400.0L) + 5290082767.0L/681080400.0L) - 5861.0L/129360.0L) + 5861.0L/51744.0L) + 18.0L/3575.0L;
+        poly_val[5] = x*(x*(x*(x*(x*(x*(-2774576947.0L/56056000.0L*x + 1387590587.0L/8008000.0L) - 2134234717.0L/9609600.0L) + 234077981.0L/1921920.0L) - 62576029.0L/2690688.0L) + 9381241.0L/48048000.0L) - 9381241.0L/24024000.0L) - 63.0L/2860.0L;
+        poly_val[6] = x*(x*(x*(x*(x*(x*((3567551993.0L/30888000.0L)*x - 7025173183.0L/17374500.0L) + 96036348283.0L/185328000.0L) - 119617651.0L/421200.0L) + 8431990223.0L/155675520.0L) - 9072541.0L/12474000.0L) + 9072541.0L/8316000.0L) + 14.0L/165.0L;
+        poly_val[7] = x*(x*(x*(x*(x*(x*(-3121831129.0L/14553000.0L*x + 3512754907.0L/4677750.0L) - 29097643.0L/30240.0L) + 2629412623.0L/4989600.0L) - 2639918789.0L/26195400.0L) + 8190541.0L/3234000.0L) - 8190541.0L/3234000.0L) - 18.0L/55.0L;
+        poly_val[8] = x*(x*(x*(x*(x*(x*((173445649.0L/539000.0L)*x - 173469767.0L/154000.0L) + 2666634419.0L/1848000.0L) - 204389797.0L/258720.0L) + 7042859.0L/46200.0L) - 3427741.0L/588000.0L) + 3427741.0L/1176000.0L) + 9.0L/5.0L;
+        poly_val[9] = pow(x, 2)*(x*(x*(x*(x*(-24977055133.0L/63504000.0L*x + 4496095937.0L/3265920.0L) - 13710284363.0L/7776000.0L) + 73580652293.0L/76204800.0L) - 43121414201.0L/228614400.0L) + 117868837.0L/15240960.0L) - 9778141.0L/3175200.0L;
+        poly_val[10] = x*(x*(x*(x*(x*(x*((24977055133.0L/63504000.0L)*x - 28097774443.0L/20412000.0L) + 913803707.0L/518400.0L) - 7362601913.0L/7620480.0L) + 1244337839.0L/6531840.0L) - 3427741.0L/588000.0L) - 3427741.0L/1176000.0L) + 9.0L/5.0L;
+        poly_val[11] = x*(x*(x*(x*(x*(x*(-173445649.0L/539000.0L*x + 173421531.0L/154000.0L) - 2664897923.0L/1848000.0L) + 186093701.0L/235200.0L) - 40471741.0L/258720.0L) + 8190541.0L/3234000.0L) + 8190541.0L/3234000.0L) - 18.0L/55.0L;
+        poly_val[12] = x*(x*(x*(x*(x*(x*((3121831129.0L/14553000.0L)*x - 14045460533.0L/18711000.0L) + 4796663819.0L/4989600.0L) - 82313684.0L/155925.0L) + 5454795473.0L/52390800.0L) - 9072541.0L/12474000.0L) - 9072541.0L/8316000.0L) + 14.0L/165.0L;
+        poly_val[13] = x*(x*(x*(x*(x*(x*(-3567551993.0L/30888000.0L*x + 112353004631.0L/277992000.0L) - 223628941.0L/432000.0L) + 2108327369.0L/7413120.0L) - 43498588667.0L/778377600.0L) + 9381241.0L/48048000.0L) + 9381241.0L/24024000.0L) - 63.0L/2860.0L;
+        poly_val[14] = x*(x*(x*(x*(x*(x*((2774576947.0L/56056000.0L)*x - 34674659.0L/200200.0L) + 10660297499.0L/48048000.0L) - 26627609.0L/218400.0L) + 1606926733.0L/67267200.0L) - 5861.0L/129360.0L) - 5861.0L/51744.0L) + 18.0L/3575.0L;
+        poly_val[15] = x*(x*(x*(x*(x*(x*(-3121232971.0L/189189000.0L*x + 7021361617.0L/121621500.0L) - 4797418079.0L/64864800.0L) + 3691153121.0L/90810720.0L) - 38663749.0L/4864860.0L) + 9601741.0L/1135134000.0L) + 9601741.0L/378378000.0L) - 2.0L/2145.0L;
+        poly_val[16] = x*(x*(x*(x*(x*(x*((390139199.0L/94594500.0L)*x - 14042448331.0L/972972000.0L) + 1142301647.0L/61776000.0L) - 9228730547.0L/908107200.0L) + 41576923.0L/20956320.0L) - 196909.0L/168168000.0L) - 196909.0L/48048000.0L) + 9.0L/70070.0L;
+        poly_val[17] = x*(x*(x*(x*(x*(x*(-2774247673.0L/3811808000.0L*x + 1386894709.0L/544544000.0L) - 304627159.0L/93350400.0L) + 745799291.0L/415833600.0L) - 1920359.0L/5491200.0L) + 10949.0L/103488000.0L) + 10949.0L/25872000.0L) - 9.0L/777920.0L;
+        poly_val[18] = x*(x*(x*(x*(x*(x*((24967737721.0L/308756448000.0L)*x - 28084490549.0L/99243144000.0L) + 8723736529.0L/24058944000.0L) - 7383695351.0L/37050773760.0L) + 2538335281.0L/65383718400.0L) - 63397.0L/13621608000.0L) - 63397.0L/3027024000.0L) + 1.0L/1969110.0L;
+        poly_val[19] = pow(x, 3)*(x*(x*(x*(-41064761.0L/9648639000.0L*x + 147812887.0L/9924314400.0L) - 420895147.0L/22054032000.0L) + 138794879.0L/13232419200.0L) - 283684103.0L/138940401600.0L);
+        break;
+    }
+}
diff --git a/bfps/cpp/spline_n9.hpp b/bfps/cpp/spline_n9.hpp
new file mode 100644
index 00000000..377a3ce1
--- /dev/null
+++ b/bfps/cpp/spline_n9.hpp
@@ -0,0 +1,38 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2017 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#ifndef SPLINE_N9
+
+#define SPLINE_N9
+
+void beta_n9_m0(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n9_m1(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n9_m2(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n9_m3(const int deriv, const double x, double *__restrict__ poly_val)
+void beta_n9_m4(const int deriv, const double x, double *__restrict__ poly_val)
+
+#endif//SPLINE_N9
+
-- 
GitLab