We demonstrate below how to solve and simulate for a nonlinear BVP. For example, the following Maple code computes and simulates Example 4.3.

Set all parameters as default values

**> restart:**

For drawing approximation graphics, we must type the following line

**> with(plots):**

A user has to specify with (linalg) for linear algebra operations in Maple

**> with(linalg):**

A user can define the grid point size *N* for sinc-Galerkin approximation

**> N:=48:**

The boundary conditions are given as Eq. (4.3).

**> a:=4:**

**> b:=5:**

**> Boundaries:=y(a)=0,y(b)=0;**
$Boundaries:=y(a)=0,y(b)=0.$

*P*, *Q* and *R* are the variable coefficients of Eq. (1.1). In Maple for Eq. (4.3) they are defined as follows:

*F* is right side of Eq. (4.3)

**> F(x):=cos(Pi*x^2)*x;**
$F(x):=cos\left(\pi {x}^{2}\right)x.$

We can write a nonlinear part of Eq. (1.1) as follows. User can define any form of nonlinearity in this section.

**> NLPart:=-exp(-sin(y(x)))*y(x)^2/(1+y(x));**
$NL(y(x))=NLPart:=-\frac{{\mathrm{e}}^{-sin(y(x))}{(y(x))}^{2}}{1+y(x)}.$

The main form of Eq. (1.1)

**> Equation:=P(x)*diff(y(x),x$2)+Q(x)*diff(y(x),x$1)+R(x)*NLPart=F(x);**
$\frac{{d}^{2}}{d{x}^{2}}y(x)+\frac{d}{dx}y(x)-\frac{{\mathrm{e}}^{-sin(y(x))}{(y(x))}^{2}}{1+y(x)}=cos\left(\pi {x}^{2}\right)x.$

If the user needs, the main equation can be written in the latex format

In order to compare our method with the Newton interpolation (for nonlinear ODE) method, we first solve Eq. (

4.3) numerically as follows:

Prepare the plot of the Newton solution

**> PlotNewtonSolution:=odeplot(NewtonSolution,a....b):**

To define ${I}_{m}^{(0)}=[{\delta}_{jk}^{(0)}]$, ${I}_{m}^{(1)}=[{\delta}_{jk}^{(1)}]$ and ${I}_{m}^{(2)}=[{\delta}_{jk}^{(2)}]$ matrices given in Eqs. (3.13)-(3.15), we use piecewise functions in Maple in the following way:

**> delta[0]:=unapply(piecewise(j=k,1,j<>k,0),j,k):**

**> delta[1]:=unapply(piecewise(j=k,0,j<>k,((-1)^(k-j))/(k-j)),j,k):**

**> delta[2]:=unapply(piecewise(j=k,(-Pi^2)/3,j<>k,-2*(-1)^(k-j)/(k-j)^2),j,k):**

The parameters for sinc-approximation given [1]

**> d:=Pi/2:**

**> h:=2/sqrt(N):**

The evenly spaced nodes given (2.9) and Table 1 are defined as follows:

**> xk:=unapply((a+b*exp(k*h))/(1+exp(k*h)),k);**
${x}_{k}:=k\mapsto \frac{4+5{\mathrm{e}}^{kh}}{1+{\mathrm{e}}^{kh}}.$

The conformal map in Table 1 for sinc-Galerkin method and its derivatives is computed as follows:

**> phi:=unapply(log((x-a)/(b-x)),x);**
$\varphi (x):=x\mapsto ln\left(\frac{x-4}{5-x}\right).$

**> Dphi:=unapply(simplify(diff(phi(x),x)),x):**

**> D2phi:=unapply(simplify(diff(phi(x),x$2)),x):**

The weight function and its derivatives are computed for using an inner product to discretization Eq. (4.3)

**> w:=unapply(1/Dphi(x),x):**

**> Dw:=unapply(simplify(diff(w(x),x$1)),x):**

**> D2w:=unapply(simplify(diff(w(x),x$2)),x):**

By using sinc-discretization in (3.16), the matrix system with

$(2N+1)\times (2N+1)$ dimensions defined in (3.17) is obtained by the following iteration:

If we want to obtain solutions of linear BVPs, we can use the following lines. They can reduce time complexity. Here, the linear solution is given as a comment (“#”).

**> #for Linear system**

**> #vars:=seq(c[i],i=-N..N):**

**> #A,b:=LinearAlgebra[GenerateMatrix](evalf(MatrixSystem),[vars]):**

**> #c:=linsolve(A,b);**

In this paper, we want to solve nonlinear problems. Then we use **fsolve** function given by Maple to find unknown ${c}_{j}$ coefficients (3.17)-(3.18) from nonlinear matrix systems. This function can solve any nonlinear systems by using the Newton method (for nonlinear equation systems).

**> c:=fsolve(evalf(MatrixSystem)):**

Finally, we have unknown

${c}_{j}$ coefficients for the approximate sinc-Galerkin solution (3.18)

We define plot of Eq. (4.3) obtained by the sinc-Galerkin solution

**> Sinc-GalerkinPlot:=plot({ApproximateSol(x)},x=a..b,color=green,thickness=1):**

Simulation: Figure

5, Figure

6, and Figure

7 are obtained as

Enter the number of digits here

**> Digits := 15:**

Tables

2,

3, and

4 are obtained by the following code: