1. Introduction
The idea of solving nonlinear boundary problems as accurate as possible using spectral collocation methods is not new in the author’s work. Thus, we published the paper [
1] and posted the problem [
2] on the colorgreenChebfun website. In both situations, we considered nonlinear boundary value problems on the half line.
In this paper, we consider the following class of nonlinear and possible singular problems:
where
To ensure existence we will assume the following conditions are satisfied:
For the results of the existence and uniqueness of the solutions of these problems, we rely on the paper [
3] and the works cited there.
We must note from the beginning that the mathematical literature abounds with such theoretical results, but their numerical illustration is often lacking. We want to fill this gap as much as possible.
Notice that
f may not be a Caratheodory function because of the singular behavior of the
u variable, i.e.,
f may be singular at
. Problems of the above form have been discussed extensively in the literature usually when
reduces to
with
(see for instance [
4]).
The main purpose of our study is to solve numerically such problems as accurately as possible.
In general, attempts are made to attenuate singularity by algebraic manipulations, but these, along with non-linearities, raise serious problems for any numerical algorithm.
Traditionally, they have been overcome using variants of the shooting method. We will never resort to such methods. As the methods with finite differences, finite elements or volumes, or conventional ChC have shown their limits, we want to show that the use of Chebfun variant of ChC method can address most of these issues.
The work has the following structure. In
Section 2, we elaborate a brief comparison between Chebfun and the conventional ChC method. The core of the paper is
Section 3. Here, we report the numerical results of solving eight problems with varying degrees of non-linearity and even singularity. In each case, we establish the type of convergence of the Chebyshev collocation method implemented with Chebfun. In
Section 4, we draw some conclusions on the usefulness and performance of the Chebfun system. We believe that additional experiments are needed in order to draw even firmer conclusions.
2. Chebfun vs. Conventional ChC Method
Feel symbolic but run at the speed of numerics! [
5].
This quote contains the essence of the Chebfun system. It is implemented in object-oriented MATLAB and has been introduced in 2004. The algorithms involved amount to spectral collocation methods on Chebyshev grids of automatically determined resolution.
In a latter extension, the chebop class has been introduced (see [
6]). We extensively use the codes from this class. In [
6] the authors observe that “the central principle of the Chebfun system is to evaluate functions in sufficiently many Chebyshev points for a polynomial interpolant to be accurate to machine precision”.
The chebop system is implemented by means of four MATLAB classes, namely: domain, chebop, oparray, and varmat, where the last two classes are not normally relevant at user level. Instead, at the user level one has to specify the domain ( being default), the differential operator along with boundary conditions such that the boundary value problem is well defined, and possible initial guess for Newton’s method. Such a Chebfun code contains only a few lines, it is very intuitive and delivers very valuable output parameters relative to the convergence of the method and the evolution of Newton iterations.
Chebfun normally represents solutions
to BVPs by polynomial approximations, typically with an accuracy of about 10 digits, whose degree
N (the resolution) may be quite high (actually
). Due to the bad conditioning of Chebyshev differentiation matrices, on a usual computing station the maximum
N one can hope for is around 1000. The polynomials can be interpreted as interpolants through a sufficiently large number
of samples at Chebyshev points defined by
From this representation of the solution starts the essential difference from conventional ChC. In the case of the second method, it is impossible to establish this resolution apriori. Thus, although the Chebyshev collocation remains one and the same method, there are some algorithmic advancements incorporated in Chebfun. We only mention the concept of quasi-matrix, chopping algorithm, lazy evaluation, to name just a few.
Moreover, implementing conventional ChC is a much more laborious thing as it appears for instance from our work [
1]. First of all, it is a challenging matter of establishing the right resolution. In most cases, this is reduced to repeated tests. Imposing less common boundary conditions (mixed or non-local) is another “thorny”issue. Finally, obtaining output parameters similar to those provided by Chebfun requires additional effort, such as a fast Chebyshev transform.
3. Numerical Results
3.1. A Test Problem with Known Solution
In [
7] as well as in [
8] the authors are concerned with a problem of type (
1). It reads:
The exact solution is known. It reads
Among other phenomena, this problem models conductive heat transfer with nonlinear heat generation.
It is important to state that Chebfun works in the physical (values) space, i.e., computes the nodal values of a solution in the nodes
defined by (
3). At the same time it computes the values of the coefficients of the solution expansion in phase (coefficients) space. The latter reads
where
are the usual Chebyshev polynomials and
N is the length of the solution provided by Chebfun.
The Chebfun solution to this problem is depicted in panel (a) of
Figure 1. It is clear that it perfectly overlaps with the exact solution. The error in the
norm is of the order
.
The second panel of this figure shows that the Chebyshev coefficients of the solution decrease almost linearly to the machine precision and the length of solution is
. A straight line which bounds them from above, the so called
envelope, is also drawn. This parallelizes the straight line through origin of the equation
where
It means that the (asymptotic) rate of convergence of Chebfun is
exponential or geometric (see the monograph [
9], Chapter 2 for the definition of the rate of convergence).
From panel (c) of the same figure, we understand that the Newton method is of the second order and uses five iterations.
Chebfun provides precise details on the accuracy with which the boundary conditions are enforced. In this case the residue vanishes.
In [
7] a classic method with finite differences is used in order to solve this problem and the authors expect an accuracy of order
In a recent paper [
8], the authors make use of the Haar wavelet method in order to solve a quasi-linearized version of this problem. Nor do they expect for better accuracy than something of order
Finally, we solved the problem with MATLAB’s
bvp4c routine (see [
10] for this routine). In this case we could not find the solution with an error better than
Due to limited space, we are not able to repeat and report all these comparisons for every problem which follows. However, we will sum up conclusions in the last section.
3.2. A Bernstein Type Boundary Value Problem
In [
11], the authors consider a problem of type (
1) in which the nonlinear term
f satisfies the so called Bernstein growth condition. Actually, it means that
f can grow at most quadratically in its derivative variable.
We consider the following example from this paper:
The Chebfun solution to this problem is depicted in panel (a) of
Figure 2. This has exactly the same shape as the one obtained in [
11] by shooting along with continuation with respect to the initial data. The Newton’s method in solving the Chebfun discretization has second order (see panel (b)) and the coefficients of Chebfun solution decrease smoothly and linearly to the level of machine precision. The convergence of the method remains exponential but the slope
m approximately equals
in (
7), i.e., less optimal than in the previous example.
We have intentionally chosen this example from the paper quoted above to show that the enforcement of mixed conditions is extremely simple in Chebfun and especially very precise, i.e., the final error in solving them is of order . Such an estimate is practically impossible with conventional ChC or bvp4c.
3.3. Lane-Emden Equation of the Second Kind
The equations of Lane-Emden-Fowler type arise in various applications in mechanics, nuclear physics, gas-dynamics, stellar structures, and chemically reacting systems. In [
12], the author considers the nonlinear ODE
supplied with boundary conditions
or
For
and
the problems (
9) and (
10) admits the following exact first integral
where
and
denotes the exponential integral
In order to see how accurate this integral is satisfied we take first and and then from the boundary conditions we introduce and (the symmetry of solution with respect to x). The values and have been computed by Chebfun.
Thus, in our computation, regardless of the values of parameters
and
, the first integral (
12) is satisfied with a precision of order
Chebfun has no difficulty solving problems (
9)–(
11). The solutions to the problems (
9) and (
10) are displayed in
Figure 3. The Newton method has effectively second order and no more than two or three iterations are used in each case.
The convergence of the method is exponential with the slope
m approximately equaling
in (
7). Improper integrals
in the first integral (
12) are also calculated without any difficulty by Chebfun. It uses
sum operator along with option
‘splitting’, ‘on’. In each case, the Newton process started from the initial guess
.
3.4. A Singular Problem from the Theory of the Pseudo-Plastic Fluids
In [
13], the authors consider the existence issue for the problem
where
The case
corresponds to the Newtonian fluid.
This problem is much more difficult than the previous one in the following sense. If, in the previous case, Chebfun used a tolerance of order for Newton’s solver in this case we had to loosen this tolerance to in order to guarantee a convergent procedure.
A set of solutions to problem (
13) is displayed in
Figure 4.
In the left panel of
Figure 5, we display the norm of Newton’s updates vs. iteration number in the worst case, i.e.,
. It is apparent that the order of the Newton’s method is much less than 2.
From the right panel of
Figure 5 we see that the solution has length 37 and its coefficients decrease smoothly but remain very far from the machine precision level. We also drew the envelope for these coefficients and from the log-linear plot (b) of
Figure 5 we can only infer that asymptotically, i.e., for large
k, the coefficients of expansion (
6) of solution satisfy
which means that the rate of convergence is only
algebraic.The point where the envelope intersects the coefficients’ curve is (roughly!) the magnitude of the error. In fact, the coefficients decrease slightly below the level
The problem of finding an initial guess in order to ensure the convergence of Newton’s iterates is not at all simple in this case. Repeated attempts led us to an initial date of the form
This initial guess satisfies the boundary conditions of problem (
13) and has a curvature close to that of numerical outcomes.
It should be noted that for values of the parameter in the range (0, 1/2) Chebfun completely failed!
In order to solve this problem for arbitrary values of
in [
14] the authors have introduces an iterative technique which reduces the problem to a sequence of usual eigenvalue problems. We have tested the capabilities of Chebfun in solving various Sturm–Liouville problems in some previous papers thus we are not interested in these iterative techniques (see for instance our contribution [
15]).
3.5. A Nonlinear Heat
Conduction Model of the Human Head
The analytical study of the problem
has been initiated in [
16]. Roughly speaking in this model the right hand side is the heat production rate per unit volume,
is the absolute temperature,
x is the radial distance from the centre,
a is the inverse of the average thermal conductivity inside the head and
b is a heat exchange coefficient.
Three solutions
of this problem are reported in the panel (a) of
Figure 6.
The behavior of Chebyshev coefficients in the panel (b) of
Figure 6 shows that the rate of convergence is definitely exponential.
Although the problem has received some attention over time, we have not found numerical results with which to compare ours. In any case, in its solution Newton’s method keeps the second order and does not use more than six iterative steps.
3.6. Membrane Buckling
In [
17] the authors consider, among other problems, the following nonlinear and singular problem:
which describes a flat, circular elastic membrane which is deformed by an axisymmetric pressure applied to its surface. The edge of the membrane is restrained from deforming normal to its mid-plane. Either a compressive radial thrust or a contractile radial displacement is applied to the edge. The dependent variable
stands for the radial stress and
x is the dimensionless radius. The parameter
stands for Poisson ration of the membrane material.
Two solutions to the problem (
15) are displayed in
Figure 7.
The calculation of the two solutions differs fundamentally. In the first case (
) Chebfun produces the solution in five iterations and the Newton’s method has the second order. In the other case, Chebfun produces the solution in 86 iterations and the order of Newton’s method is far from order two. This aspect is visible in the left panel of
Figure 8.
The behavior (almost linear decrease to the machine precision level) of the Chebyshev coefficients of the solution suggests a still exponential convergent process (see the (b) panel in
Figure 8).
One remark is suitable at this stage. For lower values of the Poison parameter (membrane made of stiffer materials), Chebfun simply failed.
3.7. A Nonlinear (Super-Linear) Singular Problem
Our observations from many numerical experiments lead us to the conclusion that singularity is more difficult to manage than non-linearity for Chebfun. In order to strengthen this assertion we consider another example.
Thus, in [
18] the authors are concerned the singular and non-linear problem:
Three solutions of this problem are displayed in the panel (a) of
Figure 9.
For higher values of than 1, Chebfun could not solve the problem even though the tolerance was considerably lower. This is not the case for the exponent .
For the highest value of , the convergence rate remains exponential and the Newton’s method has an order close to two. These result from panels (b) and (c) of the same figure.
3.8. A Singularly Perturbed Nonlinear Problem
In [
19] the authors analyze the following problem:
Five solutions of this problem are reported in
Figure 10. They correspond to
and confirm that there exists a sharp boundary layer at the right of
In order to reach the lowest value we have used continuation with respect to this parameter and we have loosen the tolerance to As a result, the convergence of the Newton method is no longer quadratic but is reduced to something around the unit.
It is very important to underline that for Chebfun uses a solution of length 97 and for : it uses a much larger solution of length The Newton’s method resolved the first case mentioned above using 7 iterations while for the later case it resolved the problem only in four iterations. The order of the Newton method is close to two, but the Chebyshev coefficients of the solution decrease only to the level
We have not found numerical results in the literature to compare with ours. Some other listed problems in [
19] have been solved by Chebfun without any difficulty.
The exact solution to (
17) has the form:
When
:
the infinity norm of the error
reaches the value of order
which emphasizes the accuracy of the computations.
4. Discussion
Chebfun is not a universal panacea!
There are nonlinear and singular problems for which no matter how much we have reduced tolerance, i.e.,
bvpTol, Chebfun fails. An example is the problem (
13). This seems to be the most difficult problem in the multitude of our numerical experiments.
The exponential accuracy is proved by the rate the Chebyshev coefficients of solutions decay. Again the problem (
13) is in the worst situation. The rate of convergence is only algebraic. A slightly better situation is found relative to the singular problem (
15). Otherwise, in all other cases, the problems are solved with exponential accuracy.
Another advantage of Chebfun compared to conventional ChC is the lack of rounding-off plateau in the analysis of solution coefficients. This is due to the way Chebfun truncates.
The main conclusion of the paper is that, up to date, collocation in form of Chebfun provides the most accurate solution in solving genuinely nonlinear and/or singular 1D BVPs.
We believe that the complete treatment of these difficult BVPs, until finding the effective order of accuracy of numerical methods, shows current limitations of numerical analysis.