1. Introduction
Fractional calculus and fractional differential equations (FDEs) have emerged as powerful mathematical tools with a profound impact on almost all fields of science and engineering. While classical calculus deals with integer-order derivatives and integrals, fractional calculus generalizes these operators to non-integer orders. As a result, systems with memory and hereditary properties can be modeled using fractional calculus. This capability is particularly valuable for describing entire classes of phenomena that exhibit anomalous diffusion, viscoelastic behavior, and long-range dependencies—features that often cannot be captured by traditional models. FDEs arise in a wide range of applications, including fluid dynamics, control theory, signal processing, and biological systems, where they provide a more realistic modeling of real processes compared to their classical counterparts. Fractional calculus is an important area of modern mathematics because it helps us understand complex systems and solve challenging problems.
Analytical and numerical methods are required to solve FDEs. Analytical methods include the Laplace transform, the Fourier transform, and expansions involving Mittag–Leffler functions, which provide exact solutions for certain classes of FDEs. However, it is commonly known these methods are usually limited to linear or simple nonlinear problems and are insufficient for handling more complicated or higher-dimensional fractional partial differential equations (FPDEs). If such methods exist to solve complicated problems, the literature is quite limited due to the associated difficulties. As a result, numerical methods have become essential tools for addressing FDEs. Numerical approximations for FPDEs, particularly for problems that are difficult to solve analytically, often rely on techniques such as the finite difference method [
1], the spectral element method [
2,
3], the finite element method [
4], nonuniform difference schemes [
5], the Galerkin method [
6,
7], the collocation method [
8,
9], the fractional differential transform method [
10], and the kernel-based pseudo-spectral method [
11]. For further study, we refer readers to [
12,
13]. Such numerical approaches enable researchers to tackle real-world problems involving irregular domains, complex boundary conditions, and nonlinearities.
Given
, the fractional Klein–Gordon equation (FKGE) we consider in this paper reads
subjected to conditions
where
and
are constants, the functions
g,
are sufficiently smooth functions, and
for
are known. Furthermore, the function
satisfies the Lipschitz condition
with Lipschitz constant
L. The derivative operators
and
refer to Caputo fractional derivative (CFD) and derivative with respect to variable
t, respectively.
As we know, both linear and nonlinear Klein–Gordon equations play an important role in modeling various physical phenomena within a wide scope of applications: solitons, condensed matter physics, and classical and quantum mechanics [
14] are only a few among others. Originally, the equation was proposed in 1926 by physicists Oskar Klein [
15] and Walter Gordon [
16] to model relativistic electrons. Given the importance of such equations, the study and determination of their solutions are quite significant [
17]. Recently, much attention has been given to the FKGE. Essentially, it serves as a generalization of the integer-order Klein–Gordon equation and further extends the range of applicability. This equation also models non-locality in space and time with the help of power-law kernels [
3]. Rapid developments have occurred in presented numerical methods for solving the FPDEs, and especially the FKGE, in recent years, including the following: the Sinc–Chebyshev collocation method [
18], homotopy perturbation method [
19], the third-kind Chebyshev collocation method [
20], cubic B-spline method [
21], meshless method [
22], Fourier transform method [
23], finite difference methods [
24], and spectral collocation methods [
25].
Essentially, the pseudospectral method among the spectral methods relies on the basic minimization of a residual function at some collocation points and is usually very accurate and efficient. Its simplicity and effectiveness arise from the fact that one is making sure the residual is minimized, and if well implemented, the method always outperforms many other numerical techniques. The method takes advantage of orthogonal polynomials or even trigonometric functions for approximations and realizes exponential convergence in problems with smooth solutions. The pseudospectral method is, therefore, seen as the best option in handling differential equations due to better accuracy and efficiency in computation, including those involving nonlinearities and high-dimensional cases [
26].
Cardinal functions serve as a set of basis functions in numerical analysis and approximation theory. They play a critical role in constructing interpolants or approximating functions from discrete data points, making them particularly valuable in spectral and pseudospectral techniques. While some cardinal functions exhibit orthogonality, which streamlines computations in functional spaces, they are predominantly employed in spectral and pseudospectral methods as the bases. The significance of these bases can be examined from two perspectives:
Accuracy: Cardinal functions enable spectral accuracy in numerical approaches, delivering highly accurate approximations for solutions to differential equations. In scenarios demanding high accuracy, pseudospectral methods demonstrate superior performance compared to finite difference and finite element methods.
Computational Efficiency: The inherent sparsity or localized nature of certain cardinal functions reduces the computational cost of interpolation and quadrature, enhancing overall efficiency.
The outline of this paper is as follows. We introduce the Legendre cardinal function and its properties in the next section. In the section, the matrix form of fractional integral derivatives and the CFD is also presented. In
Section 3, two numerical schemes based on the pseudospectral method are developed and implemented for solving FKGEs. The convergence analysis is also investigated. Some numerical experiments are implemented, and the results are reported in
Section 4. In
Section 5, we provide some final observations and conclusions.
2. Legendre Cardinal Functions
Legendre polynomials are specified as the eigenfunctions of the well-known Sturm–Liouville equation
corresponding to the eigenvalues
. Here,
indicates the derivative operative with respect to the independent variable
x. There are some explicit expressions of these polynomials; among them, the following formula can be mentioned:
This expression derivates Rodrigues’ formula, obtained under the normalization
. The three-term recurrence formula for these polynomials holds as follows:
These polynomials are orthogonal with respect to the
norm on
, viz.,
where
states the inner product of
and
specifies the Kronecker delta.
Note that the shifted Legendre polynomials on the generic interval
can be introduced through the suitable variable change, i.e.,
Explicit expressions for the roots of Legendre polynomials do not exist, and thus numerical computation is required to find them. Generally, two effective algorithms are used for this: the eigenvalue method and the iterative procedure. All the roots of Legendre polynomials are simple, real, and lie in the interval
. Based on the construction of the shifted Legendre polynomials, their roots can be determined using
Set the nodes
as the shifted Legendre polynomial roots; the Legendre cardinal functions associated with these nodes are determined as
Another way to determine the Legendre cardinal functions is to take a grid specified by the extrema of the Legendre polynomial
and add the endpoints, namely,
This set of nodes is often called the Lobatto grid. Associated with this grid, called the Lobatto grid, the Legendre cardinal functions are defined as follows:
The main characteristic of Legendre cardinal functions is
This property allows an
M-degree polynomial to interpolate exactly
data points of the function
y. Strictly speaking, any function with
data points is approximated by
where
is a projection operator and
indicates the space of polynomials of degree less than
M. This approximation is computationally significant because it avoids the integration when calculating expansion coefficients.
Given a two-dimensional function
with
, one can approximate it as follows:
in which
and
states the space of the quadratic polynomial on
.
Given
for
, let
,
and
. Furthermore, assume that
We consider the space
for
as defined in [
27], with the norm and semi-norm
where
,
,
, and
for
indicates the standard-basis vectors. Throughout the paper, we denote
C as a positive constant, which can differ in various formulas.
Theorem 1 (cf. Theorem 8.6, [
27])
. Let
indicates the zero vector. Given
, assume that
. If
, thenwhere
. 2.1. Derivative Operator in the Matrix Form
This section presents a framework to show how the derivative operator acting on Legendre cardinal functions can be represented as a matrix. Recall that (see, e.g., [
27]) the leading coefficients of Legendre polynomials
are given as
and taking the derivative of it leads to
where the constant
is equal to
Taking into account Equations (15) and (17), an alternative representation of the Legendre cardinal functions (
8) and (
9) is available as follows:
where
is equal to
and
for (
8) and (
9), respectively.
Taking the derivative on both sides of (18) leads to
If
is estimated based on the Legendre cardinal functions
, it is easy to verify that
Thus, it results from (19) and (20) that
Assume that
is a vector function whose elements are specified by
Using this vector function, the matrix form of derivative operator can be determined as
in which the entries of
are determined by (21).
2.2. Fractional Integral Operator in Matrix Form
Firstly, a reformulation of Legendre cardinal functions is required to specify the matrix form of the fractional integral operator (FIO) [
28,
29], viz.,
in which
Thus, an alternative formula of the Legendre cardinal functions can be determined as follows:
Given the value of “a” (the left endpoint of the generic interval
), two cases must be considered:
- •
If
: Considering the definition of FIO and gamma function [
30], one can prove that
Given (26) and considering the reformulation (25), one obtains the result of acting FIO on the Legendre cardinal function, i.e.,
- •
If
, it results that
(see e.g., ([
31]), p.65),
where
B and
state the beta and hypergeometric functions [
31], respectively. Thus, it proves from (25) and (28) that
Now, everything is ready to present the matrix form of FIO based on Legendre cardinal functions, viz.,
where the coefficients
are calculated through (27) and (29). So, one can introduce a matrix
that satisfies
and has elements
2.3. Caputo Fractional Derivative Operator in Matrix Form
Assume that
and
(where
is the ceiling function). The CFD operator
is represented by
when
. We aim to find a matrix
that satisfies
Replacing
instead of
leads to
Thus, without direct calculations, the matrix form of the CFD operator is obtained, viz.,
4. Numerical Results
Example 1. Consider the fractional Klein–Gordon equationsubjected to the following initial and boundary conditions: For this example, the exact solution
is provided in [
32].
Table 1 shows the efficiency and accuracy of the two proposed schemes based on Jacobi and Lobatto grids for different values of
. To compare the proposed methods with existing ones,
Table 2 presents comparisons with the implicit RBF meshless method [
32]. The results confirm that our schemes yield better outcomes than the implicit RBF meshless method. The
-errors at different times are reported in
Table 3 for PS1 with Jacobi grid,
Table 4 for PS1 with Lobatto grid,
Table 5 for PS2 with Jacobi grid, and
Table 6 for PS2 with Lobatto grid. In all tables, the CPU times are also included.
Figure 1 illustrates the convergence of the proposed schemes.
Finally, the accuracy and efficiency of the proposed schemes are validated by the reported results. Additionally, the obtained results support the convergence analysis provided. Moreover, the second scheme yields more accurate results compared to the first scheme. Generally, the best results for this example are achieved by the second scheme using the Lobatto grid (specifically the PS2-Lobatto grid), while requiring less computational time.
Example 2. Consider the fractional Klein–Gordon equationsubjected to conditionswhere
. For this example, the exact solution
is reported in [
33].
Table 7 displays the accuracy of the two proposed schemes based on Jacobi and Lobatto grids for different values of
. To compare the proposed methods with existing methods,
Table 8 is presented. The variational iteration method [
33] and Sinc–Chebyshev collocation method [
18] are compared with our proposed schemes in this table. The results confirm that our schemes yield better outcomes than these methods. We compared the errors obtained using the different schemes proposed in this paper and plotted them in
Figure 2, where CPU times are also reported.
The experimental results indicate that the first scheme is more accurate, while the second scheme executes faster.
Example 3. Consider the fractional Klein–Gordon equationsubjected to conditionswhere
. For this example, the exact solution is
.
Table 9 displays the accuracy of the two proposed schemes based on Jacobi and Lobatto grids for different values of
M. We compared the errors obtained using the different schemes proposed in this paper and plotted them in
Figure 3, where CPU times are also reported.
5. Conclusions
This paper introduces the Legendre cardinal function for the first time and employs two numerical schemes to solve the fractional Klein–Gordon equation (FKGE). The paper addresses two main subjects: the introduction of the Legendre cardinal functions and the solution of the FKGE. The Legendre cardinal functions are determined using Jacobi and Lobatto grids, both of which satisfy the cardinality condition—a fundamental property of cardinal functions. We represent the fractional integral operator and the Caputo fractional derivative as matrices.
Two numerical schemes based on the pseudospectral method are considered. The first scheme reformulates the given equation into a corresponding integral equation for solving it. The second scheme directly tackles the problem by utilizing the matrix representation of the Caputo fractional derivative operator. The numerical examples validate our convergence analysis. All proposed methods result in accurate solutions. Comparisons with other methods demonstrate that the proposed schemes outperform existing approaches.
Some notable features of the proposed methods include a reduction in computational effort due to the cardinality property of the basis functions, matrices representing fractional derivative and integral operators, and ease of implementation. The presented approaches can be extended to solve higher-dimensional FKGEs. Additionally, these schemes can be used to address other fractional problems, including fractional differential equations, fractional partial differential equations, integral equations with weakly singular kernels, and fractional integro-differential equations.