35 static double scale(
double x,
double a,
double b,
double t1,
double t2) {
36 return ((t2 - t1) * (x - a) / (b - a)) + t1;
43 x =
scale(x, a, b, -1, 1);
47 for (
size_t i = 2;
i <
N;
i++) {
49 Tx(
i) = 2 * x * Tx(
i - 1) - Tx(
i - 2);
57 Weights weights = Weights::Zero(N);
58 for (
size_t n = 1;
n <
N;
n++) {
59 weights(
n) =
n * Ux(
n - 1);
68 x =
scale(x, a, b, -1, 1);
72 for (
size_t i = 2;
i <
N;
i++) {
74 Ux(
i) = 2 * x * Ux(
i - 1) - Ux(
i - 2);
86 x =
scale(x, a, b, -1, 1);
87 if (x == -1 || x == 1) {
88 throw std::runtime_error(
89 "Derivative of Chebyshev2 Basis does not exist at range limits.");
92 for (
size_t n = 0;
n <
N;
n++) {
93 weights(
n) = ((
n + 1) * Tx(
n + 1) - x * Ux(
n)) / (x * x - 1);
static Weights CalculateWeights(size_t N, double x, double a=-1, double b=1)
Evaluate Chebyshev Weights on [-1,1] at x up to order N-1 (N values)
static Weights CalculateWeights(size_t N, double x, double a=-1, double b=1)
static Weights DerivativeWeights(size_t N, double x, double a=-1, double b=1)
Evaluate Chebyshev derivative at x.
Chebyshev basis decompositions.
static double scale(double x, double a, double b, double t1, double t2)
Scale x from [a, b] to [t1, t2].
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
static Weights DerivativeWeights(size_t N, double x, double a=-1, double b=1)
Evaluate Chebyshev derivative at x. The derivative weights are pre-multiplied to the polynomial Param...