# The Numerical Solution of Problems in Calculus of Variation Using B-Spline Collocation Method

Authors: M. Zarebnia; M. Birjandi
Journal: Journal of Applied Mathematics
 (2012)

---

## Abstract

A B-spline collocation method is developed for solving boundary value problems which arise from the problems of calculus of variations. Some properties of the B-spline procedure required for subsequent development are given, and they are utilized to reduce the solution computation of boundary value problems to some algebraic equations. The method is applied to a few test examples to illustrate the accuracy and the implementation of the method.


---

## Body

## 1. Introduction

Minimization problems that can be analyzed by the calculus of variations serve to characterize the equilibrium configurations of almost all continuous physical systems, ranging between elasticity, solid and fluid mechanics, electromagnetism, gravitation, quantum mechanics, string theory, many, many others. Many computational methods as motivated by optimization problems use the technique of minimization. Methods of search, finite elements, and iterative schemes are part of optimization theory. The classical calculus of variation [1, 2] answers the question: what conditions must the minimizer satisfy? while the computational techniques are concerned with the question: how to find or approximate the minimizer? The list of main contributors to the calculus of variations includes the most distinguished mathematicians of the last three centuries such as Leibnitz, Newton, Bernoulli, Euler, Lagrange, Gauss, Jacobi, Hamilton, and Hilbert. In recent years, many different methods have been used to estimate the solution of problems in calculus of variations [3–12]. In this work, we consider collocation method based on using B-spline basis functions, for finding approximate solution of differential equations which arise from problems of calculus of variations. The application of the method to differential equations leads to an algebraic system.The organization of this paper is as follows: in Section2, we introduce the general form of problems in calculus of variations, and their relations with ordinary differential equations are highlighted. In Section 3, we describe the cubic B-spline function and basic formulation of B-spline collocation method required for our subsequent development and present a clear overview of this method. Also in this section, we illustrate how the cubic B-spline method may be used to replace boundary value problems by explicit systems of algebraic equations. In Section 4, we report our numerical results and demonstrate the efficiency and accuracy of the proposed numerical scheme by considering some numerical examples. Section 5 ends this paper with a conclusion. Note that we have computed the numerical results by Mathematica (7) programming.


## 2. Calculus of Variation Problems and Their Relations with BVPs

The general form of a variational problem can be considered as finding the extremum of the functional(2.1)J[u1(t),u2(t),…,un(t)]=∫ab‍G(t,u1(t),u2(t),…,un(t),u1′(t),u2′(t),…,un′(t))dt.To find the extreme value ofJ, the boundary points of the admissible curves are known in the following form:
(2.2)ui(a)=γi,i=1,2,…,n,ui(b)=δi,i=1,2,…,n.The necessary condition for (2.1) to extremize J[u1(t),u2(t),…,un(t)] is that it should satisfy the Euler-Lagrange equations
(2.3)∂G∂ui-ddt(∂G∂ui′)=0,i=1,2,…,n,
with boundary conditions given in (2.2). The system of boundary value problems (2.3) does not always have a solution, and if the solution exists, it may not be unique. Note that in many variational problems, the existence of a solution is obvious from the physical or geometrical meaning of the problem, and if the solution of Euler's equation satisfies the boundary conditions, it is unique. Also this unique extremal will be the solution of the given variational problem [2]. Thus, another approach for solving the variational problem (2.1) is finding the solution of the system of ordinary differential equations (2.3) which satisfies the boundary conditions (2.2). The simplest form of the variational problem (2.1) is
(2.4)J[u(t)]=∫ab‍G(t,u(t),u′(t))dt,
with the given boundary conditions
(2.5)u(a)=γ,u(b)=δ.
Here, the necessary condition for the extremum of the functional (2.4) is to satisfy the following second-order differential equation:
(2.6)∂G∂u-ddt(∂G∂u′)=0,
with boundary conditions given in (2.5). In the present work, we find the variational problems by applying cubic B-spline collocation method on the Euler-Lagrange equations.


## 3. Cubic B-Spline Method

### 3.1. B-Spline Preliminaries

Consider the partitionΔ={t0,t1,t2,…,tN} of [a,b]⊂R. Let Sk(Δ) denote the set of piecewise polynomials of degree k on subinterval Ij=[xj-1,xj] of partition Δ. In this work, we consider cubic B-spline method for finding approximate solution of variational problems. B-spline functions are discussed thoroughly in [13].Consider the grid pointsti on the interval [a,b] as follows:
(3.1)a=t0<t1<t2<⋯,tN-1<tN=b,(3.2)tj=t0+jh,j=0,1,2,…,N,
where h=(b-a)/N. Let Bk,j be the B-spline function of degree k, where j∈ℤ, and satisfy the following conditions: (i)
Supp(Bk,j)=[tj,tj+k+1],(ii)
Bk,j(t)≥0,for allt∈ℝ,(iii)
∑j=-∞∞Bk,j(t)=1,for allt∈ℝ.The zero-order polynomial B-spline is defined as(3.3)B0,j(t)={1,t∈[tj,tj+1),0,otherwise,
and also, the general-order B-spline is given by
(3.4)Bk,j(t)=t-tjtk+j-tjBk-1,j(t)+tk+j+1-ttk+j+1-tj+1Bk-1,j+1(t).Note that this definition means thatBk,j(t) is nonzero only in the range tj≤t≤tk+j+1. The cubic B-splines Bk,j(t), at the grid points tj, are defined as
(3.5)B3,j(t)=16h3{(t-tj)3,t∈[tj,tj+1],h3+3h2(t-tj+1)+3h(t-tj+1)2-3(t-tj+1)3,t∈[tj+1,tj+2],h3+3h2(tj+3-t)+3h(tj+3-t)2-3(tj+3-t)3,t∈[tj+2,tj+3],(tj+4-t)3,t∈[tj+3,tj+4].


### 3.2. Approximate Solution of the Problems in Calculus of Variation

Now let us consider the general form of the variational problem (2.1). Finding the solution of the problem (2.1) needs to solve the corresponding ordinary differential equations (2.3) with boundary conditions (2.2). We assume (u1(t),u2(t),…,un(t)) be the exact solution of the boundary value problem (2.3). By considering (3.5), the functions (u1(t),u2(t),…,un(t)) defined over the interval [a,b] are approximated by the following linear combinations of the cubic B-spline functions:
(3.6)u1(t)≃u1,N(t)=∑j=-3N-1‍w1,jB3,j(t),(3.7)u2(t)≃u2,N(t)=∑j=-3N-1‍w2,jB3,j(t),⋮(3.8)un(t)≃un,N(t)=∑j=-3N-1‍wn,jB3,j(t),
where wi,j,i=1,2,…,n,j=-3,-2,…,N-1 are unknown coefficients and B3,j(t) are cubic B-spline functions which are defined in (3.5). For convenience, consider the second-order boundary value problem (2.3) as follows:
(3.9)F(u1(t),u2(t),…,un(t),u1′(t),…,un′(t),u1′′(t),…,un′′(t))=0,
and also consider B3,j(t)=Bj(t). By using (3.6)–(3.8), we can approximate ui(t), ui′(t) and ui′′(t),i=1,2,…,n as follows:
(3.10)ui(t)≃∑j=-3N-1‍wi,jBj(t),ui′(t)≃∑j=-3N-1‍wi,jBj′(t),ui′′(t)≃∑j=-3N-1‍wi,jBj′′(t).By substituting in (3.9) and setting t=tl,l=0,1,2,…,N, as collocation points, we obtain
(3.11)F(∑j=-3N-1‍w1,jBj(tl),…,∑j=-3N-1‍wn,jBj(tl),∑j=-3N-1‍w1,jBj′(tl),…,∑j=-3N-1‍wn,jBj′′(tl))=0.
the system (3.11) consists of n(N+1) equations with n(N+3) unknowns {wj}j=-3n-1. Now, consider the 2n equations from boundary conditions (2.2) as follows:
(3.12)∑j=-3N-1‍wi,jBj(t0)=γi,i=1,2,…,n,(3.13)∑j=-3N-1‍wi,jBj(tN)=δi,i=1,2,…,n.Adding (3.12) and (3.13) to the system of (3.11), we obtain n(N+3) equations with n(N+3) unknowns wi,j,i=1,2,…,n,j=-3,-2,…,N-1. Solving the system (3.11)–(3.13), the coefficients wi,j,i=1,2,…,n,j=-3,-2,…,N-1 are obtained. Then, we can obtain an approximation to the solution of (3.9) that is equivalent to the solution of the variational problem (2.1) as
(3.14)ui(t)≃ui,N(t)=∑j=-3N-1‍wi,jBj(t),i=1,2,…,n.


## 3.1. B-Spline Preliminaries

Consider the partitionΔ={t0,t1,t2,…,tN} of [a,b]⊂R. Let Sk(Δ) denote the set of piecewise polynomials of degree k on subinterval Ij=[xj-1,xj] of partition Δ. In this work, we consider cubic B-spline method for finding approximate solution of variational problems. B-spline functions are discussed thoroughly in [13].Consider the grid pointsti on the interval [a,b] as follows:
(3.1)a=t0<t1<t2<⋯,tN-1<tN=b,(3.2)tj=t0+jh,j=0,1,2,…,N,
where h=(b-a)/N. Let Bk,j be the B-spline function of degree k, where j∈ℤ, and satisfy the following conditions: (i)
Supp(Bk,j)=[tj,tj+k+1],(ii)
Bk,j(t)≥0,for allt∈ℝ,(iii)
∑j=-∞∞Bk,j(t)=1,for allt∈ℝ.The zero-order polynomial B-spline is defined as(3.3)B0,j(t)={1,t∈[tj,tj+1),0,otherwise,
and also, the general-order B-spline is given by
(3.4)Bk,j(t)=t-tjtk+j-tjBk-1,j(t)+tk+j+1-ttk+j+1-tj+1Bk-1,j+1(t).Note that this definition means thatBk,j(t) is nonzero only in the range tj≤t≤tk+j+1. The cubic B-splines Bk,j(t), at the grid points tj, are defined as
(3.5)B3,j(t)=16h3{(t-tj)3,t∈[tj,tj+1],h3+3h2(t-tj+1)+3h(t-tj+1)2-3(t-tj+1)3,t∈[tj+1,tj+2],h3+3h2(tj+3-t)+3h(tj+3-t)2-3(tj+3-t)3,t∈[tj+2,tj+3],(tj+4-t)3,t∈[tj+3,tj+4].


## 3.2. Approximate Solution of the Problems in Calculus of Variation

Now let us consider the general form of the variational problem (2.1). Finding the solution of the problem (2.1) needs to solve the corresponding ordinary differential equations (2.3) with boundary conditions (2.2). We assume (u1(t),u2(t),…,un(t)) be the exact solution of the boundary value problem (2.3). By considering (3.5), the functions (u1(t),u2(t),…,un(t)) defined over the interval [a,b] are approximated by the following linear combinations of the cubic B-spline functions:
(3.6)u1(t)≃u1,N(t)=∑j=-3N-1‍w1,jB3,j(t),(3.7)u2(t)≃u2,N(t)=∑j=-3N-1‍w2,jB3,j(t),⋮(3.8)un(t)≃un,N(t)=∑j=-3N-1‍wn,jB3,j(t),
where wi,j,i=1,2,…,n,j=-3,-2,…,N-1 are unknown coefficients and B3,j(t) are cubic B-spline functions which are defined in (3.5). For convenience, consider the second-order boundary value problem (2.3) as follows:
(3.9)F(u1(t),u2(t),…,un(t),u1′(t),…,un′(t),u1′′(t),…,un′′(t))=0,
and also consider B3,j(t)=Bj(t). By using (3.6)–(3.8), we can approximate ui(t), ui′(t) and ui′′(t),i=1,2,…,n as follows:
(3.10)ui(t)≃∑j=-3N-1‍wi,jBj(t),ui′(t)≃∑j=-3N-1‍wi,jBj′(t),ui′′(t)≃∑j=-3N-1‍wi,jBj′′(t).By substituting in (3.9) and setting t=tl,l=0,1,2,…,N, as collocation points, we obtain
(3.11)F(∑j=-3N-1‍w1,jBj(tl),…,∑j=-3N-1‍wn,jBj(tl),∑j=-3N-1‍w1,jBj′(tl),…,∑j=-3N-1‍wn,jBj′′(tl))=0.
the system (3.11) consists of n(N+1) equations with n(N+3) unknowns {wj}j=-3n-1. Now, consider the 2n equations from boundary conditions (2.2) as follows:
(3.12)∑j=-3N-1‍wi,jBj(t0)=γi,i=1,2,…,n,(3.13)∑j=-3N-1‍wi,jBj(tN)=δi,i=1,2,…,n.Adding (3.12) and (3.13) to the system of (3.11), we obtain n(N+3) equations with n(N+3) unknowns wi,j,i=1,2,…,n,j=-3,-2,…,N-1. Solving the system (3.11)–(3.13), the coefficients wi,j,i=1,2,…,n,j=-3,-2,…,N-1 are obtained. Then, we can obtain an approximation to the solution of (3.9) that is equivalent to the solution of the variational problem (2.1) as
(3.14)ui(t)≃ui,N(t)=∑j=-3N-1‍wi,jBj(t),i=1,2,…,n.


## 4. Numerical Examples

In order to illustrate the performance of the cubic B-spline collocation method and the efficiency of the method, the following examples are considered. The examples have been solved by the presented method with different values ofN. We define the error function E(t)=u(t)-uN(t) where u(t) and uN(t) denote exact and approximate solutions, respectively. The errors are reported on the set of uniform grid points with step size hU=(b-a)/100,
(4.1)U={z0,z1,…,z100},zj=a+jhU,j=0,1,…,100.
The error on this grid is
(4.2)∥E∥=max0≤j≤100|E(zj)|.
Tables 1–3 exhibit the absolute errors.Table 1
Results for Example4.1.
N
h
∥
E
∥
8
1
/
8
6.9109
×
10
-
2
16
1
/
16
1.7165
×
10
-
2
32
1
/
32
4.2845
×
10
-
3
64
1
/
64
1.0707
×
10
-
3
128
1
/
128
2.6764
×
10
-
4
256
1
/
256
6.6906
×
10
-
5Table 2
Results for Example4.2.
N
h
∥
E
∥
8
1
/
8
2.1846
×
10
-
6
16
1
/
16
5.4396
×
10
-
7
32
1
/
32
1.3544
×
10
-
7
64
1
/
64
3.3500
×
10
-
8
128
1
/
128
8.0172
×
10
-
9
256
1
/
256
1.6469
×
10
-
9Table 3
Results for Example4.3.
N
h
∥
E
1
∥
∥
E
2
∥
8
π
/
16
8.9855
×
10
-
4
8.9855
×
10
-
4
16
π
/
32
2.2507
×
10
-
4
2.2507
×
10
-
4
32
π
/
64
5.6321
×
10
-
5
5.6321
×
10
-
5
64
π
/
128
1.4082
×
10
-
5
1.4082
×
10
-
5
128
π
/
256
3.5207
×
10
-
6
3.5207
×
10
-
6
256
π
/
512
8.8018
×
10
-
7
8.8018
×
10
-
7Example 4.1.
We first consider the following variational problem with the exact solutionu(t)=e3t [11]:
(4.3)minJ=∫01‍(u(t)+u′(t)-4e3t)2dt,
subject to boundary conditions
(4.4)u(0)=1,u(1)=e3.
Considering (4.3), the Euler-Lagrange equation of this problem can be written in the following form:
(4.5)u′′(t)-u(t)-8e3t=0.
By considering (3.6), (3.10), and (3.11) and also substituting in (4.5) and setting t=tl,l=0,1,2,…,N, we obtain
(4.6)∑j=-3N-1‍wj[Bj′′(tl)-Bj(tl)]=8e3tl,l=0,1,2,…,N,
where tl=t0+lh,h=1/N. The linear system (4.6) consists of (N+1) equations with (N+3) unknowns {wj}j=-3N-1. Now, consider the two equations from (3.12) to (3.13) and boundary conditions (4.4) as follows:
(4.7)∑j=-3N-1‍wjBj(t0)=1,(4.8)∑j=-3N-1‍wjBj(tN)=e3.
Adding (4.7) and (4.8) to the system of (4.6), we obtain (N+3) equations with (N+3) unknowns wj,j=-3,-2,…,N-1. In order to determine these (N+3) unknowns, we can now rewrite (4.6)–(4.8) in the matrix form
(4.9)AW=P,
where A is a square matrix of order (N+3)×(N+3) and is defined as follows:
(4.10)A=[ak,l],k=1,2,…,N+3,l=1,2,…,N+3,a1,l=Bj(0),j=l-4,l=1,2,…,N+3,ak,j=Bj′′(ti)-Bj(ti),i=k-2,k=2,3,…,N+2,j=l-4,l=1,2,…,N+3,an+3,j=Bj(1),j=l-4,l=1,2,…,n+3,W=[w-3,w-2,…,wN-1]T,P=[1,e3t0,e3t1,…,e3tN-1,e3tN,e3]T.
Solving the linear system (4.9), the coefficients wj,j=-3,-2,…,N-1 are obtained. Then, we can obtain an approximation to the solution as
(4.11)u(t)≃uN(t)=∑j=-3N-1‍wjBj(t).
The maximum absolute errors in numerical solution of Example4.1 are tabulated in Table 1.These results show the efficiency and applicability of the presented method.Example 4.2.
In this example, we consider the following variational problem [2]:
(4.12)minJ=∫01‍1+u2(t)u′2(t)dt,
which satisfies the conditions
(4.13)u(0)=0,u(1)=0.5.
The exact solution of this problem isu(t)=sinh(0.4812118250t). In this case, the Euler-Lagrange equation is written in the following form:
(4.14)u′′(t)+u′′(t)u2(t)-u(t)u′2(t)=0.
Substituting  (3.6) into (4.13)-(4.14) and evaluating the result at the B-spline grid points (3.2), we obtain
(4.15)∑j=-3N-1‍wjBj(t0)=0,∑j=-3N-1‍wjBj′′(ti)+∑j=-3N-1‍wjBj′′(ti)(∑j=-3N-1‍wjBj(ti))2-∑j=-3N-1‍wjBj(ti)(∑j=-3N-1‍wjBj′(ti))2=0,i=0,1,2,…,N,∑j=-3N-1‍wjBj(tN)=0.5.
Solving(N+3) nonlinear algebraic equations (4.15) by Newton's method and substituting the wj for j=-3,-2,…,N-1 to (4.11), the approximation solution can be found. In Table 2, we give the maximum absolute errors for different values of N.From Table2, we see the errors decrease as N increases.Example 4.3.
In this example, consider the following problem of finding the extremals of the functional [2, 11]:
(4.16)J[u1(t),u2(t)]=∫0π/2‍(u1'2(t)+u2'2(t)+2u1(t)u2(t))dt,
with boundary conditions
(4.17)u1(0)=0,u1(π2)=1,u2(0)=0,u2(π2)=-1.
The system of Euler's differential equations is of the form(4.18)u1′′(t)-u2(t)=0,u2′′(t)-u1(t)=0.
The exact solutions of the problem areu1(t)=sin(t) and u2(t)=-sin(t). In this example, according to the general form of variational problem (2.1), we have i=2. Thus, we use (3.6) and (3.7) to approximate u1(t) and u2(t). Now substituting u1(t) and u2(t) into (4.18) and evaluating the result at the grid points (3.2), we obtain
(4.19)∑j=-3N-1‍w1,jBj(t0)=0,∑j=-3N-1‍w2,jBj(t0)=0,∑j=-3N-1‍w1,jBj′′(ti)-∑j=-3N-1‍w2,jBj(ti)=0,i=0,1,2,…,N,∑j=-3N-1‍w2,jBj′′(ti)-∑j=-3N-1‍w1,jBj(ti)=0,i=0,1,2,…,N,∑j=-3N-1‍w1,jBj(tN)=1,∑j=-3N-1‍w2,jBj(tN)=1.
Solving2(N+3) linear algebraic Equations (4.19) and by substituting the w1,j and w2,j for j=-3,-2,…,N-1 to u1(t) and u2(t), the approximate solutions can be found. Suppose that ∥E1∥ and ∥E2∥ are the maximum absolute errors for u1(t) and u2(t), respectively. Table 3 shows ∥E1∥ and ∥E2∥ for different values of N.


## 5. Conclusions

This paper described an efficient method for finding the minimum of a functional over the specified domain. The main objective is to find the solution of an ordinary differential equation which arises from the variational problem. Our approach was based on the cubic B-spline method. Properties of the B-spline method are utilized to reduce the computation of this problem to some algebraic equations. The method is computationally attractive, and applications are demonstrated through illustrative examples. The obtained results showed that this approach can solve the problem effectively.



---

*Source: 605741-2012-08-29.xml*