1. Introduction
Spectral methods [
1,
2,
3] are well-established methods for the solution of partial differential equations, mostly known for their superior accuracy. Spectral methods come in a few varieties, such as Galerkin, collocation, and Tau. The difference between them is how one forms the discrete set of equations; from the perspective of the more general framework of weighted residual methods, where the different formulations can be systematized; or based on whether one solves for expansion coefficients or nodal values. Another difference comes from the functions used to approximate the unknown solution. Trigonometric series are used for periodic problems, leading to the so-called Fourier methods [
2]. The alternatives are polynomial spectral methods [
3], which use special functions in the form of orthogonal polynomials stemming from the singular Sturm–Liouville problem, leading to Jacobi, Chebyshev, and Legendre spectral methods. More details on the theoretical foundations and implementation details of spectral methods can be found in [
4,
5].
There has been a strong motivation to experiment in forming similar solution methods using other known special functions and polynomials, orthogonal or not. These motivations are specific computational domains: semi-unbounded, cylindrical, spherical, etc., or some other technical or historical reasons.
When it comes to the use of Bernstein polynomials, the roots may be described as historical, as they were employed in one of the initial proofs of the Stone–Weierstrass theorem [
6]. Their practical use, other than proving Weierstrass theorem, was somewhat discouraged, and this is often repeated as a fact in numerical analysis textbooks, e.g., ref. [
7]. We only partially agree with this point of view since our own work and the works of other researchers show favorable characteristics for certain types of problems and with small and particular modifications. As a footnote, a similar view is found for Lagrange interpolation, for which it is often repeated that it is unstable for higher-order polynomials, while it is pointed out by, e.g., Berrut and Trefethen that this is only partially true—once the non-equidistant set of nodes is used together with the barycentric form of interpolation formula, the said problems are alleviated [
8].
Several studies use Bernstein polynomials for numerical solutions of ODEs and PDEs. In [
9], the authors used a modified Bernstein polynomial basis within the Galerkin method for highly accurate solutions of one-dimensional boundary value problems. A numerical solution of the KdV–Burgers equation using Bernstein polynomials as trial functions in the Galerkin method is presented in [
10]. An approximate method based on Bernstein polynomials for the direct solution of third-order ODEs applied to fluid-flow equations is shown in [
11]. A collocation method [
12,
13] based on Bernstein polynomials for two-dimensional elliptic boundary value problems is introduced in [
14]. The Bernstein collocation method for a class of Sturm–Liouville problems is shown in [
15]. The solution of high-even-order differential equations using the Bernstein Galerkin and Bernstein Petrov–Galerkin methods is presented in [
16]. The Bernstein Ritz–Galerkin method is used in [
17] for the solution of the initial–boundary value problem for the wave equation. Recently, the applicability of Bernstein polynomials has been extended to fractional diffusion equations in [
18].
Differentiation matrices are one of the straightforward methods for the implementation of spectral methods, especially when the programming language used for implementation readily supports the use of these structures, as is the case with Python or MATLAB. Regarding the implementation, the works of Weideman and Reddy [
19] and Trefethen [
20] have shown how the use of differentiation matrices produces spectral algorithms of elegant form, especially when used in MATLAB, where the idea of manipulating matrix and vector objects is central and particularly efficient. Explicitly defining differentiation matrices can be useful in studying the stability of pseudospectral methods applied to time-dependent problems for partial differential equations [
20,
21,
22]. The use of differentiation matrices presents a favorable alternative, even when the fast transform method is available for differentiation, under certain limitations, which are described in [
4]. Finally, the use of differentiation matrices enables the easy generalization of spectral methods to higher dimensions through the use of the Kronecker product [
14,
20].
In this study, we use the familiar idea of a differentiation matrix, a well-established notion in the world of spectral methods, and apply it to Bernstein polynomials. The
novelty of the paper is in recognizing that, under a suitable choice of the collocation points, Bernstein polynomial differentiation matrices possess identical symmetries, as in the case of the Chebyshev spectral method, which makes the numerical efficiency and accuracy improvement methods extensively studied in the Chebyshev case [
23,
24,
25,
26] relevant in the case of the Bernstein polynomial collocation method as well. The
significance of the study is in establishing a deeper connection between the Chebyshev and Bernstein collocation methods.
In this paper, we are focused on initial value problems for PDEs, using the method of lines, where spatial and temporal discretization are independent. The solution of such problems amounts to applying the differential operator in matrix form at every timestep, and multiple times at each timestep in the case of methods such as Runge–Kutta, which brings about the amplification of errors related to applying the matrix differentiation operator. Under such circumstances, accuracy improvements to the Bernstein polynomial collocation method are important, as they are in the Chebyshev polynomials case. We are interested in classical problems of transport phenomena—diffusion, convection, convection–diffusion, and nonlinear transport problems—which can be transformed to these (e.g., via the Cole–Hopf transformation).
The rest of this paper is structured as follows. In
Section 2, we provide preliminary notions regarding the Bernstein polynomials; then, we discuss the differentiation matrices and their symmetry properties for the formulation of the present polynomial collocation method. In
Section 3, we present the numerical method for the discretization and solution of PDEs and discuss the stability of the method. In
Section 4, we provide several application examples of the proposed method for time-dependent problems of PDEs, where we scrutinize the proposed method in detail. We provide the conclusions in
Section 5.
3. The Numerical Solution Method
The Bernstein polynomial differentiation matrices discussed previously are used to implement the Bernstein polynomial collocation method for time-dependent problems of typical transport equations. The method of lines is employed, so the spatial discretization, temporal discretization, and stability are discussed next.
3.1. PDE Discretization by Bernstein Polynomial Collocation Method
The unknown solution
is expanded in terms of Bernstein polynomials
:
where
are the time-dependent coefficients and
are the Bernstein-basis polynomials of degree
n. The time-varying expansion coefficients
are the principal unknown.
The Bernstein differentiation matrices for the numerical derivative of the first order
D, and second order
, are computed using Bernstein polynomials, evaluated at Chebyshev–Gauss–Lobatto (CGL) nodes by leveraging the flipping and negative sum trick (NST) to improve accuracy (Equations (
3), (
6) and (
7) and Algorithm 1). The spatial domain is defined on the segment
and transformed to order domains if necessary.
The spatial discretization is described using an example of a constant-coefficient convection–diffusion equation. The special cases are described in greater detail in the numerical examples section.
For the constant-coefficient convection–diffusion equation
the semi-discrete form is given by
where the Bernstein polynomial expansion coefficients
are the unknowns.
The discrete spatial derivatives operator matrix
is obtained after substituting the approximate derivatives using Bernstein polynomial differentiation matrices
,
, and
into Equation (
23). Then,
From there, it follows that
where
is the inverse of the Bernstein-basis matrix. From the approximately constant-coefficient convection–diffusion equation, the special cases of advection and diffusion equations arise as special cases. The advection equation is discretized as
where the system matrix is constructed as
The numerical setup for the diffusion equation proceeds by using the second-order differentiation matrix
to represent the diffusion term
, and the system matrix
A becomes
The convection–diffusion equation discretization presented here for the Bernstein polynomial collocation can be compared to Chebyshev pesudospectral discretization [
19,
20,
21], where the system matrix for the convection–diffusion equation takes the form
for the constant-speed advection equation, it is defined as
and for the diffusion equation, it takes the form
In Equations (
30)–(
32), the
, and
are the first- and second-order Chebyshev differentiation matrices.
The Chebyshev pseudospectral method is known for its high accuracy and stability and is used later to assess the relative accuracy of the present method.
The numerical solution process is as follows. First, the initial condition for is set. Then, the coefficients of the Bernstein polynomial expansion of unknown solution are computed by solving the linear system . The Bernstein polynomial expansion coefficients are advanced in time. At the desired timestep, the solution is reconstructed from the Bernstein coefficients. The details of timestepping are discussed next.
3.2. Timestepping
In the present study, explicit timestepping methods are used. Although classical Runge–Kutta of the fourth order has been used elsewhere [
21,
22,
26], in the present study, the Strong Stability-Preserving Runge–Kutta (SSP-RK) integrators are employed. For the explicit SSP-RK time discretizations, a general
s-stage method is written (in the Shu–Osher form) as
Here, the system of ODEs for
, Equation (
24), is evolved in time using the five-stage fourth-order SSP-RK(5,4) method by Spiteri and Ruuth [
28]:
which has C = 1.508 (Ceff = 0.302). This method is particularly suited for maintaining stability when solving hyperbolic PDEs.
As we can see, at every stage, the discretized differential operator is applied to a solution vector by a matrix–vector product. The application of differentiation matrix symmetries can be used to our advantage, as previously shown, to reduce the number of operations of the direct matrix–vector product. With a higher polynomial order and number of stages in the Runge–Kutta method, the numerical efficiency improvements increase. For SSP-RK5(4), the factor is 6 .
3.3. Stability of the Numerical Method
According to the linear stability analysis, the numerical scheme is stable if the eigenvalues of the system matrix in Equation (
24) scaled by the timestep size
fall within the stability region of the timestepping method in the complex plane.
In the present study, we assess the stability of the Bernstein polynomial collocation method relative to the Chebyshev pseudospectral method to gain better insight into comparative advantages; we summarize the result in
Figure 3.
In
Figure 3a, the computed eigenvalues of the discrete advection operator for Bernstein collocation in (
28) and Chebyshev pseudospectral method defined by (
31), adjusted for boundary conditions
, are plotted side-by-side for polynomial order
. The timestep size
is chosen so that the scaled eigenvalues remain within the stability region of the SSP-RK(5,4) method (solid line). The highly distinguishing feature is that both methods produce identical eigenspectra (to a round-off precision), raising questions surrounding the similarity of matrices.
In
Figure 3b, the unscaled eigenspectra of the diffusion operator of both methods, defined by Equations (
29) and (
32), respectively, accounted for the boundary conditions on both sides so that
are plotted for the same polynomial order
and for diffusion coefficient
. The eigenvalues are identical (to a round-off precision) and purely imaginary.
In
Figure 3c, the eigenvalues of convection diffusion operators for the Bernstein (
23) and Chebyshev (
30) collocation methods based on the values of advection velocity
, diffusion coefficient
, and
(see Figure 3 in [
21]) are shown, showing the same pattern as above.
The matrices considered are not normal, so the eigenvalues provide only a necessary, but not sufficient, condition for stability. To further assess the stability, we show the pseudospectra of the system matrices in
Figure 4. The stability criterion involving pseudospectra is more strict (see [
20]), requiring that the pseudospectra of a certain level be contained in the stability region. In this representation, we can differentiate the footprint of system matrices of the Chebyshev and Bernstein collocation method. The Chebyshev collocation method requires marginally smaller timesteps to achieve stability based on this criterion.
4. Numerical Examples
4.1. Linear Advection Equation
The example numerically solves the one-dimensional linear advection equation using two different methods: Chebyshev pseudospectral and Bernstein polynomial collocation methods (with and without the use of symmetry-based tricks), using Chebyshev–Gauss–Lobatto (CGL) nodes for both.
The problem is to solve the linear advection equation
with
, on a domain
, subject to Dirichlet boundary conditions. The initial condition is
, and the boundary condition is
. This problem appears in [
1].
The problem is approximately solved using two methods. In the Chebyshev collocation method, the Chebyshev differentiation matrix is constructed at the Chebyshev–Gauss–Lobatto nodes, and the right-hand side operator
approximates the spatial derivative in the advection equation. The solution
is approximated as a sum of Chebyshev polynomials, and the timestepping is carried out using the SSP-RK(5,4) method. Given the Chebyshev differentiation matrix
D, the advection equation is discretized as
where
is the value of the solution at node
, and
are the elements of the Chebyshev differentiation matrix.
For the Bernstein method, the solution is expanded as a sum of Bernstein-basis functions:
where
are the Bernstein-basis polynomials and
are the time-dependent coefficients. The advection equation is then discretized as
where
is the differentiation matrix in the Bernstein basis. The matrix
is constructed, where
B is the matrix mapping the Bernstein coefficients to function values at the Chebyshev–Gauss–Lobatto collocation points. The initial function
is projected onto the Bernstein polynomial basis, and the Bernstein polynomials’ coefficients evolve in time. For this approach, two cases are considered: with and without the use of symmetry-based tricks. In both cases, the system is evolved in time using the SSP-RK(5,4) method.
After each timestep, the Dirichlet boundary condition at is enforced by setting .
The exact solution for this problem is . The maximum absolute error is computed as the difference between the numerical and exact solutions at the final time.
In
Figure 5, the representative numerical solution using the Bernstein polynomial collocation, for
and timestep size
, is shown. The figure shows initial, final numerical, and analytical solutions. The advected profile is smooth, which explains the spectral accuracy.
Figure 6 compares the accuracy of the Chebyshev and Bernstein polynomial methods (with and without the symmetry modifications) for solving the linear advection equation. It shows the maximum absolute error between the numerical and exact solutions for various polynomial orders, plotting the error on a log scale to evaluate the performance of each method. High accuracy and spectral convergence is seen for both Chebyshev and Bernstein method. Since the same timestep size is used for all polynomial orders (
), the difference is visible for higher
n, due to the loss of stability.
The tabular representation of the convergence of the maximum absolute error is given in
Table 1, to better assess the difference of the three approaches. We see that, unlike the forward problem, the application of symmetries to Bernstein polynomial differentiation matrices produces only very small accuracy improvements. This corroborates similar findings for the Chebyshev case, found in [
26].
4.2. Spatially Variable-Coefficient Advection Equation
The problem solved here is used for the finer detail assessment of the Bernstein polynomial collocation method and its improvements via symmetry modifications of differentiation matrices. It was used to test the accuracy improvements for differentiation matrices in the Chebyshev pseudospectral method in [
26]. The initial value problem for the variable-coefficient advection equation is given as
where the initial condition is set to
, and the exact solution is
. The boundary conditions are not required. Problem (
39) is advanced in time using SSP Runge–Kutta 5(4) (the fourth-order Runge–Kutta is used in [
26]). The advection equation is discretized as
To handle the non-uniform advection coefficient, the matrix
A is constructed as
where
is the inverse of the Bernstein-basis matrix,
D is the Bernstein polynomial differentiation matrix, and
is a diagonal matrix with the CGL nodes
on the diagonal.
In
Figure 7, the representative solution using polynomial order
and timestep size
, together with the initial and analytical solutions, is shown.
To assess the accuracy improvement of the proposed method, we compare the numerical and analytical solution by plotting the error as a function of polynomial order in
Figure 8.
4.3. Nonlinear Convection–Diffusion Equation via Cole–Hopf Transformation
In this example, we consider the nonlinear one-dimensional convection-diffusion equation,
with initial Dirichlet boundary conditions given as
This nonlinear partial differential equation is challenging to solve directly due to the nonlinearity in the convection term. However, using the advantage of the Cole–Hopf transformation, this equation can be linearized; see [
29]. Using the Cole–Hopf transformation,
in Equation (
43), the original equation becomes a heat equation of the following form:
The initial and boundary conditions are consistently transformed to produce the following ones:
After solving the heat equation by advancing the diffusion equation in time and obtaining the solution for
, we apply the inverse Cole–Hopf transform, Equation (
46), to produce the solution
to the original nonlinear convection–diffusion problem.
We validate the Bernstein polynomial collocation with symmetry properties applied to differentiation matrices by solving the problem above and compare it against a Chebyshev pseudospectral solution. The problem given by Equations (
43)–(
45) is solved with
,
, and
. The Cole–Hopf transformation in (
46) produces the following initial and boundary conditions for the new variable:
i.e., the boundary conditions have transformed to zero-Neumann. Physically, the solution starts with a sinusoidal wave that propagates to the right, forming a wavefront that dissipates in time due to the action of viscous dissipation—
Figure 9.
In both studied cases, a Strong Stability-Preserving Runge–Kutta, SSP-RK(5,4), for time integration is used. Boundary conditions are explicitly enforced during the time integration.
To gain insight into the relative accuracy of both methods when applied to the same problem, two approaches—the Chebyshev and the Bernstein polynomial methods—are compared by calculating the absolute difference between the final solutions obtained using each method:
The graph in
Figure 10 shows the example absolute difference distribution for the polynomial order
and final time
s. The same timestep size of
s is used. The magnitude of the differences between the two methods is on the order of
, which indicates an extremely tiny discrepancy. This suggests that both methods are highly accurate and are producing solutions that are nearly identical. The errors of magnitude
suggest that we are observing the limit of numerical precision rather than any inherent shortcomings in either method. These differences could be attributed to how floating-point arithmetic handles each method’s approach to differentiation and interpolation.
The fluctuations in absolute difference are irregular across the domain , but the overall magnitude remains small, with no obvious trend. These oscillations in the error could be attributed to differences in how each method approximates the solution at specific points, particularly in regions where boundary conditions might influence the solution.
Table 2 gives the convergence of the maximum absolute difference between Chebyshev pseudospectral and Bernstein polynomial collocation methods for several values of polynomial order and at four representative time instants.
In general, the Chebyshev method tends to be more computationally efficient due to the use of nodal values of the function. The Bernstein method, in the present form, has negative tradeoff in terms of efficiency when handling boundary conditions as they are applied to nodal values of the function, which requires transformation from expansion coefficient representation to nodal values and back.
The results show that Bernstein polynomial collocation and Chebyshev pseudospectral methods are both highly effective at solving the given problem, with only minor numerical differences arising between the two. The result underscores the robustness of both methods for solving PDEs with high accuracy.
4.4. Non-Stationary Heat Diffusion in One-Dimensional Rod
This example represents a classic case of non-stationary heat conduction in a rod with a time-varying boundary condition at one end and insulation at the other end.
In this example, we solve the unsteady heat diffusion equation in a one-dimensional domain to produce the distribution of the temperature over time given the time-varying boundary condition at one end. The heat-diffusion equation reads
where
is the thermal diffusivity coefficient of the material and
is an unknown temperature distribution. To parametrize the physical setup, we the use heat constant
a, such that the rod has the fixed length given by
, and the thermal diffusivity is given as
, i.e., the length of the rod and thermal diffusivity, respectively, are a function of the heat constant
a.
The problem simulates the presence of a heat source with oscillating temperature at one end, so, at , the Dirichlet boundary condition for the temperature is imposed as . At the other end of the rod, , the zero-Neumann boundary condition, is enforced on temperature, implying that there is no heat flux at the end.
The analytical solution representing time-varying temperature distribution in a one-dimensional rod reads as follows:
where
.
The numerical solution is performed using the present method—the Bernstein polynomial collocation method—and using the Chebyshev pseudospectral method.
Figure 11 and
Figure 12 show the numerical solution using Bernstein polynomials at four characteristic time instances and absolute error distribution for polynomial order
.
The maximum absolute error convergences for both Bernstein and Chebyshev methods across several polynomial orders and at characteristic instances of time are shown in
Table 3. The number of timesteps is large and most of the error comes from temporal and not spatial discretization, leading to the small difference between these two higher-order methods.
5. Conclusions
The implementation of the polynomial collocation solution method for initial value problems of partial differential equation using Bernstein polynomials defined over arbitrary real-line segments, in collocation points based on Chebyshev–Gauss–Lobatto points, produces differentiation matrices that possess particular symmetry properties, which may be exploited for numerically efficient and accurate computation. In analogy with Chebyshev spectral method differentiation matrices, it is concluded that Bernstein polynomials possess centro-antisymmetric odd-order differentiation matrices and centro-symmetric even-order differentiation matrices. These symmetry properties are used to reduce the number of operations for the generation of differentiation matrices by using ‘flipping’, described originally for Chebyshev differentiation matrices. Also, the opportunity of using efficient matrix–vector products is possible in the presence of these symmetries. Further, round-off errors are reduced in a similar manner as with the Chebyshev case using negative sum trick.
Moreover, important results follow from the formulation of the Bernstein polynomial collocation method on Chebyshev–Gauss–Lobatto collocation points for linear initial value problems. The eigenvalues of the system matrices for the linear constant-coefficient convection–diffusion problem match on all tested polynomial orders of practical interest for the Chebyshev and Bernstein collocation methods described in this article. However, their pseudospectra differ, leading to marginally different stability properties.
This comparison of the Bernstein collocation and Chebyshev pseudospectral approaches validates both methods as highly accurate, with differences negligible for most practical purposes. If the goal is to obtain a reliable solution for a PDE, either method could be used, depending on the specific requirements.