*ISSN 2319-8133 (Online)*

*(An International Research Journal), www.compmath-journal.org *

**Solving Variational Problems Using Haar Wavelet **

**J. Kumar**

^{1}**, P. Manchanda**

^{2}** and Pooja Rai**

^{3 }1,2,3

### Department of Mathematics,

### Guru Nanak Dev University, Amritsar, INDIA.

### email:bhatiajkumar@yahoo.com.

### (Received on: January 15, 2016) **ABSTRACT **

Haar wavelets are used for approximating solution of variational problems of calculus of variations. The variational problem is converted into differential equation using Euler Lagrange's equation and then Haar collocation method is applied to solve this differential equation.

**Mathematical Subject Classification: 65L60; 42C40. **

**Keywords: Variational problem, Euler Lagrange's equation, Collocation method, **
Haar wavelet.

**1. INTRODUCTION **

### Variational problems have applications in many different fields such as physics, mathematics and engineering. In Calculus of variations, we deal with the problem of finding the function which optimizes given functional. Classical solution to minimization problem can be given by Euler Lagrange's equation. However, it is not always possible to solve this equation. So, direct methods such as well known Ritz and Galerkin methods have been applied to solve variational problems arising in the Calculus of Variations

^{6,7}

### .

### Wavelets have found application in many different areas of engineering and science.

### Various types of wavelets and orthogonal functions such as Walsh function

^{4}

### , Legendre

### wavelets

^{12}

### , Sine-cosine wavelets

^{13}

### , Walsh-wavelet packet

^{8}

### , Bernstein polynomials

^{5}

### ,

### Chebyshev wavelets

^{1}

### , Hermite wavelets

^{2}

### were also used in finding solution to Variational

*problems arising in Calculus of Variations. M. Razzaghi et al.*

^{11}

### used rationalized Haar

### function for these problems. C. H. Hsiao

^{9}

### derived operational matrix of integration and

### product matrix and established direct method to solve variational problems using Haar

*wavelet. S. A. Yousefi et al.*

^{14}

### implemented variational iteration method to find solution of

### the Euler Lagrange, Euler Poisson and Euler Ostrogradsky equations which arise from the

### variational problems. The solution to boundary value problems which arise from variational

### problems of calculus of variations has been obtained using Sinc-Galerkin method

^{15}

### , B-spline collocation method

^{16}

### and parametric quintic spline method

^{17}

### .

### Haar wavelet has been successfully applied for solving differential equations and integral equations. Haar wavelet is very simple and has low computational cost. In this paper, we propose numerical solution to variational problems using Haar wavelet. The approach is based on converting the underlying variational problem into differential equation, then this differential equation is solved using Haar wavelet to find the approximate solution to the problem. The variational problem is converted into algebraic equations containing finite variables.

### The outline of paper is as follows: In second section, we give overview of Haar matrix and integration matrix. In third section, we describe the problem and formulation of our method. In fourth section, we present the numerical solution to some of the problems of calculus of variation. Concluding remarks are presented in Section 5.

**2. HAAR WAVELET **

### Wavelets constitute a family of functions constructed from dilation and translation of a single function called the mother wavelet. Haar wavelet is compactly supported orthonormal wavelet and is the simplest one among all wavelets. It has been used in different numerical approximation problems

^{3,9,10}

### . The Haar wavelet family for *t* [0,1) is defined as follows:

### Let *i* *m k* 1 represent wave number, where *m* 2 ,

^{j}*j* 0,1,..., *J* and 0,1, 2,..., 1

*k* *m* . For *i* 1, *h t*

_{1}

### ( ) is given by

1

### 1, [0,1) ( ) 0, elsewhere *h t* *t*

###

### For *i* 2, *h t*

_{2}

### ( ) is given as

2

### 1, [0,1/ 2) ( ) 1, [1/ 2,1) 0, elsewhere

*t*

*h t* *t*

###

###

###

### All the other wavelets are obtained by translation and dilation of *h t*

_{2}

### ( ) *. The i-th Haar * wavelet for *i* 2 is defined as

1 2

2 3

### 1, [ ( ), ( )) ( ) 1, [ ( ), ( ))

### 0, elsewhere

*i*

*t* *i* *i*

*h t* *t* *i* *i*

###

###

###

###

###

### Where

_{1}

_{2}

### 0.5

_{3}

### 1

### ( ) *k* , ( ) *k* , ( ) *k* .

*i* *i* *i*

*m* *m* *m*

### ^{} ^{}

### Maximum value of *i* 2 *M* 2

^{J}^{}

^{1}

### .

### The Haar wavelet functions are orthogonal to each other, i.e.,

1

0

### 1 , for ( ) ( )

### 0, for

*i* *j*

*i* *j* *h t h t dt* *m*

*i* *j*

###

###

###

###

**2.1 Haar Matrix and Integration Matrix **

### Let *t* [0,1) * and J is the level of resolution. Define M = 2*

^{J}### and divide interval [0, 1]

*into 2M subintervals of equal length. Then length of each subinterval is given by *

### 1 0 1

### 2 2 .

*t* *M* *M*

### ^{}

### Then the grid points are defined as , 0,1, 2,..., 2 . *t*

*l*

### *l t* *l* *M*

### The collocation points are obtained by

1

### , 1, 2,..., 2 . 2

*l* *l*

*l*

*t* *t*

*t*

^{}

*l* *M*

*Let H denote Haar matrix whose elements are given by * ( , )

_{i}### ( ).

_{l}*H i l* *h t*

*where t*

*l*

### are collocation points.

### The integration of Haar function is given by

_{1,}

0

### ( ) ( ) .

*t*

*i* *i*

*P t* *h t dt* (2.1) *The integration of Haar function of order v is given by *

,

0 0 0

times

### ( ) ... ( ) ,

*t t* *t*

*v i* *i*

*v*

*P* *t* *h t dt*

*where i=1,2,...,2M and v = 1,2,...,n. The elements of integration matrix P*

*v,i*

*(t) are given by * ( , )

,### ( ).

*v* *v i* *l*

*P i l* *P t*

*The H, P*

*1*

*, P*

*2*

*,..., P*

*v*

* are square matrices of order 2M. Any function * ( )

2### ( ), [0,1)

*f t* *L R t* can be approximated using Haar wavelets as

1

### ( )

_{i}

_{i}### ( ).

*i*

*f t* *a h t*

###

*where a*

*i*

* represents wavelet coefficient and are given by *

1

0

( ) ( ) ( ) .

*i* *i*

*a t*

###

*f t h t dt*

### Truncating above series to finite terms, we can write

2

1

### ( ) ( ).

*M*
*i i*
*i*

*f t* *a h t*

###

*This equation will be satisfied for all collocation points t*

*l*

### , i.e.,

2

1

### ( ) ( ), 1, 2,..., 2

*M*

*l* *i i* *l*

*i*

*f t* *a h t* *l* *M*

### (2.2)

### *Then eq.(2.2) represent 2M linear equations in 2M unknowns and can be written in the *

### matrix form as . *F* *AH*

*where H is Haar Matrix, * *A* *a a*

1### ,

2### , ..., *a*

2

_{M}### and

###

###

1### ,

2### ,...,

2

_{M}### .

*F* *f t* *f t* *f* *t*

### Let *H*

^{}

^{1}

* represents inverse of Haar matrix. Knowing the values of F and H, A can be * obtained by

### *

1### . *A* *F H*

^{}

**3. NUMERICAL METHOD **

*The extremization problem for given functional F is given by *

1

( ) 0

### ( , ( ), ( ), ( ),...,

^{n}### ( )) .

*I* *F t y t y t y t* *y* *t dt* (3.1) *The necessary condition for eq. (3.1) to attain extreme value is that y(t) should satisfies Euler * Lagrange's equation.

2

2

### ... ( 1)

( )### 0.

*n*
*n*

*n* *n*

*F* *d* *F* *d* *F* *d* *F*

*y* *dt* *y* *dt* *y* *dt* *y*

###

### (3.2)

### On solving this, a differential equation is obtained. Then solving this differential *equation, we get value of y(t) for which variational problem given in eq. (3.1) has extreme * value. However, solving this differential equation is not always possible. Here we use Haar collocation method to solve this differential equation obtained from given variational problem. For this purpose, the highest derivative present in the differential equation is expanded in terms of Haar wavelet and corresponding wavelet coefficients.

### Let

2 ( )

1

### ( ) ( ), [0,1].

*M*
*n*

*i i*
*i*

*y* *t* *a h t* *t*

###

*On integrating above equation w.r.t. ‘t’ from 0 to t, we get *

2

( 1) ( 1)

1, 1

### ( ) (0) ( ).

*M*

*n* *n*

*i* *i*

*i*

*y*

^{}

*t* *y*

^{}

*a P t*

###

### The value of *P t*

_{1,}

_{i}### ( ) is same as given in eq. (2.1). Similarly, after integrating and *using boundary condition, y(t) and all its lower derivative can be obtained. Substituting these * *values in eq. (3.2) and solving, values of wavelet coefficients a*

*i*

### will be obtained. We can *now find value of function y(t) which will give the solution to variational problem (3.2). In * certain problems, the boundary conditions are not given. In that case, natural boundary conditions are used. We will give some examples of fixed as well as moving boundary conditions to present our method and then the results obtained are compared with their *analytic solution. All examples are solved using 2M = 8. All the calculations have been done * using Matlab.

**4.1 NUMERICAL EXAMPLES **

**4.1 First order extremal function with two fixed boundary condition **

**Example 4.1 Find the extremal of the following functional: **

1 2 0

### [ ( ) ( )] , *I* *y t* *t y t dt*

### subject to boundary conditions (0) 0 and (1) 1/ 4.

*y* *y*

**Solution : Here ** *F t y t y t* ( , ( ), ( )) *y t*

^{2}

### ( ) *t y t* ( ).

### The Euler Lagrange equation for this problem is given by 2 ( ) 1 0

### ( ) 1/ 2.

*y t* *y t*

###

### (4.1) This differential equation also satisfies the given boundary conditions.

### To solve this equation using Haar wavelet, expand *y t* ( ) in terms of Haar wavelet and its coefficients as

2

1

### ( ) ( ).

*M*
*i i*
*i*

*y t* *a h t*

###

*On integrating above equation w.r.t. ‘t’ from 0 to t, we get *

2 1, 1

### ( ) (0) ( ).

*M*
*i* *i*
*i*

*y t* *y* *a P t*

###

### (4.2)

*Integrating eq.(4.2) w.r.t. ‘t’ from 0 to 1, we get *

2 1, 1 2

1, 1

### (1) (0) (0)

### (0) 1 ,

### 4

*M*

*i* *i*

*i*
*M*

*i* *i*

*i*

*y* *y* *y* *a C*

*y* *a C*

###

###

###

###

### where

1

1, 1,

0
*i* *i*

### ( ).

*C* *P t*

### Using this value of *y* (0) in eq.(4.2), we get

2 2

1, 1,

1 1

### ( ) 1 ( ).

### 4

*M* *M*

*i* *i* *i* *i*

*i* *i*

*y t* *a C* *a P t*

###

*Integrating above equation w.r.t ‘t’ from 0 to t, we have *

2 2

1, 2,

1 1

### ( ) ( ).

### 4

*M* *M*

*i* *i* *i* *i*

*i* *i*

*y t* *t* *t* *a C* *a P* *t*

### (4.3) Using the value of *y t* ( ) in eq. (4.1), we get,

2

1

### ( ) 1 , 2

*M*
*i i*
*i*

*a h t*

###

### which can be written in the matrix form as .

*AH* *F*

*Using H and F, we will find A and * *y t* ( ) will be obtained from eq.(4.3).

### Exact solution to this problem is

### ( ) 1 .

### 2 2

*t* *t*

*y t*

### The numerical solution and analytic solution are compared in table 1.

**Table 1: Estimated and analytic solution of **

*y t* ( )

**for Example 4.1**

**Example 4.2 Consider the problem of finding the minimum of the functional **

t Present method Analytic solution
0.0625
0.1875 0.3125 0.4375 0.5625 0.6875 0.8125 0.9375

0.030273437500000 0.084960937500000 0.131835937500000 0.170898437500000 0.202148437500000 0.225585937500000 0.241210937500000 0.249023437500000

0.030273437500000 0.084960937500000 0.131835937500000 0.170898437500000 0.202148437500000 0.225585937500000 0.241210937500000 0.249023437500000

1

2 2

0

### [ ( ) ( ) ] ,

*I* *y t* *ty t* *y d t* with boundary conditions

### (0) 0 and (1) 1/ 4.

*y* *y*

**Solution: The Euler Lagrange equation for this problem is given by ** ( ) ( ) 1/ 2.

*y t* *y t*

### (4.4) Let

2

1

### ( ) ( ).

*M*
*i i*
*i*

*y t* *a h t*

###

### On integration and using given boundary conditions, *y t* ( ) is given by

2 2

1, 2,

1 1

### ( ) ( ).

### 4

*M* *M*

*i* *i* *i* *i*

*i* *i*

*y t* *t* *t* *a C* *a P* *t*

###

### Using value of *y t* ( ) and *y t* ( ) in eq.(4.4), we have

2

1, 2,

1

### ( ( ) ( )) 1 .

### 2 4

*M*

*i* *i* *i* *i*

*i*

*a h t* *tC* *P* *t* *t*

###

###

### Analytic solution to this problem is

2 1

2

### [( 1)( 2 2 )]

### ( ) 4( 1)

*t* *t* *t* *t*

*e* *e* *e* *e* *e* *e*

*y t* *e*

###

###

### The numerical solution and analytic solution are compared in table 2.

**Table 2: Estimated and analytic solution of **

*y t* ( )

**for Example 4.2**

**4.2 First order extremal function with one fixed boundary condition and other moving ** **boundary condition **

**Example 4.3 Find the extremal of the following functional: **

1 2 0

### [ ( ) ( )] ,

*I* *y t* *ty t dt*

t Present method Analytic solution 0.0625

0.1875 0.3125 0.4375 0.5625 0.6875 0.8125 0.9375

0.026646295899747 0.074485209357164 0.115662443117627 0.150822650547252 0.180516284991315 0.205208217439155 0.225285014347883 0.241060989563427

0.026777937796972 0.074883846791318 0.116338662375549 0.151790959882946 0.181795403116672 0.206821422262240 0.227260558289723 0.243432588751479

### subject to boundary conditions *y* (0) 0.

**Solution: Here we have only one boundary condition and another boundary condition can be ** obtained by

1

### 0 (1) 1 .

*y t*

### 2

*F*

_{}

### *y*

### Now we will solve given variation problem with boundary conditions

### (0) 0 and (1) 1 .

*y* *y* 2

### The Euler Lagrange equation is given by ( ) 1/ 2

*y t* (4.5) Let

2

1

### ( ) ( ).

*M*
*i i*
*i*

*y t* *a h t*

### (4.6)

*On integrating above equation w.r.t ‘t’ from 0 to 1, we have *

2 0, 1

### (1) (0) ,

*M*

*i* *i*

*i*

*y* *y* *a C*

###

### where

1 0,

0

### ( ) .

*i* *i*

*C* *h t dt*

2 0, 1

### (0) 1 ,

### 2

*M*

*i* *i*

*i*

*y* *a C*

###

*On integrating eq.(4.6) w.r.t ‘t’ from 0 to t, we get *

2 1, 1

2 2

0, 1,

1 1

### ( ) (0) ( ),

### ( ) 1 ( ).

### 2

*M*

*i* *i*

*i*

*M* *M*

*i* *i* *i* *i*

*i* *i*

*y t* *y* *a P t*

*y t* *a C* *a P t*

###

###

###

###

*Integrate again w.r.t ‘t’ from 0 to t, *

2 2

0, 2,

1 1

### ( ) ( ).

### 2

*M* *M*

*i* *i* *i* *i*

*i* *i*

*y t* *t* *t* *a C* *a P* *t*

###

### Putting value of *y t* ( ) in eq.(4.5), we get

2

1

### ( ) 1/ 2.

*M*
*i i*
*i*

*a h t*

###

### Analytic solution for this problem is given by

2

### ( ) .

### 4

*y t* *t*

### The numerical solution and analytic solution are compared in table 3.

**Table 3: Estimated and analytic solution of **

*y t* ( )

**for Example 4.3**

**4.3 Second order extremal function with two fixed and two moving boundary conditions ** **Example 4.4 Consider the following functional extremal problem **

1 2 0

### [ ( ) / 2 4(1 ) ( )] , *I* *y t* *t y t dt*

### with boundary conditions

### (0) 0 and (0) 0.

*y* *y*

### and *y* (1) and *y* (1) not specified.

**Solution: We are given ** *y* (0) 0 and *y* (0) 0. The two boundary conditions at other end point are obtained using natural boundary conditions.

1 1

1

### ( ) 0 (4 4 ) ( ) 0,

### (1) 0

### and ( ) 0 (1) 0.

*y* *y* *t* *t*

*y* *t*

*F* *d* *F* *t* *y t*

*dt*

*y*

*F* *y*

###

###

###

### The Euler Lagrange's equation for this problem is given by ( ) 4.

*y t*

### Expand *y t* ( ) in terms of Haar wavelet series as

2

1

### ( ) ( ).

*M*
*i i*
*i*

*y t* *a h t*

###

*Integrate above equation w.r.t ‘t’ four times and using boundary conditions, we obtain *

2 2 2 2 3 2

0, 1, 4, 0,

1 1 1 1

### ( ) ( ) .

### 2 6

*M* *M* *M* *M*

*i* *i* *i* *i* *i* *i* *i* *i*

*i* *i* *i* *i*

*t* *t*

*y t* *a C* *a C* *a P* *t* *a C*

###

###

###

### Analytic solution for this problem is given by

t Present method Analytic solution 0.0625

0.1875 0.3125 0.4375 0.5625 0.6875 0.8125 0.9375

-0.000976562500000 -0.008789062500000 -0.024414062500000 -0.047851562500000 -0.079101562500000 -0.118164062500000 -0.165039062500000 -0.219726562500000

-0.000976562500000 -0.008789062500000 -0.024414062500000 -0.047851562500000 -0.079101562500000 -0.118164062500000 -0.165039062500000 -0.219726562500000

4

3 2

### ( ) 2 .

### 6 3

*y t* *t* *t* *t*

### The numerical solution and analytic solution are compared in table 4.

**Table 4 : Estimated and analytic solution of **

*y t* ( )

**for Example 4.4**

**4.4 Application to heat conduction problem **

**Example 4.5 Consider the following functional extremization problem: **

1 2 0

### [ ( ) / 2 ( )] ,

*I* *y t* *y g t dt*

*where t is independent variable and * *y t* ( ) the dependent variable. The function *g t* ( ) is defined as

### 1, f or 0 1/ 4 and 1/2 t < 1 ( ) 3, f or 1/ 4 1/ 2

*g t* *t*

*t*

###

###

**Solution : ** *F t y t y t* ( , ( ), ( )) *y t*

^{2}

### ( ) / 2 *y g t* ( ). Euler Lagrange equation is given by

### ( ) ( ).

*y t* *g t*

### The natural boundary conditions can be obtained as

0

1

### 0 (0) 0,

### 0 (1) 0.

*y t*
*y t*

*F* *y*

*F* *y*

###

###

### Let us expand *y t* ( ) in terms of haar wavelets

2

1

### ( ) ( ).

*M*
*i i*
*i*

*y t* *a h t*

### (4.7) *On integrating w.r.t ‘t’ from 0 to 1, we get *

2 0, 1 1

### (1) (0)

### 0.

*M*

*i* *i*

*i*

*y* *y* *a C*

*a*

###

###

###

t Present method Analytic solution 0.0625

0.1875 0.3125 0.4375 0.5625 0.6875 0.8125 0.9375

-0.003746032714844 -0.030967712402344 -0.078900655110677 -0.141685485839844 -0.214439392089844 -0.293256123860677 -0.375205993652344 -0.458335876464844

-0.003746032714844 -0.030967712402344 -0.078900655110677 -0.141685485839844 -0.214439392089844 -0.293256123860677 -0.375205993652344 -0.458335876464844

*On integrating eq.(4.7) twice w.r.t ‘t’ from 0 to t, we get *

2 2, 2

### ( ) (0) ( ).

*M*

*i* *i*

*i*

*y t* *y* *a P* *t*

###

### Putting these values in Euler Lagrange equation, we have

2

1

### ( ) ( ).

*M*
*i i*
*i*

*a h t* *g t*

###

### As value of *g t* ( ) is given, we can find the value of wavelet coefficients *a*

_{i}### . Exact solution for this problem is given by

2

2

2

### / 2, 0 1/ 4

### ( ) (3 / 2) 1/ 8, 1/ 4 1/ 2

### / 2 3 / 8, 1/ 2 1

*t* *t*

*y t* *t* *t* *t*

*t* *t* *t*

###

###

###

###

### The numerical solution and analytic solution are compared in table 5.

**Table 5 : Estimated and analytic solution of **

*y t* ( )

**for Example 4.5**

**1. ** **CONCLUSION **

### We have used Haar Collocation method to find the approximate solution to Euler Lagrange equation obtained from Variational problems. The method is applied to some *variational problems of Calculus of Variation discussed in Hsiao et al.*

^{9}

* and Razzaghi et al.*

^{11}

### . The approximate solutions and the exact solution are compared which shows that present method is very effective. This method is easy to implement and gives satisfactory results as compared to direct method of Haar wavelet

^{9}

### and rationalized Haar wavelet

^{11}

### . Only a small number of Haar wavelets produce very accurate results.

**ACKNOWLEDGEMENT **

### The Authors are thankful to the University Grants Commission, India for providing the financial assistance for the preparation of the manuscript.

t Present method Analytic solution 0.0625

0.1875 0.3125 0.4375 0.5625 0.6875 0.8125 0.9375

0.001953125000000 0.017578125000000 0.041015625000000 0.025390625000000 -0.029296875000000 -0.076171875000000 -0.107421875000000 -0.123046875000000

0.001953125000000 0.017578125000000 0.041015625000000 0.025390625000000 -0.029296875000000 -0.076171875000000 -0.107421875000000 -0.123046875000000

**REFERENCES **

### 1. M. Arsalani, M. A. Vali, Numerical Solution of Nonlinear Variational Problems with *Moving Boundary Conditions by Using Chebyshev Wavelets, Applied Mathematical * **Sciences, 5(20), pp. 947-964 (2011). **

**Sciences, 5(20), pp. 947-964 (2011).**

### 2. Z. K. Alabacy, A. A. Abdulrehman, L. A. Hadi, Direct method for Solving Nonlinear *Variational Problems by Using Hermite Wavelets, Baghdad Science Journal, 12(2), pp. *

**425-430 (2015). **

### 3. P. Chang, P. Piau, Haar Wavelet Matrices Designation in Numerical Solution of *Ordinary Differential Equations, IAENG International Journal of Applied Mathematics, * **38(3), pp. 164-168 (2008). **

### 4. C. F. Chen, C. H. Hsiao, A Walsh series direct method for solving variational problems, **Journal of the Franklin Institute 300(4), pp. 265-280 (1975). **

**Journal of the Franklin Institute 300(4), pp. 265-280 (1975).**

### 5. S. Dixit, V. K. Singh, A. K. Singh, O. P. Singh, Bernstein Direct Method for Solving **Variational Problems, International Mathematical Forum, 5(48), pp. 2351-2370 (2010). **

**Variational Problems, International Mathematical Forum, 5(48), pp. 2351-2370 (2010).**

**6. L. Elsgolts, Differential Equations and Calculus of Variations, Mir: Moscow, (1977). **

**7. I. M. Gelfand, S. V. Fomin, Calculus of Variations, Prentice-Hall, Englewood Cliffs, NJ, (1963). **

**7. I. M. Gelfand, S. V. Fomin, Calculus of Variations, Prentice-Hall, Englewood Cliffs, NJ, (1963).**

*8. W. Glabisz, Direct Walsh-wavelet packet method for variational problems, Applied * **Mathematics and Computation, 159(3), pp. 769-781 (2004). **

**Mathematics and Computation, 159(3), pp. 769-781 (2004).**

*9. C. H. Hsiao, Haar wavelet direct method for solving variational problems, Mathematics * **and Computers in Simulation, 64(5), pp. 569-585 (2004). **

**and Computers in Simulation, 64(5), pp. 569-585 (2004).**

**10. U. Lepik, H. Hein, Haar Wavelets with Applications, Springer, (2014). **

### 11. M. Razzaghi, Y. Ordokhani, An application of rationalized Haar functions for variational **problems, Applied Mathematics and Computation, 122 (3), pp. 353-364 (2001). **

**problems, Applied Mathematics and Computation, 122 (3), pp. 353-364 (2001).**

### 12. M. Razzaghi, S. Yousefi, Legendre wavelets direct method for variational problems, **Mathematics and Computers in Simulation, 53 (3), pp. 185-192 (2000). **

**Mathematics and Computers in Simulation, 53 (3), pp. 185-192 (2000).**