101

HAM-based mathematica package BVPh 2.0 for nonlinear boundary value problems

  • Upload
    sjtu

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

A D V A N C E S I NTHE HOMOTOPY

ANALYSIS METHOD

May 2, 2013 14:6 BC: 8831 - Probability and Statistical Theory PST˙ws

This page intentionally left blankThis page intentionally left blank

N E W J E R S E Y • L O N D O N • S I N G A P O R E • BE IJ ING • S H A N G H A I • H O N G K O N G • TA I P E I • C H E N N A I

World Scientific

A D V A N C E S I NTHE HOMOTOPY

ANALYSIS METHOD

Editor

Shijun LiaoShanghai Jiao Tong University, China

Published by

World Scientific Publishing Co. Pte. Ltd.5 Toh Tuck Link, Singapore 596224USA office: 27 Warren Street, Suite 401-402, Hackensack, NJ 07601UK office: 57 Shelton Street, Covent Garden, London WC2H 9HE

Library of Congress Cataloging-in-Publication DataAdvances in the homotopy analysis method / edited by Shijun Liao, professor, deputy director ofthe State Key Lab of Ocean Engineering, Shanghai Jiao Tong University, China.

pages cmIncludes bibliographical references.ISBN 978-9814551243 (hard cover : alk. paper)

1. Homotopy theory. I. Liao, Shijun, 1963– editor of compilation.QA612.7.A375 2014514'.24--dc23

2013028624

British Library Cataloguing-in-Publication DataA catalogue record for this book is available from the British Library.

Copyright © 2014 by World Scientific Publishing Co. Pte. Ltd.

All rights reserved. This book, or parts thereof, may not be reproduced in any form or by any means,electronic or mechanical, including photocopying, recording or any information storage and retrievalsystem now known or to be invented, without written permission from the Publisher.

For photocopying of material in this volume, please pay a copying fee through the CopyrightClearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, USA. In this case permission tophotocopy is not required from the publisher.

In-house Editor: Angeline Fong

Printed in Singapore

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 0

Preface

The homotopy is a fundamental concept in topology, which can be traced

back to Jules Henri Poincare (1854–1912), a French mathematician. Based

on the homotopy, two methods have been developed. One is the homotopy

continuation method dating back to 1930s, which is a global convergent

numerical method mainly for nonlinear algebraic equations. The other is

the homotopy analysis method (HAM) proposed in 1990s by Shijun Liao,

the editor of this book, which is an analytic approximation method with

guarantee of convergence, mainly for nonlinear differential equations.

Different from perturbation techniques which are strongly dependent

upon small/large physical parameters (i.e. perturbation quantities), the

HAM has nothing to do with any small/large physical parameters at all.

Besides, many analytic approximation methods, such as “Lyapunov artifi-

cial small parameter method”, “Adomian decomposition method” and so

on, are only special cases of the HAM. Unlike other analytic approximation

techniques, the HAM provides us great freedom and flexibility to choose

equation-type and solution expression of high-order approximation equa-

tions. Notice that “the essence of mathematics lies entirely in its freedom”,

as pointed out by Georg Cantor (1845–1918). Most importantly, different

from all of other analytic approximation methods, the HAM provides us

a convenient way to guarantee the convergence of approximation series by

means of introducing the so-called “convergence-control parameter”. In

fact, it is the convergence-control parameter that differs the HAM from all

other analytic approximation methods. As a result, the HAM is generally

valid for various types of equations with high nonlinearity, especially for

those without small/large physical parameters.

Since 1992 when the early HAM was first proposed by Liao, the HAM

has been developing greatly in theory and applied successfully to numer-

ous types of nonlinear equations in lots of different fields by scientists,

researchers, engineers and graduated students in dozens of countries. All

of these verify the originality, novelty, validity and generality of the HAM.

v

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 0

vi Preface

So, it is necessary to describe, although briefly, the current advances of

the HAM in both theory and applications. This is the first motivation of

the book, whose chapters are contributed by the leading researchers in the

HAM coming from seven countries.

Any truly new method should give something novel and/or better. In

the past 20 years, hundreds of articles related to the HAM were published

in various fields, and some new solutions were indeed found by means of the

HAM. Thus, it is now the time to suggest some valuable but challenging

nonlinear problems to the HAM community. This is the second motivation

of the book. Some of these problems are very famous, with a long history.

Hopefully, the above-mentioned freedom and flexibility of the HAM might

create some novel ideas and inspire brave, enterprising, young researchers

with stimulated imagination to attack them with satisfactory results. I

personally believe that the applications of the HAM on these famous, chal-

lenging problems might not only indicate the great potential of the HAM,

but also lead to great modifications of the HAM in theory.

A brief review of the HAM is given in Chapter 1, with some suggested

challenging problems. The fascinating “Predictor HAM” and “Spectral

HAM” are described in Chapters 2 and 3, respectively. Some interesting

theoretical works on the auxiliary linear operator, convergence-control pa-

rameter and convergence of approximation series are described in Chapters

4 and 5. An attractive application of the HAM about flows of nanofluid is

given in Chapter 6. A charming application of the HAM for time-fractional

boundary-value problem is illustrated in Chapter 7. The HAM-based Maple

package NOPH 1.0.2 (http://numericaltank.sjtu.edu.cn/NOPH.htm) for

periodic oscillations and limit cycles of nonlinear dynamic systems with

various applications is described in Chapter 8. The HAM-based Mathemat-

ica package BVPh 2.0 (http://numericaltank.sjtu.edu.cn/BVPh.htm)

for coupled nonlinear ordinary differential equations and its applications

are given in Chapter 9. Both of them are easy-to-use, user-friendly, and

free available online with user’s guide. They can greatly simplify some

applications of the HAM.

It is a great pity that it is impossible to describe, even briefly, the whole

advances of the HAM in theory and applications in such a book. Here, I

would like to express my sincere and truthful acknowledgements to all of

the HAM community for their great contributions to the HAM.

Shijun Liao

June 2013, Shanghai

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 0

Contents

Preface v

1. Chance and Challenge: A Brief Review of Homotopy

Analysis Method 1

S.-J. Liao

2. Predictor Homotopy Analysis Method (PHAM) 35

S. Abbasbandy and E. Shivanian

3. Spectral Homotopy Analysis Method for Nonlinear

Boundary Value Problems 85

S. Motsa and P. Sibanda

4. Stability of Auxiliary Linear Operator and Convergence-

Control Parameter 123

R. A. Van Gorder

5. A Convergence Condition of the Homotopy Analysis Method 181

M. Turkyilmazoglu

6. Homotopy Analysis Method for Some Boundary Layer

Flows of Nanofluids 259

T. Hayat and M. Mustafa

vii

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 0

viii Contents

7. Homotopy Analysis Method for Fractional Swift–Hohenberg

Equation 291

S. Das and K. Vishal

8. HAM-Based Package NOPH for Periodic Oscillations of

Nonlinear Dynamic Systems 309

Y.-P. Liu

9. HAM-Based Mathematica Package BVPh 2.0 for Nonlinear

Boundary Value Problems 361

Y.-L. Zhao and S.-J. Liao

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chapter 1

Chance and Challenge:

A Brief Review of Homotopy Analysis Method

Shijun Liao

Shanghai Jiao Tong University, Shanghai 200240, China

[email protected]

A brief review of the homotopy analysis method (HAM) and some ofits current advances are described. We emphasize that the introductionof the homotopy, a basic concept in topology, is a milestone of the an-alytic approximation methods, since it is the homotopy which providesus great freedom and flexibility to choose equation type and solution ex-pression of high-order approximation equations. Besides, the so-called“convergence-control parameter” is a milestone of the HAM, too, since itis the convergence-control parameter that provides us a convenient wayto guarantee the convergence of solution series and that differs the HAMfrom all other analytic approximation methods. Relations of the HAMto the homotopy continuation method and other analytic approximationtechniques are briefly described. Some interesting but challenging non-linear problems are suggested to the HAM community. As pointed outby Georg Cantor (1845–1918), “the essence of mathematics lies entirelyin its freedom”. Hopefully, the above-mentioned freedom and great flex-ibility of the HAM might create some novel ideas and inspire brave,enterprising, young researchers with stimulated imagination to attackthem with satisfactory, better results.

1

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

2 S.-J. Liao

Contents

1.1. Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2. A brief history of the HAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.3. Some advances of the HAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.3.1. Generalized zeroth-order deformation equation . . . . . . . . . . . . . . 10

1.3.2. Spectral HAM and complicated auxiliary operator . . . . . . . . . . . . 13

1.3.3. Predictor HAM and multiple solutions . . . . . . . . . . . . . . . . . . 15

1.3.4. Convergence condition and HAM-based software . . . . . . . . . . . . . 16

1.4. Relationships to other methods . . . . . . . . . . . . . . . . . . . . . . . . . . 18

1.5. Chance and challenge: some suggested problems . . . . . . . . . . . . . . . . 20

1.5.1. Periodic solutions of chaotic dynamic systems . . . . . . . . . . . . . . 21

1.5.2. Periodic orbits of Newtonian three-body problem . . . . . . . . . . . . 22

1.5.3. Viscous flow past a sphere . . . . . . . . . . . . . . . . . . . . . . . . . 24

1.5.4. Viscous flow past a cylinder . . . . . . . . . . . . . . . . . . . . . . . . 25

1.5.5. Nonlinear water waves . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

1.1. Background

Physical experiment, numerical simulation and analytic (approximation)

method are three mainstream tools to investigate nonlinear problems.

Without doubt, physical experiment is always the basic approach. How-

ever, physical experiments are often expensive and time-consuming. Be-

sides, models for physical experiments are often much smaller than the

original ones, but mostly it is very hard to satisfy all similarity criteri-

ons. By means of numerical methods, nonlinear equations defined in rather

complicated domain can be solved. However, it is difficult to gain numeri-

cal solutions of nonlinear problems with singularity and multiple solutions

or defined in an infinity domain. By means of analytic (approximation)

methods, one can investigate nonlinear problems with singularity and mul-

tiple solutions in an infinity interval, but equations should be defined in

a simple enough domain. So, physical experiments, numerical simulations

and analytic (approximation) methods have their inherent advantages and

disadvantages. Therefore, each of them is important and useful for us to

better understand nonlinear problems in science and engineering.

In general, exact, closed-form solutions of nonlinear equations are hardly

obtained. Perturbation techniques [1–4] are widely used to gain analytic

approximations of nonlinear equations. Using perturbation methods, many

nonlinear equations are successfully solved, and lots of nonlinear phenom-

ena are understood better. Without doubt, perturbation methods make

great contribution to the development of nonlinear science. Perturbation

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 3

methods are mostly based on small (or large) physical parameters, called

perturbation quantity. Using small/large physical parameters, perturba-

tion methods transfer a nonlinear equation into an infinite number of sub-

problems that are mostly linear. Unfortunately, many nonlinear equations

do not contain such kind of perturbation quantities at all. More impor-

tantly, perturbation approximations often quickly become invalid when the

so-called perturbation quantities enlarge. In addition, perturbation tech-

niques are so strongly dependent upon physical small parameters that we

have nearly no freedom to choose equation type and solution expression of

high-order approximation equations, which are often complicated and thus

difficult to solve. Due to these restrictions, perturbation methods are valid

mostly for weakly nonlinear problems in general.

On the other side, some non-perturbation methods were proposed long

ago. The so-called “Lyapunov’s artificial small-parameter method” [5] can

trace back to the famous Russian mathematician Lyapunov (1857–1918),

who first rewrote a nonlinear equation

N [u(r, t)] = L0[u(r, t)] +N0[u(r, t)] = f(r, t), (1.1)

where r and t denote the spatial and temporal variables, u(r, t) a unknown

function, f(r, t) a known function, L0 and N0 are linear and nonlinear

operator, respectively, to such a new equation

L0[u(r, t)] + q N0[u(r, t)] = f(r, t), (1.2)

where q has no physical meaning. Then, Lyapunov regarded q as a small

parameter to gain perturbation approximations

u ≈ u0 + u1 q + u2 q2 + u3 q

3 + · · · = u0 +

+∞∑

m=1

um qm, (1.3)

and finally gained approximation

u ≈ u0 ++∞∑

m=1

um, (1.4)

by setting q = 1, where

L0[u0(r, t)] = f(r, t), L0[u1(r, t)] = −N0[u0(r, t)], · · · (1.5)

and so on. It should be emphasized that one has no freedom to choose the

linear operator L0 in Lyapunov’s artificial small-parameter method: it is

exactly the linear part of the whole left-hand side of the original equation

N [u] = f , where N = L0+N0. Thus, when L0 is complicated or “singular”

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

4 S.-J. Liao

(for example, it does not contain the highest derivative), it is difficult (or

even impossible) to solve the high-order approximation equation (1.5). Be-

sides, the convergence of the approximation series (1.4) is not guaranteed

in general. Even so, Lyapunov’s excellent work is a milestone of analytic

approximation methods, because it is independent of the existence of phys-

ical small parameter, even though it first regards q as a “small parameter”

but finally enforces it to be 1 that is however not “small” strictly from

mathematical viewpoints.

The so-called “Adomian decomposition method” (ADM) [6–8] was de-

veloped from the 1970s to the 1990s by George Adomian, the chair of the

Center for Applied Mathematics at the University of Georgia, USA. Ado-

mian rewrote (1.1) in the form

N [u(r, t)] = LA[u(r, t)] +NA[u(r, t)] = f(r, t), (1.6)

where LA often corresponds to the highest derivative of the equation under

consideration, NA[u(r, t)] gives the left part, respectively. Approximations

of the ADM are also given by (1.4), too, where

LA[u0(r, t)] = f(r, t), LA[um(r, t)] = −Am−1(r, t), m ≥ 1, (1.7)

with the so-called Adomial polynomial

Ak(r, t) =1

k!

∂k

∂qkNA

[+∞∑

n=0

un(r, t) qn

]∣∣∣∣∣q=0

. (1.8)

Since the linear operator LA is simply the highest derivative of the consid-

ered equation, it is convenient to solve the high-order approximation equa-

tions (1.7). This is an advantage of the ADM, compared to “Lyapunov’s

artificial small-parameter method” [5]. However, the ADM does not pro-

vides us freedom to choose the linear operator LA, which is restricted to be

related only to the highest derivative. Besides, like “Lyapunov’s artificial

small-parameter method” [5], the convergence of the approximation series

(1.4) given by the ADM is still not guaranteed.

Essentially, both of the “Lyapunov’s artificial small parameter method”

and the “Adomian decomposition method” transfer a nonlinear problem

into an infinite number of linear sub-problems, without small physical pa-

rameter. However, they have two fundamental restrictions. First, one has

no freedom and flexibility to choose the linear operators L0 or LA, since L0

is exactly the linear part of N and LA corresponds to the highest derivative,

respectively. Second, there is no way to guarantee the convergence of the

approximation series (1.4). The second ones is more serious, since divergent

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 5

approximations are mostly useless. Thus, like perturbation methods, the

traditional non-perturbation methods (such as Lyapunov’s artificial small

parameter method and the ADM) are often valid for weakly nonlinear prob-

lems in most cases.

In theory, it is very valuable to develop a new kind of analytic approxi-

mation method which should have the following characteristics:

(1) it is independent of small physical parameter;

(2) it provides us great freedom and flexibility to choose the equation-type

and solution expression of high-order approximation equations;

(3) it provides us a convenient way to guarantee the convergence of approx-

imation series.

One of such kind of analytic approximation methods, namely the “homo-

topy analysis method” (HAM) [9–17], was developed by Shijun Liao from

1990s to 2010s, together with contributions of many other researchers in

theory and applications. The basic ideas of the HAM with its brief history

are described below.

1.2. A brief history of the HAM

The basic ideas of “Lyapunov’s artificial small-parameter method” can be

generalized in the frame of the homotopy, a fundamental concept of topol-

ogy. For a nonlinear equation

N [u(r, t)] = f(r, t), (1.9)

Liao [9] propose the so-called “homotopy analysis method” (HAM) by using

the homotopy, a basic concept in topology:

(1− q)L[ϕ(r, t; q)−u0(r, t)] = c0 q H(r, t) N [ϕ(r, t; q)] − f(r, t) , (1.10)

where L is an auxiliary linear operator with the property L[0] = 0, N is

the nonlinear operator related to the original equation (1.9), q ∈ [0, 1] is

the embedding parameter in topology (called the homotopy parameter),

ϕ(r, t; q) is the solution of (1.10) for q ∈ [0, 1], u0(r, t) is an initial guess,

c0 6= 0 is the so-called “convergence-control parameter”, and H(r, t) is an

auxiliary function that is non-zero almost everywhere, respectively. Note

that, in the frame of the homotopy, we have great freedom to choose the

auxiliary linear operator L, the initial guess u0(r, t) , the auxiliary function

H(r, t), and the value of the convergence-control parameter c0.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

6 S.-J. Liao

When q = 0, due to the property L[0] = 0, we have from (1.10) the

solution

ϕ(r, t; 0) = u0(r, t). (1.11)

When q = 1, since c0 6= 0 and H(r, t) 6= 0 almost everywhere, Eq. (1.10) is

equivalent to the original nonlinear equation (1.9) so that we have

ϕ(r, t; 1) = u(r, t), (1.12)

where u(r, t) is the solution of the original equation (1.9). Thus, as the ho-

motopy parameter q increases from 0 to 1, the solution ϕ(r, t; q) of Eq. (1.10)

varies (or deforms) continuously from the initial guess u0(r, t) to the solu-

tion u(r, t) of the original equation (1.9). For this sake, Eq. (1.10) is called

the zeroth-order deformation equation.

Here, it must be emphasized once again that we have great freedom and

flexibility to choose the auxiliary linear operator L, the auxiliary function

H(r, t), and especially the value of the convergence control parameter c0 in

the zeroth-order deformation equation (1.10). In other words, the solution

ϕ(r, t; q) of the zeroth-order deformation equation (1.10) is also dependent

upon alla of the auxiliary linear operator L, the auxiliary function H(r, t)

and the convergence-control parameter c0 as a whole, even though they

have no physical meanings. This is a key point of the HAM, which we will

discuss in details later. Assume that L, H(r, t) and c0 are properly chosen so

that the solution ϕ(r, t; q) of the zeroth-order deformation equation (1.10)

always exists for q ∈ (0, 1) and besides it is analytic at q = 0, and that the

Maclaurin series of ϕ(r, t; q) with respect to q, i.e.

ϕ(r, t; q) = u0(r, t) +

+∞∑

m=1

um(r, t) qm (1.13)

converges at q = 1. Then, due to (1.12), we have the approximation series

u(r, t) = u0(r, t) +

+∞∑

m=1

um(r, t). (1.14)

Substituting the series (1.13) into the zeroth-order deformation equation

(1.10) and equating the like-power of q, we have the high-order approxima-

tion equations for um(r, t), called the mth-order deformation equation

L[um(r, t) − χmum−1(r, t)] = c0 H(r, t) Rm−1(r, t), (1.15)aMore strictly, ϕ(r, t; q) should be replaced by ϕ(r, t; q,L,H(r,t), c0). Only for the sakeof simplicity, we use here ϕ(r, t; q), but should always keep this point in mind.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 7

where

Rk(r, t) =1

k!

∂k

∂qk

(N[+∞∑

n=0

(r, t) qn

]− f(r, t)

)∣∣∣∣∣q=0

, (1.16)

with the definition

χk =

0, when k ≤ 1,

1, when k ≥ 2.(1.17)

For various types of nonlinear equations, it is easy and straightforward to

use the theorems proved in Chapter 4 of Liao’s book [11] to calculate the

term Rk(r, t) of the high-order deformation equation (1.15).

It should be emphasized that the HAM provides us great freedom and

flexibility to choose the auxiliary linear operator L and the initial guess u0.

Thus, different from all other analytic methods, the HAM provides us great

freedom and flexibility to choose the equation type and solution expression

of the high-order deformation equation (1.15) so that its solution can be of-

ten gained without great difficulty. Notice that “the essence of mathematics

lies entirely in its freedom”, as pointed out by Georg Cantor (1845–1918).

More importantly, the high-order deformation equation (1.15) contains the

convergence-control parameter c0, and the HAM provides great freedom

to choose the value of c0. Mathematically, it has been proved that the

convergence-control parameter c0 can adjust and control the convergence

region and ratio of the approximation series (1.14). For details, please refer

to Liao [10, 12, 13] and especially § 5.2 to § 5.4 of his book [11]. So, unlike all

other analytic approximation methods, the convergence-control parameter

c0 of the HAM provides us a convenient way to guarantee the convergence

of the approximation series (1.14). In fact, it is the convergence-control

parameter c0 that differs the HAM from all other analytic methods.

At the mth-order of approximation, the optimal value of the

convergence-control parameter c0 can be determined by the minimum of

residual square of the original governing equation, i.e.

dEmdc0

= 0, (1.18)

where

Em =

Ω

N[m∑

n=0

un(r, t)

]− f(r, t)

2

dΩ. (1.19)

Besides, it has been proved by Liao [16] that a homotopy series solution

(1.14) must be one of solutions of considered equation, as long as it is

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

8 S.-J. Liao

convergent. In other words, for an arbitrary convergence-control parameter

c0 ∈ Rc, where

Rc =

c0 : lim

m→+∞Em(c0) → 0

(1.20)

is an interval, the solution series (1.14) is convergent to the true solution

of the original equation (1.9). For details, please refer to Liao [16] and

Chapter 3 of his book [11].

In summary, the HAM has the following advantages:

(a) it is independent of any small/large physical parameters;

(b) it provides us great freedom and large flexibility to choose equation type

and solution expression of linear high-order approximation equations;

(c) it provides us a convenient way to guarantee the convergence of approx-

imation series.

In this way, nearly all restrictions and limitations of the traditional

non-perturbation methods (such as Lyapunov’s artificial small parameter

method [5], the Adomian decomposition method [6–8], the δ-expansion

method [18] and so on) can be overcome by means of the HAM.

Besides, it has been generally proved [10, 12, 13] that the Lyapunov’s

artificial small parameter method [5], the Adomian decomposition method

[6–8] and the δ-expansion method [18] are only special cases of the HAM for

some specially chosen auxiliary linear operator L and convergence-control

parameter c0. Especially, the so-called “homotopy perturbation method”

(HPM) [19] proposed by Jihuan He in 1998 (six years later after Liao [9]

proposed the early HAM in 1992) was only a special case of the HAM

when c0 = −1, and thus has “nothing new except its name” [20]. Some

results given by the HPM are divergent even in the whole interval except

the given initial/boundary conditions, and thus “it is very important to

investigate the convergence of approximation series, otherwise one might

get useless results”, as pointed out by Liang and Jeffrey [21]. For details,

see § 6.2 of Liao’s book [11]. Thus, the HAM is more general in theory and

widely valid in practice for more of nonlinear problems than other analytic

approximation techniques.

In calculus, the famous Euler transform is often used to accelerate con-

vergence of a series or to make a divergent series convergent. It is inter-

esting that one can derive the Euler transform in the frame of the HAM,

and give a similar but more general transform (called the generalized Euler

transform), as shown in Chapter 5 of Liao’s book [11]. This provides us a

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 9

theoretical cornerstone for the validity and generality of the HAM.

The introduction of the so-called “convergence-control parameter” c0 in

the zeroth-order deformation equation (1.10) is a milestone for the HAM.

From physical viewpoint, the “convergence-control parameter” c0 has no

physical meanings so that convergent series of solution given by the HAM

must be independent of c0. This is indeed true: there exists such a regionRc

that, for arbitrary c0 ∈ Rc, the HAM series converges to the true solution

of the original equation (1.9), as illustrated by Liao [10, 11]. However, if

c0 6∈ Rc, the solution series diverges! So, from a mathematical viewpoint,

the “convergence-control parameter” is a key point of the HAM, which

provides us a convenient way to guarantee the convergence of the solution

series. In fact, it is the so-called “convergence-control parameter” that

differs the HAM from all other analytic approximation methods.

The introduction of the basic concept homotopy in topology is also a

milestone of the analytic approximation methods for nonlinear problems.

It is the homotopy that provides us great freedom and large flexibility to

choose the auxiliary linear operator L and initial guess u0 in the zeroth-

order deformation equation (1.10), which determine the equation type and

solution expression of the high-order deformation equations (1.15). Besides,

it is the homotopy that provides us the freedom to introduce the so-called

“convergence-control parameter” c0 in (1.10), which becomes now a cor-

nerstone of the HAM. Note that it is impossible to introduce such kind of

“convergence-control parameter” in the frame of perturbation techniques

and the traditional non-perturbation methods (such as Lyapunov’s artificial

small parameter, Adomian decomposition method and so on).

The freedom on the choice of the auxiliary linear operator L is so large

that the second-order nonlinear Gelfand equation can be solved conveniently

(with good agreement with numerical results) in the frame of the HAM

even by means of a forth-order auxiliary linear operator (for two dimen-

sional Gelfand equation) or a sixth-order auxiliary linear operator (for three

dimensional Gelfand equation), respectively, as illustrated by Liao [14]. Al-

though it is true that the auxiliary linear operator (with the same highest

order of derivative as that of considered problem) can be chosen straight-

forwardly in most cases, such kind of freedom of the HAM should be taken

into account sufficiently by the HAM community when necessary, especially

for some valuable but challenging problems (some of them are suggested

below in § 1.5).

In addition, by means of the above-mentioned freedom of the HAM, the

convergence of approximation solution can be greatly accelerated in the

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

10 S.-J. Liao

frame of the HAM by means of the iteration, the so-called homotopy-Pade

technique and so on. For details, please refer to § 2.3.5 to § 2.3.7 of Liao’s

book [11].

Indeed, “the essence of mathematics lies entirely in its freedom”, as

pointed out by Georg Cantor (1845–1918).

Such kind of great freedom of the HAM should provide us great possi-

bility to solve some open questions. One of them is described below. The

solution of the high-order deformation equation (1.15) can be expressed in

the form

um(r, t) = −χmum−1(r, t) + L−1 [c0 H(r, t) Rm−1(r, t)] , (1.21)

where L−1 is the inverse operator of L. For a few auxiliary linear operator

L, its inverse operator is simple. However, in most cases, it is not straight-

forward to solve the above linear differential equation. Can we directly

choose (or define) the inverse auxiliary linear operator L−1 so as to solve

(1.15) conveniently? This is possible in the frame of the HAM, since in

theory the HAM provides us great freedom and large flexibility to choose

the auxiliary linear operator L. If successful, it would be rather efficient

and convenient to solve the high-order deformation equation (1.15). This is

an interesting but open question for the HAM community, which deserves

to be studied in details. Note that some interesting problems are suggested

in § 1.5.

1.3. Some advances of the HAM

Since 1992 when Liao [9] proposed the early HAM, the HAM has been

developing greatly in theory and applications, due to the contributions of

many researchers in dozens of countries. Unfortunately, it is impossible to

describe all of these advances in details in this brief review, and even in this

book. In fact, the HAM has been successfully applied to numerous, various

types of nonlinear problems in science, engineering and finance. So, we had

to focus on a rather small port of these advances here.

1.3.1. Generalized zeroth-order deformation equation

The starting point of the use of the HAM is to construct the so-called zeroth-

order deformation equation, which builds a connection (i.e. a continuous

mapping/deformation) between a given nonlinear problem and a relatively

much simpler linear ones. So, the zeroth-order deformation equation is a

base of the HAM.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 11

Given a nonlinear equation, we have great freedom and large flexibility

in the frame of the HAM to construct the so-called zeroth-order defor-

mation equation using the concept homotopy in topology. Especially, the

convergence-control parameter c0 plays an important role in the frame of the

HAM. So, it is natural to enhance the ability of the so-called “convergence

control” by means of introducing more such kind of auxiliary parameters.

Due to the above-mentioned freedom and flexibility of the HAM, there

are numerous approaches to do so. For example, we can construct such a

kind of zeroth-order deformation equation with K + 1 convergence-control

parameters:

(1 − q)L [ϕ(r, t; q) − u0(r, t)]

=

(K∑

n=0

cn qn+1

)H(r, t) N [ϕ(r, t; q)] − f(r, t) , (1.22)

where ϕ(r, t; q) is the solution, N is a nonlinear operator related to an

original problem N [u(r, t)] = f(r, t), q ∈ [0, 1] is the homotopy parameter,

u0 is an initial guess, L is an auxiliary linear operator,H(r, t) is an auxiliary

function which is nonzero almost everywhere, and

c = c0, c1, · · · , cK

is a vector of (K+1) non-zero convergence-control parameters, respectively.

Note that, when K = 0, it gives exactly the zeroth-order deformation

equation (1.10).

The corresponding high-order deformation equation reads

L[um(r, t)− χmum−1(r, t)] = H(r, t)

minm−1,K∑

n=0

cn Rm−1−n(r, t), (1.23)

where Rn(r, t) and χn are defined by the same formulas (1.16) and (1.17),

respectively. When K = 0, the above high-order deformation equation

(1.23) is exactly the same as (1.15). At themth-order of approximation, the

optimal convergence-control parameters are determined by the minimum of

the residual square of the original equation, i.e.

dEmdcn

= 0, 0 ≤ n ≤ minm− 1, K, (1.24)

where Em is defined by (1.19). For details, please refer to Chapter 4 of

Liao’s book [11]. When K → +∞, it is exactly the so-called “optimal

homotopy asymptotic method” [22]. So, the “optimal homotopy asymptotic

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

12 S.-J. Liao

method” [22] is also a special case of the HAM, as shown in § 3.2.2 and

§ 6.3 of Liao’s book [11].

In theory, the more the convergence-control parameters, the larger the

ability to control the convergence of the HAM series. However, it is

found [16] that much more CPU times is needed in practice when more

convergence-control parameters are used. In most cases, one optimal

convergence-control parameter is good enough to gain convergent results

by means of the HAM. Considering the computational efficiency, one up to

three convergence-control parameters are generally suggested in the frame

of the HAM. For details, please refer to § 2.3.3, § 2.3.4, § 4.6.1 and Chapter

3 of Liao’s book [16].

It should be emphasized once again that, in the frame of the homotopy in

topology, we have rather great freedom and large flexibility to construct the

so-called zeroth-order deformation equation. In theory, given a nonlinear

equation N [u(r, t)] = f(r, t), we can always properly choose an initial guess

u0(r, t) and an auxiliary linear operator L to construct such a zeroth-order

deformation equation in a rather general form

A [u0(r, t),L, ϕ(r, t; q), c; q] = 0 (1.25)

that it holds

ϕ(r, t; 0) = u0(r, t), when q = 0, (1.26)

and

ϕ(r, t; 1) = u(r, t), when q = 1, (1.27)

i.e., when q = 1 the zeroth-order deformation equation (1.25) is equivalent

to the original nonlinear equation N [u(r, t)] = f(r, t). Using the theorems

given in Chapter 4 of Liao’s book [11], it is easy to gain the corresponding

high-order deformation equations. Here,

c = c0, c1, · · · , cKis a vector of convergence-control parameters, whose optimal values are de-

termined by the minimum of residual square of the original equation. Note

that (1.25) is rather general: the zeroth-order deformation equations (1.10)

and (1.22), and even Eq. (1.2) for Lyapunov’s artificial small parameter

method, are only special cases of (1.25). Some commonly used zeroth-

order deformation equations are described in § 4.3 of Liao’s book [11] as

special cases of the generalized zeroth-order deformation equation (1.25).

In theory, there are an infinite number of different ways to construct a

zeroth-order deformation equation (1.25). Therefore, in the frame of the

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 13

HAM, we indeed have huge freedom and flexibility. Such kind of freedom

and flexibility comes from the homotopy, a basic concept in topology. In

theory, this kind of freedom and flexibility provides us great ability to solve

some interesting but challenging nonlinear problems (some of them are

suggested below in § 1.5 of this chapter), if we can clearly know how to use

them in a proper way with stimulated imagination!

In practice, it is suggested to firstly use the zeroth-order deformation

equation (1.10), since it works for most of nonlinear problems, as illustrated

by Liao [10, 11]. If unsuccessful, one can further attempt a little more

complicated zeroth-order deformation equations, such as (1.22). Finally, we

emphasize once again that, in theory, one has huge freedom to construct

a zeroth-order deformation equation (1.25) satisfying both of (1.26) and

(1.27), as long as one clearly knows how to use such kind of freedom.

1.3.2. Spectral HAM and complicated auxiliary operator

Although the HAM provides us great freedom to choose the auxiliary linear

operator L, it might be difficult to solve the linear high-order deformation

equation (1.15) or (1.23) exactly, if L is complicated. This is mainly because

most of linear differential equations have no closed-form solutions, i.e. their

solutions are mostly expressed by an infinite series. So, in order to exactly

solve high-order deformation equations in the frame of the HAM, we often

should choose a reasonable but simple enough auxiliary linear operator L.This, however, restricts the applications of the HAM.

This is the main reason why only a few simple auxiliary linear operators,

such as

Lu = u′, Lu = xu′ + u, Lu = u′ + u, Lu = u′′ + u

and so on, have been mostly used in the frame of the HAM, where the

prime denotes the differentiation with respect to x. These auxiliary linear

operators correspond to some fundamental functions such as polynomial,

exponential, trigonometric functions and their combination.

There are many special functions governed by linear differential equa-

tions. Although many solutions can expressed by these special functions,

they are hardly used in the frame of the HAM up to now, because the

corresponding high-order deformation equations often become more and

more difficult to solve. This is a pity, since in theory the HAM indeed

provides us freedom to use special functions to express solutions of many

nonlinear differential equations. Currently, Van Gorder [23] made an inter-

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

14 S.-J. Liao

esting attempt in this direction. In the frame of the HAM, Van Gorder [23]

expressed analytic approximations of the Fitzhugh–Nagumo equation by

means of error function, Gaussian function and so on. The key is that Van

Gorder [23] chose such an auxiliary linear operator

Lu = u′′ +

(2z2 − 1

z

)u′,

where the prime denotes the differentiation with respect to z, and especially

such a proper auxiliary function H(z) = z|z|, that the corresponding high-

order deformation equations can be solved easily. For details, please refer

to Van Gorder [23], Vajravelu and Van Gorder [24] and § 4.6 of this book.

This example illustrates once again that the HAM indeed provides us great

freedom, i.e. lots of possibilities. The key is how to use such kind of

freedom!

Generally speaking, solution of a complicated linear ODE/PDE should

be expressed in a series with an infinite number of terms. Mathematically,

such a series leads to the larger and larger difficulty to gain higher-order

analytic approximations of a nonlinear problem. Fortunately, from physical

viewpoint, it is often accurate enough to have analytic approximations with

many enough terms. Currently, using the Schmidt-Gram process, Zhao, Lin

and Liao [25] suggested an effective truncation technique in the frame of

the HAM, which can be used to greatly simplify the right-hand side of

the high-order deformation equations, such as (1.15) and (1.23), prior to

solving them. In this way, much CPU time can be saved, even without loss

of accuracy.

In 2010, Motsa et al. [26, 27] suggested the so-called “spectral homotopy

analysis method” (SHAM) using the Chebyshev pseudospectral method to

solve the linear high-order deformation equations and choosing the auxiliary

linear operator L in terms of the Chebyshev spectral collocation differentia-

tion matrix [28]. In theory, any a continuous function in a bounded interval

can be best approximated by Chebyshev polynomial. So, the SHAM pro-

vides us larger freedom to choose the auxiliary linear operator L and initial

guess in the frame of the HAM. It is valuable to expand the SHAM for

nonlinear partial differential equations. Besides, it is easy to employ the

optimal convergence-control parameter in the frame of the SHAM. Thus,

the SHAM has great potential to solve more complicated nonlinear prob-

lems, although further modifications in theory and more applications are

needed. For the details about the SHAM, please refer to [26, 27] and Chap-

ter 3 of this book.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 15

Chebyshev polynomial is just one of special functions. There are many

other special functions such as Hermite polynomial, Legendre polynomial,

Airy function, Bessel function, Riemann zeta function, hypergeometric

functions, error function, Gaussian function and so on. Since the HAM

provides us extremely large freedom to choose auxiliary linear operator Land initial guess, it should be possible to develop a “generalized spectral

HAM” which can use proper special functions for some nonlinear problems.

Especially, combined the SHAM [26, 27] with the above-mentioned trunca-

tion technique suggested by Zhao, Lin and Liao [25], it would be possible

to use, when necessary, more complicated auxiliary linear operators in the

frame of the HAM so that some difficult nonlinear problems can be solved.

1.3.3. Predictor HAM and multiple solutions

Many nonlinear boundary value problems have multiple solutions. In gen-

eral, it is difficult to gain these dual solutions by means of numerical tech-

niques, mainly because dual solutions are often strongly dependent upon

initial conditions but we do not know how to choose them exactly. Compar-

atively speaking, it is a little more convenient to use analytic approximation

methods to search for multiple solutions of nonlinear problems, since ana-

lytic methods admit unknown variables in initial guess.

For example, let us consider a second-order nonlinear differential equa-

tion of a two-point boundary value problem:

N [u(x)] = 0, u(0) = a, u(1) = b, (1.28)

where N is a 2nd-order nonlinear differential operator, a and b are known

constants, respectively. Assume that there exist multiple solutions u(x).

These multiple solutions must have something different. Without loss of

generality, assume that they have different first-order derivative u′(0) = σ,

where σ is unknown.

Obviously, different initial guess u0(x) might lead to multiple solutions.

Fortunately, the HAM provides us great freedom to choose initial guess

u0(x). As mentioned before, such kind of freedom is one cornerstone of the

HAM. So, in the frame of the HAM, it is convenient for us to choose such

an initial guess u0(x) that it satisfies not only the two boundary conditions

u(0) = a, u(1) = b but also the additional condition u′(0) = σ. In this

way, the initial guess u0(x) contains an unknown parameter σ, called by

Liao (see Chapter 8 of [11]) the multiple-solution-control parameter. Then,

the analytic approximations gained by the HAM contain at least two un-

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

16 S.-J. Liao

known auxiliary parameters: the convergence-control parameter c0 and the

multiple-solution-control parameter σ. As suggested by Liao (see Chapter 8

of [11]), the optimal values of c0 and σ can be determined by the minimum

of the residual square of governing equations. In this way, multiple solu-

tions of some nonlinear differential equations can be gained, as illustrated

by Liao (see Chapter 8 of [11]).

In the frame of the HAM, Abbasbandy and Shivanian [29, 30] developed

a differential but rather interesting approach to gain dual solutions, namely

the Predictor HAM (PHAM). For simplicity, let us use the same equation

(1.28) as an example to describe its basic ideas. First of all, an additional

condition such as u′(0) = σ is introduced with the unknown parameter

σ. Then, in the frame of the HAM, one solves the nonlinear differential

equation N [u(x)] = 0, but with the two boundary conditions u′(0) = σ

and u(1) = b. Then, u(0), the HAM approximation at x = 0, contains

at least two unknown parameters: one is the so-called convergence-control

parameter c0, the other is σ = u′(0), called the multiple-solution-control

parameter by Liao (see Chapter 8 of [11]) in the above-mentioned approach.

Substituting the expression of u(0) into the boundary condition u(0) = a

gives a nonlinear algebraic equation about c0 and σ. From the physical

viewpoint, σ = u′(0) has physical meanings, but the convergence-control

parameter c0 does not. If the order of approximation is high enough, one

can gain convergent, accurate enough multiple values of σ for properly

chosen values of c0 in a finite interval, as illustrated in [29, 30]. In this way,

one can find multiple solutions of a given nonlinear problem. For details,

please refer to Chapter 2 of this book.

In the frame of the HAM, some new branches of solutions for viscous

boundary-layer flows were found [31, 32], and the multiple equilibrium-

states of resonant waves in deep water [33] and in finite water depth [34]

were discovered for the first time, to the best of author’s knowledge. All

of these illustrate the potential, novelty and validity of the HAM to give

something new and different. This is a superiority of the HAM to numerical

methods and some other analytic approximation techniques. Certainly, it

is valuable to apply the HAM to discover some new solutions of other

nonlinear problems!

1.3.4. Convergence condition and HAM-based software

Theoretically speaking, the HAM indeed provides us great freedom to

choose initial guess, auxiliary linear operator, convergence-control parame-

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 17

ter, equation-type and solution-expression of high-order deformation equa-

tion, and so on. However, it is still not very clear how to use these freedom

in the frame of the HAM, mainly because little mathematical theorems

have been proved in an abstract way.

Some studies on the stability of auxiliary linear operator and

convergence-control parameter of the HAM are described in Chapter 4 of

this book. Some current works about convergence condition of the HAM

series are described in Chapter 5.

It should be especially emphasized that Park and Kim [35, 36] success-

fully applied the HAM to solve a few classic problems in finance, and gave

convergence conditions for their analytic approximations. It is rather inter-

esting that they even gave an error estimation for their analytic approxima-

tions in [36]. Currently, Park and Kim used the HAM to solve an abstract

linear problem with respect to bounded linear operators from a Banach

space to a Banach space, and rigorously proved that the homotopy solution

exists in the sense that a series of the problem converges in a Banach norm

sense if the linear operator satisfies some mild conditions. Their fantastic

works are very important, and might pioneer a new research direction and

style (i.e. abstract proof) in the frame of the HAM. Such kind of abstract

mathematical theorems in the frame of the HAM are more valuable and

useful, if nonlinear governing equations and especially the influence of the

convergence-control parameter on the convergence could be considered.

On the other side, the HAM has been successfully applied to numerous

nonlinear problems in various fields of science and engineering. These ap-

plications show the general validity and novelty of the HAM. Unfortunately,

it is impossible to mention all of them here in details. As examples among

these numerous applications, a HAM-based approach about boundary-layer

flows of nanofluid is given in Chapter 6 of this book. In addition, an appli-

cation of the HAM for time-fractional boundary-value problem is illustrated

in Chapter 7.

To simplify some applications of the HAM, two HAM-based software

were developed. The HAM-based Maple package NOPH (version 1.0.2)

for periodic oscillations and limit cycles of nonlinear dynamic systems is

described in Chapter 8 of this book with various applications. It is free

available online at

http://numericaltank.sjtu.edu.cn/NOPH.htm

with a simple user’s guide. Besides, the HAM-based Mathematica package

BVPh (version 2.0) for coupled nonlinear ordinary differential equations

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

18 S.-J. Liao

with boundary conditions at multiple points are given in Chapter 9 of this

book. It is free available online at

http://numericaltank.sjtu.edu.cn/BVPh.htm

with a simple user’s guide and some examples of application. Both of these

two HAM-based software are easy-to-use and user-friendly. They greatly

simplify some applications of the HAM, and are especially helpful for the

beginners of the HAM.

1.4. Relationships to other methods

In pure mathematics, the homotopy is a fundamental concept in topology

and differential geometry. The concept of homotopy can be traced back to

Jules Henri Poincare (1854–1912), a French mathematician. A homotopy

describes a kind of continuous variation (or deformation) in mathematics.

For example, a circle can be continuously deformed into a square or an

ellipse, the shape of a coffee cup can deform continuously into the shape

of a doughnut but cannot be distorted continuously into the shape of a

football. Essentially, a homotopy defines a connection between different

things in mathematics, which contain same characteristics in some aspects.

In pure mathematics, the homotopy is widely used to investigate existence

and uniqueness of solutions of some equations, and so on.

In applied mathematics, the concept of homotopy was used long ago to

develop some numerical techniques for nonlinear algebraic equations. The

so-called “differential arc length homotopy continuation method” were pro-

posed in 1970s by Keller [37, 38]. However, the global homotopy methods

can be traced as far back as the work of Lahaye [39] in 1934. To solve a non-

linear algebraic equation f(x) = 0 by means of the homotopy continuation

method, one first constructs such a homotopy

H(x, q) = q f(x) + (1− q) g(x), (1.29)

where q ∈ [0, 1] is the homotopy parameter, g(x) is a function for which a

zero is known or readily obtained. As discussed by Wayburn and Seader

[40], the choice of g(x) is arbitrary, but the two most widely used functions

are the Newton homotopy

H(x, q) = q f(x) + (1− q) [f(x)− f(x0)] ,

and the fixed-point homotopy

H(x, q) = q f(x) + (1− q) (x− x0) ,

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 19

where x0 is an arbitrary starting point. The locus of solutions defines the

homotopy path that is tracked with some continuation method. Conse-

quently, homotopy continuation methods consist not only of the homotopy

equation itself, but also the homotopy path tracking method, i.e. of some

continuation strategy.

Homotopy continuation methods are usually based upon differentiating

the homotopy equation (1.29) with respect to the arc length s, which gives

the equation

∂H

∂x

dx

ds+∂H

∂q

dq

ds= 0. (1.30)

Taking into account the arc-length relation(dx

ds

)2

+

(dq

ds

)2

= 1

and the initial condition H(x0, 0) = 0, we obtain an initial value prob-

lem. Then, path tracking based on the initial value problem is numerically

carried out with a predictor-corrector algorithm to gain a solution of the

original equation f(x) = 0. Some elegant theorems of convergence are

proved in the frame of the homotopy continuation method. For details of

the homotopy continuation method, please refer to [41–49].

Unlike the homotopy continuation method that is a global convergent

numerical method mainly for nonlinear algebraic equations, the HAM is

a kind of analytic approximation method mainly for nonlinear differential

equations. So, the HAM is essentially different from the homotopy con-

tinuation method, although both of them are based on the homotopy, the

basic concept of the topology. Note that the HAM uses much more com-

plicated homotopy equation (1.10) or (1.22) than (1.29) for the homotopy

continuation method. Furthermore, the HAM provides larger freedom to

choose the auxiliary linear operator L. Most importantly, the so-called

convergence-control parameter c0 is introduced for the first time, to the

best of our knowledge, in the homotopy equation (1.10) or (1.22) so that

the HAM provides us a convenient way to guarantee the convergence of

series series. Note that the homotopy equation (1.29) of the homotopy

continuation method does not contain such kind of convergence-control pa-

rameter at all. So, the convergence-control parameter c0 is indeed a novel.

In fact, it is the convergence-control parameter c0 which differs the HAM

from all other analytic approximation methods.

In addition, the HAM logically contains many other analytic approxima-

tion methods and thus is rather general. For example, it has been generally

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

20 S.-J. Liao

proved [10–13] that the Lyapunov’s artificial small parameter method [5],

the Adomian decomposition method [6–8], the δ-expansion method [18] are

only special cases of the HAM for some specially chosen auxiliary linear

operator L and convergence-control parameter c0. Furthermore, the so-

called “optimal homotopy asymptotic method” [22] developed in 2008 is

also a special case of the homotopy equation (1.22) when K → +∞, too,

as pointed out by Liao (see § 6.3 of Liao’s book [11]).

Especially, the so-called “homotopy perturbation method” (HPM) [19]

proposed by Jihuan He in 1998 (six years later after Liao [9] proposed the

early HAM in 1992) was only a special case of the HAM when c0 = −1, as

proved in [20], and thus it has “nothing new except its name” [20]. Some

results given by the HPM are divergent even in the whole interval except

the given initial/boundary conditions, and thus “it is very important to

investigate the convergence of approximation series, otherwise one might

get useless results”, as pointed out by Liang and Jeffrey [21]. For more

details, see § 6.2 of Liao’s book [11].

In addition, even the famous Euler transform in calculus can be derived

in the frame of the HAM (see Chapter 5 of Liao’s book [11]). This provides

us a theoretical cornerstone for the validity and generality of the HAM.

In summary, based on the concept of homotopy topology, the HAM

is a novel analytic approximation method for highly nonlinear problems,

with great freedom and flexibility to choose equation-type and solution ex-

pression of high-order approximation equations and also with a convenient

way to guarantee the convergence, so that it might overcome restrictions of

perturbation techniques and other non-perturbation methods.

1.5. Chance and challenge: some suggested problems

Any truly new methods should give something novel and/or different, or

solve some difficult problems that can not be solved with satisfaction by

other methods.

Unlike other analytic approximation methods, the HAM provides us

great freedom and flexibility to choose equation-type and solution expres-

sion of high-order approximation equations, and especially a simple way

to guarantee the convergence of solution series. Thus, the HAM provides

us a large possibility and chance to give something novel or different, and

to attack some difficult nonlinear problems. For example, some new so-

lutions [31, 32] of boundary-layer flows have been found by means of the

HAM, which had been neglected even by numerical techniques and had

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 21

been never reported. Some analytic approximations for the optimal ex-

ercise boundary of American put option were given, which are valid from

a couple of years (see [50, 51]) up to even 20 years (see Chapter 13 of

Liao’s book [11]) prior to expiry, and thus much better than the asymp-

totic/perturbation approximations that are often valid only for a couple of

days or weeks. Besides, the HAM has been successfully employed to solve

some complicated nonlinear PDEs: the multiple equilibrium-states of reso-

nant waves in deep water [33] and in finite water depth [34] were discovered

by means of the HAM for the first time, to the best of our knowledge, which

greatly deepen and enrich our understandings about resonant waves.

All of these successful applications show the originality, validity and

generality of the HAM for nonlinear problems, and encourage us to apply

the HAM to attack some famous, challenging nonlinear problems. Some of

these problems are suggested below for the HAM community, especially for

brave, enterprising, young researchers.

1.5.1. Periodic solutions of chaotic dynamic systems

It is well known that chaotic dynamic systems have the so-called “but-

terfly effect” [52, 53], say, the computer-generated numerical simulations

have sensitive dependence to initial conditions (SDIC). For example, the

nonlinear dynamic system of Lorenz equations [52]

x = σ (y − x) , (1.31)

y = r x− y − x z, (1.32)

z = x y − b z, (1.33)

has chaotic solution in case of r = 28, b = 8/3 and σ = 10 for most of given

initial conditions x0, y0, z0 of x, y, z at t = 0. However, for some special

initial conditions such as

x0 = −13.7636106821, y0 = −19.5787519424, z0 = 27;

x0 = −9.1667531454, y0 = −9.9743951128, z0 = 27;

x0 = −13.5683173175, y0 = −19.1345751139, z0 = 27,

the above dynamic system of Lorenz equation has unstable periodic solu-

tions, as reported by Viswanath [54].

A periodic solution u(t) with the period T has the property

u(t) = u(t+ n T )

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

22 S.-J. Liao

for arbitrary time t ≥ 0 and arbitrary integers n, even if t → +∞ and

n → ∞. This property cannot be checked strictly by means of numerical

approaches, since all numerical integration simulations are gained in a fi-

nite interval of time. Naturally, a periodic solution should be expressed

analytically by periodic base functions such as trigonometric functions. So,

theoretically speaking, it is inherently better to use analytic approximation

methods to search for periodic solutions of chaotic dynamic systems than

numerical ones.

In fact, as illustrated by Liao in Chapter 13 of his book [10], the HAM

can be employed to gain periodic solution of nonlinear dynamic systems.

Can we employ the HAM to gain the above-mentioned unstable periodic

solutions of Lorenz equation found by Viswanath [54]? More importantly,

it would be very interesting if the HAM could be employed to find some

new periodic solutions of Lorenz equation with physical parameters leading

to chaos! This is mainly because Lorenz equation is one of the most famous

ones in nonlinear dynamics and nonlinear science.

1.5.2. Periodic orbits of Newtonian three-body problem

Let us consider one of the most famous problem in mechanics and applied

mathematics: the Newtonian three-body problem, say, the motion of three

celestial bodies under their mutual gravitational attraction. Let x1, x2, x3denote the three orthogonal axes. The position vector of the ith body is

expressed by ri = (x1,i, x2,i, x3,i), where i = 1, 2, 3. Let T and L denote

the characteristic time and length scales, and mi the mass of the ith body,

respectively. Using Newtonian gravitation law, the motion of the three

bodies are governed by the corresponding non-dimensional equations

xk,i =3∑

j=1,j 6=i

ρj(xk,j − xk,i)

R3i,j

, k = 1, 2, 3, (1.34)

where

Ri,j =

[3∑

k=1

(xk,j − xk,i)2

]1/2(1.35)

and

ρi =mi

m1, i = 1, 2, 3 (1.36)

denotes the ratio of the mass.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 23

According to H. Poincare, orbits of three-body problem are unintegrable

in general. Although chaotic orbits of three-body problems widely exist,

three families of periodic orbits were found:

(1) the Lagrange–Euler family, dating back to the analytical solutions in

the 18th century (one recent orbit was given by Moore [55]);

(2) the Broucke–Hadjidemetriou–Henon family, dating back to the mid-

1970s [56–61];

(3) the Figure-8 family, discovered in 1993 by Moore [55] and extended to

the rotating cases [62–65].

Note that nearly all of these reported periodic orbits are planar. In 2013,

Suvakov and Dmitrasinovic [66] found that there exist four classes of planar

periodic orbits of three-body problem, with the above three families belong-

ing to one class. Besides, they reported three new classes of planar periodic

orbits and gave the corresponding initial conditions for each class. For the

details of their 15 planar periodic orbits, please refer to the gallery [67].

Suvakov and Dmitrasinovic [66] found these new classes of planar peri-

odic orbits by means of an iterative numerical integration approach without

using multiple precision. So, it is unknown whether or not the numerical

simulations depart the corresponding periodic orbits for rather large time,

i.e. t→ ∞. As mentioned before, it is better and more natural to express a

periodic solution u(t) with the period T in series of periodic base functions

(with the same period T ) so that u(t) = u(t + nT ) can hold for arbitrary

integer n and arbitrary time t even if t→ ∞. Thus, it is valuable to apply

the HAM to double check all of the reported periodic orbits in [66], and

more importantly, to find some completely new periodic orbits!

Note that nearly all of the periodic orbits of three-body problem re-

ported up to now are planar. Therefore, it is valuable and interesting if the

HAM can be applied to find some periodic orbits of Newtonian three-body

problems, which are not planar, i.e. three dimensional. Mathematically

speaking, we should determine such unknown initial positions r1, r2, r3,

unknown initial velocities r1, r2, r3 and unknown corresponding mass-ratios

ρ1, ρ2, ρ3 of three bodies in the frame of the HAM that Eqs. (1.34) have

periodic solution xk,i(t) = xk,i(t + nT ) for arbitrary time t and integer

n, where T is the unknown corresponding period to be determined, and

i, k = 1, 2, 3. This is a valuable, interesting but challenging problem for the

HAM community.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

24 S.-J. Liao

1.5.3. Viscous flow past a sphere

One of the most famous, classical problem in fluid mechanics is the steady-

state viscous flow past a sphere [68–75], governed by the Navier-Stokes

equation, i.e. a system of nonlinear partial differential equations. Consider

the steady-state viscous flow past a sphere in a uniform stream. How large

is the drag of the sphere due to the viscosity of fluid?

To study the steady-state viscous flow past a sphere, the spherical co-

ordinates ~r = (r, θ, φ) is often used. Since the problem has axial symmetry,

one can use the Stokes stream function ψ(r, θ) defined through the following

relations:

vr =1

r2 sin(θ)ψθ, vθ = − 1

r sin(θ)ψr, vφ = 0. (1.37)

The stream function ψ(r, θ) is governed by the dimensionless equation

D4ψ =R

r2

[∂(ψ,D2ψ)

∂(r, µ)+ 2D2ψLψ

], (1.38)

subject to the boundary conditions

ψ(1, µ) = 0, (1.38a)

∂ψ(r, µ)

∂r

∣∣∣∣r=1

= 0, (1.38b)

limr→∞

ψ(r, µ)

r2=

1

2(1 − µ2), (1.38c)

where R = aU∞/ν is the Reynolds number and

µ ≡ cos(θ), (1.39)

D2 ≡ ∂2

∂r2+

1− µ2

r2∂2

∂µ2, (1.40)

L ≡ µ

1− µ2

∂r+

1

r

∂µ. (1.41)

Here, a denotes the radius of the sphere and U∞ the uniform stream velocity

at infinity, respectively, according to the notation of Proudman and Pearson

[71]. As mentioned by Liao [74], the drag coefficient reads

CD =4

R

∫ 1

−1

(−p µ+

∂2ψ

∂r2

)∣∣∣∣r=1

dµ, (1.42)

where the pressure p is given by

p = −∫ 1

µ

1

(1 − µ2)

∂3ψ

∂r3

∣∣∣∣r=1

dµ. (1.43)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 25

Unfortunately, neither the linearization method [68–70] nor the pertur-

bation techniques [71, 72] can provide an analytic approximation of drag

coefficient CD valid for Rd > 3, where Rd = d U∞/ν = 2R for the diam-

eter d of the sphere. Especially, the 3rd-order multiple-scale perturbation

approximation of CD given by Chester and Breach [72] was valid even in

a smaller interval of Reynolds number than the 2nd-order multiple-scale

perturbation result of Proudman and Pearson [71]. This implies the inva-

lidity of perturbation methods for this famous problem. So, “the idea of

using creeping flow to expand into the high Reynolds number region has not

been successful”, as pointed out by White in his textbook [76]. Besides, the

method of renormalization group can not essentially modify these analytic

results [75], either.

In 2002, Liao [74] employed the HAM to solve the steady-state viscous

flow past a sphere and gained a analytic approximation of drag coefficient

CD, which agree well with experimental data in a considerably larger in-

terval Rd ≤ 30. However, the corresponding experiments indicate that the

steady-state viscous flow past a sphere exists until Rd ≈ 100. So, strictly

speaking, this HAM result given in [74] is not satisfactory.

Theoretically speaking, it is very interesting and valuable if one can give

an accurate enough analytic result of the drag coefficient CD valid for the

steady-state viscous flow past a sphere up to Rd ≈ 100, mainly because

it is one of the most famous, classical problems in fluid mechanics with a

history of more than 150 year!

Can we solve this famous, classical problem by means of the HAM?

1.5.4. Viscous flow past a cylinder

The steady-state viscous flow past an infinite cylinder is also one of the

most famous, classical problems in fluid mechanics with a long history. For

the steady-state viscous flow past an infinite cylinder, it is natural to use

cylindrical coordinates ~r = (r, θ, z). Since the problem is two dimensional,

it is convenient to use the Lagrangian stream function ψ(r, θ) defined by

Proudman and Pearson [71]:

ur =1

r

∂ψ

∂θ, uθ = −∂ψ

∂r, uz = 0. (1.44)

The stream function ψ(r, θ) is governed by

∇4rψ(r, θ) = −R

r

∂(ψ,∇2r)

∂(r, θ), (1.45)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

26 S.-J. Liao

subject to the boundary conditions

ψ(r = 1, θ) = 0, (1.45a)

∂ψ(r, θ)

∂r

∣∣∣∣r=1

= 0, (1.45b)

limr→∞

ψ(r, θ)

r= sin(θ), (1.45c)

where

∇2r ≡

∂2

∂r2+

1

r

∂r+

1

r2∂2

∂θ2, ∇4

r ≡ ∇2r∇2

r .

Here, R = aU∞/ν is the Reynolds number, a and U∞ denote the radius of

cylinder and the uniform stream velocity at infinity, respectively.

As reviewed in [75], neither the linearization method nor perturbation

technique can give good analytic approximation of the drag coefficient CDof a cylinder for R ≥ 3. In fact, even the method of renormalization group

cannot modify these results greatly [75]. So, it is still an open question.

Theoretically speaking, it is valuable to gain an accurate analytic expres-

sion of drag coefficient CD valid for large Reynolds number up to R ≈ 40,

beyond which the periodic Von Karman vortex occurs. This is mainly be-

cause it is one of the most famous, historical problem in fluid mechanics.

Can this famous, classical problem be solved by means of the HAM?

1.5.5. Nonlinear water waves

The HAM has been successfully applied to solve some nonlinear wave equa-

tions. Especially, in the frame of the HAM, the multiple equilibrium-states

of resonant waves in deep water [33] and in finite water depth [34] were

discovered for the first time, to the best of the author’s knowledge. Thus,

the HAM provides us a convenient tool to investigate some complicated

wave problems.

Strictly speaking, water waves are governed by Euler equation with two

nonlinear boundary conditions satisfied on an unknown free surface, which

however are rather difficult to solve in general. Based on the exact Euler

equation, some simplified wave models for shallow water waves, such as the

KdV equation [77], Boussinesq equation [78], Camassa–Holm (CH) equa-

tion [79], and so on, are derived by assuming the existence of some small

physical parameters in shallow water. Although these shallow water wave

equations are much simpler than the exact Euler equation, they can well ex-

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 27

plain many physical phenomena, such as soliton waves, wave propagations

and interactions in shallow water, wave breaking, and so on.

For example, the celebrated Camassa–Holm (CH) equation [79]

ut + 2ωux − uxxt + 3uux = 2uxuxx + uuxxx, (1.46)

subject to the boundary condition

u = 0, ux = 0, uxx = 0, as x→ ±∞, (1.47)

can model both phenomena of soliton interaction and wave breaking (see

[80]), where u(x, t) denotes the wave elevation, x, t are the temporal and

spatial variables, ω is a constant related to the critical shallow water wave

speed, the subscript denotes the partial differentiation, respectively. Mathe-

matically, the CH equation is integrable and bi-Hamiltonian, thus possesses

an infinite number of conservation laws in involution [79]. In addition, it is

associated with the geodesic flow on the infinite dimensional Hilbert mani-

fold of diffeomorphisms of line (see [80]). Thus, the CH equation (1.46) has

many intriguing physical and mathematical properties. As pointed out by

Fushssteiner [81], the CH equation (1.46) even “has the potential to become

the new master equation for shallow water wave theory”.

Especially, when ω = 0, the CH equation (1.46) has the peaked solitary

wave

u(x, t) = c exp(−|x− c t|),

which was found first by Camassa and Holm [79]. The first derivative of

the peaked solitary wave is discontinuous at the crest x = c t. Like the

CH equation, many shallow water equations admit peaked and/or cusped

solitary waves. These equations with peaked and/or cusped solitary waves

have been widely investigated mathematically, and thousands of related ar-

ticles have been published. However, to the best of the author’s knowledge,

peaked and cusped solitary waves have never been gained directly from

the exact Euler equation! This is very strange. Logically speaking, since

these simplified equations (like the CH equation) are good enough approx-

imations of the Euler equation in shallow water, the exact Euler equation

should also admit the peaked and/or cusped solitary waves as well.

Can we gain such kind of peaked and/or cusped solitary waves of the

exact wave equation by means of the HAM, if they indeed exist? Either

positive or negative answers to this question have important scientific mean-

ings. If such kind of peaked solutions of the exact wave equation indeed

exist, it can greatly enrich and deepen our understandings about peaked

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

28 S.-J. Liao

solitary waves. If the peaked solitary waves given by the exact wave equa-

tion exists mathematically but is impossible in physics, we had to check

the physical validity of the peaked solitary waves. So, this is an interesting

and valuable work, although with great challenge. For some attempts in

this direction, please refer to Liao [82], who proposed a generalized wave

model based on the symmetry and the fully nonlinear wave equations, which

admits not only the traditional waves with smooth crest but also peaked

solitary waves. It is found that the peaked solitary waves satisfy Kelvin’s

theorem everywhere. Besides, these peaked solitary waves include the fa-

mous peaked solitary waves of the Camassa–Holm equation. So, the gener-

alized wave model [82] is consistent with the traditional wave theories. It

is found [82] that the peaked solitary waves have some unusual character-

istics quite different from the traditional ones, although it is still an open

question whether or not they are reasonable in physics if the viscosity of

fluid and the surface tension are considered.

In addition, the so-called “rogue wave” [83, 84] is a hot topic of nonlinear

waves. Certainly, it is valuable to apply the HAM to do some investigations

in this field.

In summary, it is true that the problems suggested above are indeed dif-

ficult, but very valuable and interesting in theory. In fact, there are many

such kind of interesting but difficult problems in science, engineering and

finance. It should be emphasized that, unlike all other analytic approx-

imation methods, the HAM provides us great freedom and flexibility to

choose equation-type and solution expression of high-order approximation

equations, and besides a convenient way to guarantee the convergence of

solution series. As pointed out by Georg Cantor (1845–1918), “the essence

of mathematics lies entirely in its freedom”. Hopefully, the great freedom

and flexibility of the HAM might create some novel ideas and inspire some

brave, enterprising, young researchers with stimulated imagination to at-

tack them with satisfactory, much better results.

Chance always stays with challenges!

Acknowledgment

This work is partly supported by National Natural Science Foundation of

China (Approval No. 11272209), the Foundation for Shanghai Leading

Scientists, and State Key Laboratory of Ocean Engineering (Approval No.

GKZD010056).

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 29

References

[1] A.H. Nayfeh, Perturbation Methods. John Wiley & Sons, New York, 1973.[2] M. Van Dyke, Perturbation Methods in Fluid Mechanics. Parabolic, Stan-

ford, 1975.[3] E.J. Hinch, Perturbation Methods. Cambridge University Press, Cambridge,

1991.[4] J.A. Murdock, Perturbations: Theory and Methods. John Wiley & Sons,

New York, 1991.[5] A.M. Lyapunov, General Problem on Stability of Motion (English transla-

tion). Taylor & Francis, London, 1992 (the original one was published in1892 in Russian).

[6] G. Adomian, Nonlinear stochastic differential equations, J. Math. Anal.

Appl. 55: 441–452 (1976).[7] G. Adomian, A review of the decomposition method and some recent results

for nonlinear equations, Comput. Math. Appl. 21: 101–127 (1991).[8] G. Adomian, Solving Frontier Problems of Physics: The Decomposition

Method. Kluwer Academic Publishers, Boston, 1994.[9] S.J. Liao, On the proposed homotopy analysis techniques for nonlinear prob-

lems and its application. Ph.D. dissertation, Shanghai Jiao Tong University,1992.

[10] S.J. Liao, Beyond Perturbation: Introduction to the Homotopy Analysis

Method. Chapman & Hall/CRC Press, Boca Raton, 2003.[11] S.J. Liao, Homotopy Analysis Method in Nonlinear Differential Equations.

Springer & Higher Education Press, Heidelberg, 2012.[12] S.J. Liao, An explicit, totally analytic approximation of Blasius’ viscous flow

problems, Int. J. Non-Linear Mech. 34: 759–778 (1999).[13] S.J. Liao, On the homotopy analysis method for nonlinear problems, Appl.

Math. Comput. 147: 499–513 (2004).[14] S.J. Liao and Y. Tan, A general approach to obtain series solutions of non-

linear differential equations, Stud. Appl. Math. 119: 297–354 (2007).[15] S.J. Liao, Notes on the homotopy analysis method: some definitions and

theorems, Commun. Nonlinear Sci. Numer. Simulat. 14: 983–997 (2009).[16] S.J. Liao, An optimal homotopy-analysis approach for strongly nonlinear

differential equations, Commun. Nonlinear Sci. Numer. Simulat. 15: 2315–2332 (2010).

[17] S.J. Liao, On the relationship between the homotopy analysis method andEuler transform, Commun. Nonlinear Sci. Numer. Simulat. 15: 1421–1431,2010.

[18] A.V. Karmishin, A.T. Zhukov and V.G. Kolosov, Methods of Dynamics Cal-

culation and Testing for Thin-walled Structures (in Russian). Mashinostroye-nie, Moscow, 1990.

[19] J.H. He, An approximate solution technique depending upon an artificialparameter, Commun. Nonlinear Sci. Numer. Simulat. 3: 92–97 (1998).

[20] M. Sajid and T. Hayat, Comparison of HAM and HPM methods for non-linear heat conduction and convection equations. Nonlin. Anal. B. 9: 2296–

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

30 S.-J. Liao

2301 (2008).[21] S.X. Liang and D.J. Jeffrey, Comparison of homotopy analysis method and

homotopy perturbation method through an evaluation equation, Commun.

Nonlinear Sci. Numer. Simulat. 14: 4057–4064 (2009).[22] V. Marinca and N. Herisanu: Application of optimal homotopy asymptotic

method for solving nonlinear equations arising in heat transfer, Int. Com-

mun. Heat Mass. 35: 710–715 (2008).[23] R.A. Van Gorder: Gaussian waves in the Fitzhugh-Nagumo equation demon-

strate one role of the auxiliary function H(x) in the homotopy analysismethod, Commun. Nonlinear Sci. Numer. Simulat. 17: 1233–1240 (2012).

[24] K. Vajravelu and R.A. Van Gorder, Nonlinear Flow Phenomena and Homo-

topy Analysis: Fluid Flow and Heat Transfer. Springer, Heidelberg, 2012.[25] Y.L. Zhao, Z.L. Lin and S.J. Liao, An iterative HAM approach for non-

linear boundary value problems in a semi-infinite domain, Comput. Phys.

Commun. 184: 2136–2144 (2013).[26] S.S. Motsa, P. Sibanda and S. Shateyi, A new spectral homotopy analysis

method for solving a nonlinear second order BVP, Commun. Nonlinear Sci.

Numer. Simulat. 15: 2293–2302 (2010).[27] S.S. Motsa, P. Sibanda, F.G. Auad and S. Shateyi, A new spectral homotopy

analysis method for the MHD Jeffery-Hamel problem, Computer & Fluids.39: 1219–1225 (2010).

[28] W.S. Don and A. Solomonoff, Accuracy and speed in computing the Cheby-shev collocation derivative. SIAM J. Sci. Comput. 16: 1253–1268 (1995).

[29] S. Abbasbandy and E. Shivanian, Prediction of multiplicity of solutions ofnonlinear boundary value problems: Novel application of homotopy analysismethod, Commun. Nonlinear Sci. Numer. Simulat. 15: 3830–3846 (2010).

[30] S. Abbasbandy and E. Shivanian, Predictor homotopy analysis method andits application to some nonlinear problems, Commun. Nonlinear Sci. Numer.

Simulat. 16: 2456–2468 (2011).[31] S.J. Liao, A new branch of solutions of boundary-layer flows over an imper-

meable stretched plate, Int. J. Heat Mass Tran. 48: 2529–2539 (2005).[32] S.J. Liao and E. Magyari, Exponentially decaying boundary layers as limit-

ing cases of families of algebraically decaying ones, Z. angew. Math. Phys.

57, 777–792 (2006).[33] S.J. Liao, On the homotopy multiple-variable method and its applications in

the interactions of nonlinear gravity waves, Commun. Nonlinear Sci. Numer.

Simulat. 16: 1274 – 1303 (2011).[34] D.L. Xu, Z.L. Lin, S.J. Liao and M. Stiassnie, On the steady-state fully

resonant progressive waves in water of finite depth, J. Fluid Mech. 710:379–418 (2012).

[35] S.H. Park and J.H. Kim, Homotopy analysis method for option pricing understochastic volatility, Appl. Math. Lett. 24: 1740–1744 (2011).

[36] S.H. Park and J.H. Kim, A semi-analytic pricing formula for lookback op-tions under a general stochastic volatility model, Statistics and Probability

Letters, 83: 2537 – 2543 (2013).[37] H.B. Keller, Numerical solution of bifurcation and nonlinear eigenvalue prob-

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 31

lems. In P. Rabinowitz, Application of Bifurcation Theory (p. 359), AcademicPress, New York, 1977.

[38] H.B. Keller, Global homotopies and Newton methods. In C. de Boor, et al.,Recent Advances in Numerical Analysis (p. 73), Academic Press, New York,1978.

[39] E. Lahaye, Une methode de resolution d’une categorie dequations transcen-dantes. Comptes Rendus de l’Academie des Sciences Paris, 198: 1840–1842(1934).

[40] T.L. Wayburn and J.D. Seader, Homotopy continuation methods forcomputer-aided process design, Computers in Chemical Engineering. 11: 7(1987).

[41] B.C. Eaves, Homotopies for computation of fixed points, Math. Program-

ming. 3: 1–22 (1972).[42] S.N. Chow, J. Mallet-Paret and J.A. Yorke, Finding zeros of maps: Homo-

topy methods that are constructive with probability one, Math. Comp. 32:887–899 (1978).

[43] L.T. Watson, Solving the nonlinear complementarity problem by a homotopymethod, SIAM J. Control Optim. 17: 36–46 (1979).

[44] J.C. Alexander, T.Y. Li and J.A. Yorke, Piecewise smooth homotopies,in Homotopy Methods and Global Convergence, pp. 1–14, B.C. Eaves, F.J.Gould, H.O. Peitgen and M.J. Todd, eds., Plenum, New York, 1983.

[45] L.T. Watson, M. Sosonkina, R.C. Melville, A.P. Morgan and H.F. Walker,Algorithm 777: HOMPACK90: A suite of Fortran 90 codes for globallyconvergent homotopy algorithms, ACM Trans. Math. Software. 23: 514–549(1997).

[46] T.Y. Li, Numerical solution of multivariate polynomial systems by homotopycontinuation methods, Acta Numerica. 6: 399–436 (1997).

[47] T.Y. Li, Solving polynomial systems by the homotopy continuation method,Handbook of Numerical Analysis, Vol. XI, pp. 209–304, edited by P. G. Cia-rlet, North-Holland, Amsterdam, 2003.

[48] T. Lee, C. Tsai and T.Y. Li, HOM4PS-2.0: A software package for solv-ing polynomial systems by the polyhedral homotopy continuation method,Computing. 83: 109–133 (2008).

[49] T.Y. Li and C.H. Tsai, HOM4PS-2.0para: Parallelization of HOM4PS-2.0for solving polynomial systems, Parallel Computing. 35: 226–238 (2009).

[50] S.P. Zhu, An exact and explicit solution for the valuation of American putoptions, Quant. Financ. 6: 229–242 (2006).

[51] J. Cheng, S.P. Zhu and S.J. Liao, An explicit series approximation to theoptimal exercise boundary of American put options, Commun. Nonlinear

Sci. Numer. Simulat. 15: 1148–1158 (2010).[52] E.N. Lorenz, Deterministic non-periodic flows, J. Atmos. Sci. 20: 130–141

(1963).[53] E.N. Lorenz, The Essence of Chaos. University of Washington Press, Seattle,

1995.[54] D. Viswanath, The fractal property of the Lorenz attractor, Physica D. 190:

115–128 (2004).

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

32 S.-J. Liao

[55] C. Moore, Braids in classical dynamics, Phys. Rev. Lett. 70: 3675–3679(1993).

[56] R. Broucke and D. Boggs, Periodic orbits in the Planar General Three-BodyProblem, Celest. Mech. 11: 13–38 (1975).

[57] J.D. Hadjidemetriou and T. Christides, Families of periodic orbits in theplanar three-body problem, Celest. Mech. 12: 175–187 (1975).

[58] J.D. Hadjidemetriou, The stability of periodic orbits in the three-body prob-lem, Celest. Mech. 12: 255–276 (1975).

[59] R. Broucke, On relative periodic solutions of the planar general three-bodyproblem, Celest. Mech. 12: 439–462 (1975).

[60] M. Henon, A family of periodic solutions of the planar three-body problem,and their stability, Celest. Mech. 13: 267–285 (1976).

[61] M. Henon, Stability of interplay motions, Celest. Mech. 15: 243–261 (1977).[62] M. Nauenberg, Periodic orbits for three particles with finite angular momen-

tum, Phys. Lett. A. 292: 93–99 (2001).[63] A. Chenciner, J. Fejoz and R. Montgomery, Rotating Eights: I. the three Γi

families, Nonlinearity. 18: 1407 (2005).[64] R. Broucke, A. Elipe and A. Riaguas, On the figure-8 periodic solutions in

the three-body problem, Chaos, Solitons Fractals. 30: 513–520 (2006).[65] M. Nauenberg, Continuity and stability of families of figure eight orbits with

finite angular momentum, Celest. Mech. 97: 1–15 (2007).[66] M. Suvakov and V. Dmitrasinovic, Three classes of newtonian three-body

planar periodic orbits, Phys. Rev. Lett. 110: 114301 (2013).[67] http://suki.ipb.ac.rs/3body/.[68] G.G. Stokes, On the effect of the internal friction of fluids on the motion of

pendulums, Trans. Cambridge Philos. Soc. 9: 8 (1851).[69] C.W. Oseen, Uber die Stokessche Formel und die verwandte Aufgabe in der

Hydrodynamik, Arkiv. Mat. Astron. Phsik. 6: 29 (1910).[70] S. Goldstein, The steady flow of viscous fluid past a fixed spherical obstacle

at samll Reynolds numbers, Proc. R. Soc. London, Ser. A. 123: 225 (1929).[71] I. Proudman and J.R.A. Pearson, Expansions at small Reynolds numbers

for the flow past a sphere and a circular cylinder, J. Fluid Mech. 2: 237(1957).

[72] W. Chester and D.R. Breach, On the flow past a sphere at low Reynoldsnumber, J. Fluid Mech. 37: 751–760 (1969).

[73] E.R. Lindgren, The motion of a sphere in an incompressible viscous fluid atReynolds numbers considerably less than one, Phys. Scr. 60: 97 (1999).

[74] S.J. Liao, An analytic approximation of the drag coefficient for the viscousflow past a sphere, Int. J. Non-Linear Mech. 37: 1–18 (2002).

[75] J. Veysey and N. Goldenfeld, Simple viscous flow: From boundary layers tothe renormalization group, Rev. Mod. Phys. 79: 883 (2007).

[76] F.M. White, Viscous Fluid Flow. McGraw-Hill, New York, 1991.[77] D.J. Korteweg and G. de Vries, On the change of form of long waves ad-

vancing in a rectangular canal, and on a new type of long stationary waves,Phil. Mag. 39: 422–443 (1895)

[78] J. Boussinesq, Theorie des ondes et des remous qui se propagent le long d’un

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 1

Chance and Challenge: A Brief Review of Homotopy Analysis Method 33

canal rectangulaire horizontal, en communiquant au liquide contenu dans cecanal des vitesses sensiblement pareilles de la surface au fond, Journal deMath’ematiques Pures et Appliquees. 17: 55–108 (1872).

[79] R. Camassa and D.D. Holm, An integrable shallow water equation withpeaked solitons, Phys. Rev. Lett. 71: 1661–1664 (1993 ).

[80] A. Constantin, Existence of permanent and breaking waves for a shallowwater equation: a geometric approach, Ann. Inst. Fourier, Grenoble. 50:321–362 (2000).

[81] B. Fuchssteiner, Some tricks from the symmetry-toolbox for nonlinear equa-tions: generalizations of the Camassa-Holm equation, Physica D. 95: 296–343 (1996).

[82] S.J. Liao, Do peaked solitary water waves indeed exist? ArXiv:1204.3354,2012.

[83] I. Didenkulova and E. Pelinovsky, Rogue waves in nonlinear hyperbolic sys-tems (shallow-water framework), Nonlinearity. 24: R1–R18 (2011).

[84] A. Calini and C. M. Schober, Dynamical criteria for rogue waves in nonlinearSchrodinger models, Nonlinearity. 25: R99–R116 (2012).

May 2, 2013 14:6 BC: 8831 - Probability and Statistical Theory PST˙ws

This page intentionally left blankThis page intentionally left blank

May 2, 2013 14:6 BC: 8831 - Probability and Statistical Theory PST˙ws

This page intentionally left blankThis page intentionally left blank

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

Chapter 9

HAM-Based Mathematica Package BVPh 2.0

for Nonlinear Boundary Value Problems

Yinlong Zhao∗ and Shijun Liao†

School of Naval Architecture, Ocean and Civil EngineeringShanghai Jiao Tong University, Shanghai 200240, China

[email protected], †[email protected]

We issue the new version BVPh 2.0 of the Mathematica package BVPh, afree software based on the homotopy analysis method (HAM) for non-linear boundary-value and eigenvalue problems. The aim of the pack-age BVPh is to develop a kind of analytic tool for as many nonlinearboundary value problems (BVPs) as possible such that multiple so-lutions of highly nonlinear BVPs can be conveniently found out, andthat the infinite interval and singularities of governing equations and/orboundary conditions at multi-points can be easily resolved. Unlike itsprevious versions, BVPh 2.0 works for systems of coupled nonlinear or-dinary differential equations. It is user-friendly and free available on-line (http://numericaltank.sjtu.edu.cn/BVPh.htm). Different fromnumerical packages (such as BVP4c), it is based on the idea “comput-ing numerically with functions instead of numbers”. Especially, un-like other packages, the convergence of results given by the BVPh 2.0

is guaranteed by means of the so-called convergence-control parameterin the frame of the homotopy analysis method. In this chapter, webriefly describe how to install and use the BVPh 2.0 with a simple user’sguide. Five typical examples (governed by up to four coupled ODEs)are used to illustrate the validity of the BVPh 2.0, and the correspond-ing input data of these examples for the BVPh 2.0 are free available on-line (http://numericaltank.sjtu.edu.cn/BVPh.htm). The BVPh 2.0

indeed provides us with an easy-to-use tool to efficiently solve varioustypes of coupled linear/nonlinear ordinary differential equations.

361

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

362 Y.-L. Zhao and S.-J. Liao

Contents

9.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

9.2. Installation of the BVPh 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366

9.3. Illustrative example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

9.4. Brief mathematical formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372

9.4.1. Boundary value problems in a finite interval . . . . . . . . . . . . . . . 372

9.4.2. Eigenvalue-like problems in a finite interval . . . . . . . . . . . . . . . . 375

9.4.3. Problems in a semi-infinite interval . . . . . . . . . . . . . . . . . . . . 375

9.5. Approximation and iteration of solutions . . . . . . . . . . . . . . . . . . . . . 376

9.5.1. Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377

9.5.2. Trigonometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 377

9.5.3. Hybrid-base functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

9.6. A simple user guide of the BVPh 2.0 . . . . . . . . . . . . . . . . . . . . . . . 380

9.6.1. Key modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380

9.6.2. Control parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381

9.6.3. Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383

9.6.4. Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

9.6.5. Global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

9.7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385

9.7.1. Example 1: A system of ODEs in finite interval . . . . . . . . . . . . . 385

9.7.2. Example 2: A system of ODEs with algebraic property at infinity . . . 388

9.7.3. Example 3: A system of ODEs with an unknown parameter . . . . . . 393

9.7.4. Example 4: A system of ODEs in different intervals . . . . . . . . . . . 397

9.7.5. Example 5: Iterative solutions of the Gelfand equation . . . . . . . . . 401

9.8. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

Appendix A. Codes for examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

A.1. Sample codes to run the illustrative example . . . . . . . . . . . . . . . . . . . 406

A.2. Input data of BVPh 2.0 for the illustrative example . . . . . . . . . . . . . . . 406

A.3. Input data of BVPh 2.0 for Example 1 . . . . . . . . . . . . . . . . . . . . . . 408

A.4. Input data of BVPh 2.0 for Example 2 . . . . . . . . . . . . . . . . . . . . . . 409

A.5. Input data of BVPh 2.0 for Example 3 . . . . . . . . . . . . . . . . . . . . . . 411

A.6. Input data of BVPh 2.0 for Example 4 . . . . . . . . . . . . . . . . . . . . . . 412

A.7. Input data of BVPh 2.0 for Example 5 . . . . . . . . . . . . . . . . . . . . . . 414

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416

9.1. Introduction

Ordinary differential equations (ODEs) are widely used in mathematics,

science and engineering. The so-called initial value problems (IVPs) specify

some restrictions only at a single point. This kind of problems is often

solved by means of numerical approach based on integration, such as the

Runge–Kutta method. However, in many cases, a solution is described in

a more complicated way. The so-called boundary value problems (BVPs)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 363

may specify some restrictions at more than one point. Unlike IVPs, BVPs

might have multiple solutions, or may satisfy some restrictions at infinity.

Hence, generally speaking, BVPs are more difficult to solve than IVPs.

Thanks to the development of mathematical software such as Maple,

Mathematica and MATLAB, some packages are developed to solve nonlin-

ear BVPs, such as the BVP4c, the Chebfun, the NOPH, and the BVPh. The

famous MATLAB package BVP4c [1, 2] implements a collocation method,

instead of a shooting method. The collocation polynomial provides a C1-

continuous solution that is fourth-order accurate uniformly in [a, b]. Mesh

selection and error control are based on the residual of the continuous so-

lution. However, it is not easy for the BVP4c to resolve the singularity in

governing equations and/or boundary conditions. Besides, the BVP4c re-

gards an infinite interval as a kind of singularity and replaces it by a finite

one: this leads to the additional inaccuracy and uncertainty of solutions.

The Chebfun [3, 4] is a collection of algorithms on the “chebfun” ob-

jects written in MATLAB. It aims to combine the feel of symbolics with

the speed of numerics. The basis of the Chebfun is Chebyshev expan-

sions, fast Fouries transform, baryentric interpolation and so on. The idea

“computing numerically with functions instead of numbers” [4] behind the

Chebfun makes it have the potential to handle unbounded domains and

singularities in an easy way. Although linear differential equations can be

solved in a single step by Chebfun without iteration, only a few exam-

ples for nonlinear differential equations are given [3, 4]. Actually, Chebfun

uses Newton’s iteration to solve nonlinear problems. However, it is well

known that the convergence of Newton’s iteration is strongly dependent

upon initial guesses and thus is not guaranteed. Besides, Chebfun searches

for multiple solutions of nonlinear differential equations by using different

guess approximations. However, it is not very clear how to choose these

different guess approximations.

Based on the homotopy in topology, the so-called homotopy analysis

method (HAM) was proposed by Liao [8–14] to gain analytic approxima-

tions of highly nonlinear problems. The HAM has some advantages over

other traditional analytic approximation methods. First, unlike perturba-

tion techniques, the HAM is independent of small/large physical param-

eters, and thus is valid in more general cases. Besides, different from all

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

364 Y.-L. Zhao and S.-J. Liao

other analytic techniques, the HAM provides us a convenient way to guar-

antee the convergence of series solution. Furthermore, the HAM provides

extremely large freedom to choose initial guess, equation-type and solution

expression of linear sub-problems. It is found [13, 14] that lots of nonlinear

BVPs in science, engineering and finance can be solved conveniently by

means of the HAM, no matter whether the interval is finite or not.

Since the early HAM was proposed by Liao [9] in 1992, the HAM has

been developed greatly in theory and widely applied to numerous nonlinear

problems in lots of fields, with hundreds of publications. So, it is neces-

sary to develop a HAM-based software to simplify the applications of the

HAM. Based on the HAM, a Mathematica package BVPh 1.0— for nonlin-

ear boundary value/eigenvalue problems with singularity and/or multipoint

boundary conditions was issued by Liao [14] in May 2012, which is free avail-

able online (http://numericaltank.sjtu.edu.cn/BVPh.htm). Its aim is

to develop a kind of analytic tool for as many nonlinear BVPs as possible

such that multiple solutions of highly nonlinear BVPs can be conveniently

found out, and that the infinite interval and singularities of governing equa-

tions and/or boundary conditions at multi-points can be easily resolved. As

illustrated by Liao [14], the BVPh 1.0 is valid for lots of nonlinear BVPs

and thus is a useful tool in practice.

Currently, based on the HAM, the Maple package NOPH [5] for periodi-

cally oscillating systems of center and limit cycle types is developed, which

delivers accurate approximations of frequency, mean of motion and am-

plitude of oscillation automatically. The NOPH combines Wu’s elimination

method and the homotopy analysis method (HAM). It is free available on-

line (http://numericaltank.sjtu.edu.cn/NOPH.htm). Different from the

BVPh 1.0, the NOPH is for periodic oscillations. This illustrates the general

validity of the HAM for nonlinear problems once again.

It is a pity that the BVPh 1.0 can only deal with BVPs of single ordi-

nary differential equation (ODE), say, it can not solve systems of coupled

ODEs. In this chapter we issue the new version BVPh 2.0, which works for

many types of systems of coupled nonlinear ordinary differential equations

(ODEs) in finite and/or semi-infinite intervals. Besides, new algorithms are

used in some modules of BVPh 2.0. As a result, BVPh 2.0 is much faster

than BVPh 1.0 in most cases. In this chapter, we illustrate how to use

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 365

BVPh 2.0 to solve different kinds of systems of coupled nonlinear ODEs,

including a system of two coupled ODEs in finite interval, a system of two

coupled ODEs in semi-infinite interval, a system of two coupled ODEs with

algebraic property at infinity, a system of three coupled ODEs with an un-

known parameter to be determined, and a system of four coupled ODEs in

different intervals.

This chapter is organized as follows. In § 9.2, we show how to install

the package BVPh 2.0. In § 9.3, we take an example to illustrate how to

use BVPh 2.0 in detail. In § 9.4, we briefly describe some mathematical

formulas based on which the BVPh 2.0 is developed. In § 9.5, the iterative

technique is illustrated for two typical kinds of base-functions in finite in-

tervals. A simple user guide of BVPh 2.0 is given in § 9.6. Some typical

examples are given in § 9.7 to illustrate the potential of the BVPh 2.0 and

to show its validity. In § 9.8, some discussions are given. The reader is

suggested to read § 9.3 at first for an illustrative example. If one is puzzled

with some parameters, one is encouraged to search for them in § 9.6, and

read the detailed description there.

In order to check the validity and correctness of the BVPh 2.0, we choose

all of our typical examples from published articles, which were solved ei-

ther analytically (by the HAM) or numerically before. As illustrated in

this chapter, the package BVPh 2.0 always gives results, which agree well

with the published ones. The validity of the BVPh 2.0 is checked for each

example in the following way:

(1) the squared residual error usually decreases to as low as 10−10, and

decreases at least 6 orders of magnitude;

(2) the same physical quantities of interest are gained as the published

ones;

(3) analytic solutions gained by BVPh 2.0 agree well with the published

ones.

Note that the package BVPh 2.0 is developed with Mathematica 7.0. As

some new features of Mathematica 7.0 are used, we strongly recommend

you to use the BVPh 2.0 in Mathematica 7.0 or higher version, since it

might not work for some lower version of Mathematics.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

366 Y.-L. Zhao and S.-J. Liao

9.2. Installation of the BVPh 2.0

The BVPh is a free/open-source software written in Mathematica for bound-

ary value problems (BVPs). Its newest version BVPh 2.0 is available on-

line (http://numericaltank.sjtu.edu.cn/BVPh.htm). The input data

for this chapter’s examples can also be found there. Since the commands of

Mathematica are designed to be the same on different operating systems,

the package written in Mathematica on Windows can be used in Mathe-

matica on other operating systems.

The source file of the package BVPh 2.0 is BVPh2_0.m. The easiest

way to load the package BVPh 2.0 to solve your problem is to put the

file BVPh2_0.m and the input data for the problem, e.g., Example.m, in

the same directory, then open a new notebook file and saved it as, e.g.,

runExample.nb, in the same directory and run the following codes.

(* Filename: runExample.nb *)

ClearAll["Global‘*"];

SetDirectory[ToFileName[Extract["FileName" /.

NotebookInformation[EvaluationNotebook[]], 1,

FrontEnd‘FileName]]];

<<BVPh2_0.m;

<<Example.m;

Note that the listings without an end-of-line semicolon is wrapped to fit

the page width of this chapter. However, if you break the long command

intentionally in Mathematica, it will not work as you expected. The above

commands first clear all global variables, then set the current working direc-

tory to “the current directory”. Here “the current directory” is where you

put the source file BVPh2_0.m, the input data Example.m and the notebook

file runExample.nb. The last two lines read in the package BVPh2_0.m and

Example.m in the notebbook runExample.nb.

If you are familiar with Mathematica’s file and directory operations,

you can put the file BVPh2_0.m and the input data of the problem in dif-

ferent directories, then specifies the path where to get them. It is worth

emphasizing that the pathname separator is “\\” under Windows, and “/”

elsewhere. The sample codes to get the file BVPh2_0.m and the input data

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 367

Example.m in the notebook file runExample.nb are as follows on Windows.

(* Filename: runExample.nb *)

ClearAll["Global‘*"];

<<"E:\\Package\\BVPh2_0.m";

<<"E:\\Project\\Example\\Example.m";

Here we assume the file BVPh2_0.m in the directory E:\Package and the

input data Example.m in a different directory E:\Project\Example. The

above sample codes may look like the following on Unix

(* Filename: runExample.nb *)

ClearAll["Global‘*"];

<< "/home/user/Package/BVPh2_0.m";

<< "/home/user/Example/Example.m";

Here we assume BVPh2_0.m in the directory /home/user/Package/ and the

input data Example.m in a different directory /home/user/Example.

From now on, we will assume that the package BVPh 2.0 has been

successfully loaded so that the modules in the package are available. In the

next section, we will use an illustrative example to show how to write the

input data and how to get the approximations by BVPh 2.0.

9.3. Illustrative example

Consider a system of ODEs [6]

f ′′′ − (f ′)2 + ff ′′ + 2λg + β[2ff ′f ′′ − f2f ′′′] = 0, (9.1)

g′′ − f ′g + fg′ − 2λf ′ + β[2ff ′g′ − f2g′′] = 0, (9.2)

subject to

f ′(0) = 1, f(0) = 0, g(0) = 0, (9.3)

f ′(∞) = 0, g(∞) = 0, (9.4)

where λ is rotation parameter, β is viscoelastic parameter, and the prime

indicates the differentiation with respect to η. This system models two-

dimensional flow of an upper convected Maxwell fluid in a rotating frame.

Sajid [6] has solved it by the HAM.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

368 Y.-L. Zhao and S.-J. Liao

To solve this problem by BVPh 2.0, we have to input the differential

equations, boundary conditions, initial guesses and convergence-control pa-

rameters. The differential equations (9.1) and (9.2) can be coded as follows

TypeEQ = 1;

NumEQ = 2;

f[1,z_,f_,g_,Lambda_]:=

D[f,z,3]-D[f,z]^2+f*D[f,z,2]+2*la*g+

beta*(2*f*D[f, z]*D[f,z,2]-f^2*D[f,z,3]);

f[2,z_,f_,g_,Lambda_]:=

D[g,z,2]-D[f,z]*g+f*D[g,z]-2*la*D[f,z]+

beta*(2*f*D[f, z]*D[g, z]-f^2*D[g,z, 2]);

Here TypeEQ controls the type of governing equations: TypeEQ=1 cor-

responds to a system of ODEs without an unknown to be determined,

TypeEQ=2 corresponds to a system of ODEs with an unknown, Lambda, to

be determined. Since all the parameters in the problem will be given, we

set TypeEQ to 1. Note that we use the delayed assignment SetDelayed(:=)

in Mathematica to define these ODEs to avoid the evaluation when the

assignment is made.

The boundary conditions (9.3) and (9.4) are defined in a semi-infinite

interval, from 0 to +∞. They are coded as

NumBC = 5;

BC[1,z_,f_,g_]:=(D[f, z]-1)/.z->0;

BC[2,z_,f_,g_]:=f/.z->0;

BC[3,z_,f_,g_]:=g/.z->0;

BC[4,z_,f_,g_]:=D[f,z]/.z->infinity;

BC[5,z_,f_,g_]:=g/.z->infinity;

Here NumBC is the number of boundary conditions of the problem. For

this problem, we have 5 boundary conditions, so NumBC is set to 5. The

symbol infinity is introduced in our package to denote ∞. When an

expression contains infinity, the limit of the expression is computed as

z approaches ∞. The delayed assignment (:=) is also used to avoid the

evaluation when the assignment is made — the same reason as defining the

differential equations.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 369

For a multi-layer problem, the differential equations in the system are

not necessarily in the same interval (see Example 4 in § 9.7). Hence, we

have to give each equation its solution interval. To measure the accuracy of

the approximate solutions, we have to compute the squared residual error

over the corresponding solution interval. In practice, when the differential

equation is defined in a semi-infinite interval, we simply truncate the infinite

interval to a finite interval to compute the squared residual error, or it will

take a lot of computation time. For this problem, the solution interval for

each equation and the integral interval for the squared residual error are

defined as

zL[1] = 0;

zR[1] = infinity;

zL[2] = 0;

zR[2] = infinity;

zRintegral[1] = 10;

zRintegral[2] = 10;

Here zL[k] (or zR[k]) is the left (or right) endpoint of the solution inter-

val for the kth equation f[k,z,f,g,Lambda]. And zLintegral[k] (or

zRintegral[k]) is the left (or right) endpoint of the integral interval to

compute the squared residual error for the kth equation. If the value of

zL[k] (or zR[k]) is a finite number, zLintegral[k] (or zRintegral[k])

is set to the same value automatically. However, if any of them contains the

symbol infinity, we have to set the corresponding endpoint of the integral

interval to a finite value. That is why we write explicitly zRintegral[1]=10

and zRintegral[2]=10. For this problem, the squared residual is inte-

grated over the range [0, 10] for both equations.

The auxiliary linear operators for this problem are chosen as L1 =∂3

∂η3 − ∂∂η , L2 = ∂2

∂η2 − 1, which are coded as

L[1,u_] := D[u,z,3]-D[u,z];

L[2,u_] := D[u,z,2]-u;

Here L[k,u] is the auxiliary linear operator corresponding to the kth equa-

tion. Note that i) η is the independent variable in the differential equations

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

370 Y.-L. Zhao and S.-J. Liao

(9.1) and (9.2), while z is the universal independent variable in the package

BVPh 2.0; ii) the delayed assignment SetDelayed(:=) is used to define the

operator; iii) u is a formal parameter.

For this problem, the initial guesses are f0 = 1 − e−z and g0 = ze−z.

They are coded as

U[1,0] = 1-Exp[-z];

U[2,0] = alpha*z*Exp[-z];

Here alpha is an introduced convergence-control parameter that will be

determined later. U[k,0] is the initial guess of the kth equation. Note that

U[k,0] and u[k,0] are usually the same in the package BVPh 2.0.

We want to solve this problem when the physical parameters β = 1/5

and λ = 1/10. These two parameters are coded as

beta = 1/5;

la = 1/10;

So far, we have defined all the input of this problem properly, except

the convergence-control parameter c0[k] and alpha. Usually, the optimal

values of the convergence-control parameters are obtained by minimizing

the averaged squared residual error. For this problem, we get the approxi-

mate optimal values of c0[1], c0[2] and alpha by minimizing the squared

residual error of the 3rd-order approximation as

GetOptiVar[3, , c0[1],c0[2],alpha];

The first parameter of GetOptiVar denotes which order approximation is

used. Here 3 means the 3rd-order approximation is used. The second

parameter denotes a list of constraints used in the optimization. When

the second parameter of GetOptiVar is an empty list, it means the aver-

aged squared residual is minimized without any constraint. Here we add

no constraints to minimize the averaged squared residual error. The third

parameter is a list of the variables to be optimized. Here we want to opti-

mize c0[1], c0[2] and alpha. After some computation, it gives the opti-

mized convergence-control parameters c0[1]=-1.26906, c0[2]=-1.19418

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 371

and alpha=-0.0657063.

Now we can use

BVPh[1,10]

to get the 10th-order approximation. If we are not satisfied with the accu-

racy of the 10th-order approximation, we can use BVPh[11,20], instead of

BVPh[1,20], to get 20th-order approximation or higher order approxima-

tion.

The kth-order approximation of the ith differential equation is stored

in U[i,k]. We can use

Plot[U[1,20], U[2,20], z,0,10,

AxesLabel->"\[Eta]", "",

PlotStyle->Thin, Red,Dashed, Blue]

to plot the 20th-order approximate solution, which is shown in Fig. 9.1.

The accuracy of the kth-order approximation is measured by the aver-

aged squared residual. We can use

ListLogPlot[Table[2*i,ErrTotal[2*i],i,1,10],

Joined->True,Mesh->All,

PlotRange->2,20,10^(-15),10^(-5),

AxesLabel->"m", "error"];

to plot the curve of the total error versus the order of approximation, which

is shown in Fig. 9.2. Note that ErrTotal[k] stores the total error of the

system when the kth-order approximation is used, while Err[k] is a list

that stores the error for each ODE in the system when the kth-order ap-

proximation is used.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

372 Y.-L. Zhao and S.-J. Liao

2 4 6 8 10Η

0.2

0.4

0.6

0.8

Fig. 9.1. The curve of f(z) (solid) and g(z) (dashed) for the illustrative example whenβ = 1/5, λ = 1/10.

5 10 15 20m10-15

10-13

10-11

10-9

10-7

10-5error

Fig. 9.2. Total error vs. order of approximation for the illustrative example whenβ = 1/5, λ = 1/10.

9.4. Brief mathematical formulas

The BVPh 2.0 is based on the HAM. It is an extension of BVPh 1.0 to

systems of ODEs. Here the mathematical formulas are briefly described.

9.4.1. Boundary value problems in a finite interval

Consider a system of NumEQ ordinary differential equations (ODEs),

Fi[z, u1, u2, · · · ] = 0, z ∈ [zLi, zRi], 1 6 i 6 NumEQ, (9.5)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 373

subject to the NumBC linear boundary conditions

Bk[z, u1, u2, · · · ] = γk, 1 6 k 6 NumBC, (9.6)

where Fi is a nonlinear differential operator, Bk is a linear differential op-

erator, z is the independent variable, ui(z) is a smooth function, NumEQ is

a positive integer, γk, zLi and zRi are constants, respectively. The bound-

ary conditions may be defined at multipoints including the two endpoints.

Assume that at least one solution exists, and that all solutions are smooth.

Let q ∈ [0, 1] denote an embedding parameter, ui,0(z) an initial guess of

the solution ui(z), respectively. In the frame of the HAM, we construct such

a continuous deformation φi(z; q) that, as q increases from 0 to 1, φi(z; q)

varies continuously from the initial guess ui,0(z) to the true solution ui(z)

of (9.5) and (9.6). Such kind of continuous deformations are governed by

the so-called zeroth-order deformation equations

(1− q)Li[φi(z; q)− ui,0(z)] = qc0,iHi(z)Fi[φ1(z; q), φ2(z; q), · · · ],z ∈ [zLi, zRi], q ∈ [0, 1], 1 6 i 6 NumEQ (9.7)

where Li is an auxiliary linear operator, c0,i is the so-called convergence-

control parameter, Hi(z) is an auxiliary function, corresponding to the ith

governing equation in (9.5), respectively.

Note that the HAM provides us extremely large freedom to choose the

auxiliary linear operator Li, the convergence-control parameter c0,i and

the auxiliary function Hi(z), 1 6 i 6 NumEQ. Assume that all of them are

properly chosen so that the homotopy-Maclaurin series

φi(z; q) = ui,0(z) +

+∞∑

k=1

ui,k(x)qk (9.8)

absolutely converges at q = 1, where

ui,m = Dm[φ(z; q)] =1

m!

∂mφ(z; q)

∂qm

∣∣∣∣q=0

. (9.9)

Here, Dm is called the mth-order homotopy-derivative operator [8]. Then,

we have the so-called homotopy-series solution

ui(z) = ui,0 +

+∞∑

m=1

ui,m(z), (9.10)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

374 Y.-L. Zhao and S.-J. Liao

where ui,m is governed by the so-called mth-order deformation equation

Li[ui,m(z)− χmui,m−1(z)] = c0,iHi(z)δi,m−1(z), z ∈ [zLi, zRi], (9.11)

subject to the NumBC homogeneous linear boundary conditions

Bk[z, u1, u2, · · · ] = 0, 1 6 k 6 NumBC, (9.12)

where

χm =

0, m ≤ 1,

1, m > 1,(9.13)

and

δi,m−1(z) = Dm−1Fi[φ1(z; q), φ2(z; q), · · · ]

= Dm−1

Fi[m−1∑

i=0

u1,i(z)qi,

m−1∑

i=0

u2,i(x)qi, · · ·

](9.14)

can be easily obtained by means of the theorems proved in Ref. 8.

The mth-order approximation of ui(z) is given by

ui(x) ≈ Ui,m(x) =

m∑

k=0

ui,k(z). (9.15)

To measure the accuracy of the mth-order approximations Ui,m, 1 6 i 6

NumEQ, the averaged squared residual error for the system (9.5) is defined

as

Em =

NumEQ∑

i=1

∫ zRintegral[i]

zLintegral[i] |Fi[U1,m, U2,m, · · · ]|2 dzzRintegral[i]− zLintegral[i]

. (9.16)

Here zLintegral[i] and zRintegral[i] are two endpoints of the integral

interval over which the squared residual of the ith governing equation is

integrated. Theoretically speaking, the smaller Em, the more accurate

the mth-order approximation Ui,m(z). Given the initial guess ui,0(z), the

auxiliary linear operator Li and the auxiliary function Hi(z), the squared

residual error Em is dependent on the convergence-control parameters c0,i,

i = 1, 2, · · · , NumEQ. Hence, the optimal values of c0,i can be determined by

the minimum of Em at some proper order m.

Note that i) for boundary value problems without an unknown to be

determined, we should set the control parameter TypeEQ = 1 for the BVPh

2.0; ii) the intervals [zLi, zRi] are not necessarily the same, so the package

can solve multi-layer problems without any modification.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 375

9.4.2. Eigenvalue-like problems in a finite interval

Consider a system of NumEQ ordinary differential equations (ODEs)

Fi[z, u1, u2, · · · , λ] = 0, z ∈ [zLi, zRi], 1 6 i 6 NumEQ, (9.17)

subject to the NumBC linear boundary conditions,

Bk[z, u1, u2, · · · ] = γk, 1 6 k 6 NumBC. (9.18)

Note that there is an unknown parameter λ in the system (9.17), and

the boundary conditions (9.18) include an additional boundary condition

determining the unknown λ. This additional boundary condition is the

zeroth boundary condition in BVPh 1.0. However, it is treated the same

as the other boundary conditions in BVPh 2.0, that is, any one of the

boundary conditions in (9.18) can be the additional boundary condition

provided that NumEQ− 1 is the order of the system (9.17).

All related formulas are the same as those given in § 9.4.1, except that

a deformation Λ(q) is also constructed such that Λ(q) varies continuously

from the initial guess λ0 to λ as q increases from 0 to 1.

Note that, when the BVPh 2.0 is used to solve eigenvalue-like problems

in a finite interval, we should set TypeEQ=2.

9.4.3. Problems in a semi-infinite interval

When the right endpoint zRi of the solution interval in (9.5) is +∞, the

governing equation is defined in a semi-infinite interval [zLi,+∞]. The

BVPh can solve this kind of problem without truncating the domain. This

feature is quite different from BVP4c, which regards a semi-infinite interval

as a kind of singularity and replaces it by a finite one.

All related formulas are the same as those given in § 9.4.1, except that

the finite intervals z ∈ [zLi, zRi] are replaced by the semi-infinite ones

z ∈ [zLi,∞]. However, completely different initial guesses ui,0(z) and aux-

iliary linear operators Li are used for this kind of problems, because their

solutions are expressed by completely different base functions.

Note that i) when the BVPh 2.0 is used to solve problems in a semi-

infinite interval, the symbol infinity is used to denote ∞ in input data; ii)

the boundary conditions at infinity are considered as a limiting process;

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

376 Y.-L. Zhao and S.-J. Liao

iii) to get the error of the approximations, we have to provide finite intervals

over which the squared residuals are integrated, as the numerical integration

method is used in BVPh 2.0; iv) the integral interval for squared residual

error can be set through zLintegral[i] and zRintegral[i]. For example,

zLintegral[i]=0 and zRintegral[i]=10 means the squared residual of

the ith governing equation is integrated over [0, 10].

9.5. Approximation and iteration of solutions

Although the high-order deformation equations (9.11) are always linear,

they are still not easy to solve in general, because the right-hand side term

δi,m−1 may be rather complicated. To solve this problem, we can approxi-

mate δi,m−1 in the form

δi,m−1 ≈Nt∑

k=0

bkek(z)

where ek denotes the base-function, Nt denotes the number of truncated

terms, the coefficient bk is uniquely determined by δi,m−1(z) and the base-

functions ek(z).

To further accelerate the rate of convergence, we can employ the itera-

tion approach by using the Mth-order approximation as a new initial guess

u∗i,0(z), i.e.,

ui,0(z) +

M∑

m=1

ui,m(z) → u∗i,0(z).

The above expression provides us the so-called Mth-order iteration for-

mula. In this way, the convergence of the homotopy-series can be greatly

accelerated.

The iteration approach of the BVPh 2.0 is currently possible only when

the base functions are of polynomials, trigonometric functions and hybrid-

base functions. We consider here the approximation of a smooth function

f(z) in these three different kinds of base functions. The approximation of

a function in a semi-infinite interval is proposed in Ref. 20 in the frame of

HAM.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 377

9.5.1. Polynomials

It is well known that a smooth function f(z) in the finite interval z ∈ [−1, 1]

can be well approximated by the Chebyshev polynomials

f(x) ≈ a02

+

Nt∑

k=1

akTk(z), (9.19)

where Tk(z) is the kth Chebyshev polynomial of the first kind, Nt denotes

the number of Chebyshev polynomials, and

ak =2

Nt + 1

Nt+1∑

i=1

f(xi)Tk(xi),

=2

Nt + 1

Nt+1∑

i=1

f

[cos

π(i − 1

2 )

Nt + 1

]cos

πk(i − 1

2 )

Nt + 1

.

When Chebyshev polynomial is used to approximate the boundary

value/eigenvalue problems in a finite interval z ∈ [a, b] by means of the

BVPh 2.0, we should set TypeL = 1, ApproxQ = 1.

9.5.2. Trigonometric functions

It is well known that the Fourier series

a02

++∞∑

n=1

(an cos

nπz

a+ bn sin

nπz

a

)

of a continuous function f(z) in a finite interval z ∈ (−a, a) converges to

f(z) in the interval z ∈ (−a, a), where

an =1

a

∫ a

−a

f(t) cosnπt

adt, bn =

1

a

∫ a

−a

f(t) sinnπt

adt.

For a continuous function f(z) in [0, a], we can define f(z) = f(−z) in

z ∈ [−a, 0) and its Fourier series reads

f(z) =a02

+

+∞∑

n=1

an cosnπz

a. (9.20)

Alternatively, we can define f(z) = −f(−z) in z ∈ [−a, 0) and its Fourier

series reads

f(z) ∼+∞∑

n=1

bn sinnπz

a. (9.21)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

378 Y.-L. Zhao and S.-J. Liao

Note that in (9.21), we write ”∼” instead of ”=”, because it holds only if

f(0) = f(a) = 0 is assumed.

In practice, we have the following approximations

f(z) ≈ a02

+

Nt∑

n=1

an cosnπz

a(9.22)

or

f(z) ≈Nt∑

n=1

bn sinnπz

a, (9.23)

where Nt denotes the number of truncated terms.

When the above-mentioned trigonometric functions are used to solve

boundary value/eigenvalue problems in a finite interval z ∈ [0, a] by means

of the BVPh 2.0, we should set TypeL = 2, ApproxQ = 1 and HYBRID = 0

with TypeBase = 1 for the odd expression (9.23) and TypeBase = 2 for

the even expression (9.22), respectively.

9.5.3. Hybrid-base functions

Note that the first-order derivative of the even Fourier series (9.20) equals

to zero at the two endpoints z = 0 and z = a, but the original function

f(z) may have arbitrary values of f ′(0) and f ′(a). So, in case of f ′(0) 6= 0

and/or f ′(a) 6= 0, one had to use many terms of the even Fourier series

(9.20) so as to obtain an accurate approximation near the two endpoints.

To overcome this disadvantage, we first express f(z) by such a combination

f(z) ≈ Y (z) + w(z), (9.24)

where

Y (z) =

(f ′(0)z − f ′(0) + f ′(a)

2az2)cos

πz

a(9.25)

and then approximate w(z) = f(z)− Y (z) by the even Fourier series

w(z) ≈ a02

+

Nt∑

n=1

an cosnπz

a(9.26)

with the Fourier coefficient

an =2

a

∫ a

0

[f(t)− Y (t)] cosnπt

adt.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 379

Here Nt is the number of truncated terms. Note that Y (z) in (9.25) satisfies

Y ′(0) = f ′(0), Y ′(a) = f ′(a)

so that w′(0) = w′(a) = 0. Therefore, we often need a few terms of the

even Fourier series to accurately approximate w(z). Note also that both the

trigonometric and polynomial functions are used in (9.24) to approximate

f(z). It is found that, by means of such kind of approximations based on

hybrid-base functions, one often needs much less terms to approximate a

given smooth function f(z) in [0, a] than the traditional Fourier series.

Alternatively, for a continuous function f(z) in [0, a], we can use

Y (z) = f(0) +f(a)− f(0)

az (9.27)

or

Y (z) =f(0) + f(a)

2+f(0)− f(a)

2cos

πz

a, (9.28)

and approximate w(z) by the odd Fourier series

w(z) ≈Nt∑

n=1

bn sinnπz

a, (9.29)

where

bn =2

a

∫ a

0

[f(t)− Y (t)] sinnπt

adt.

Note that Y (z) in (9.27) and (9.28) satisfies

Y (0) = f(0), Y (a) = f(a)

so that w(0) = w(a) = 0.

It is suggested to use the hybrid-base approximation (9.24) with (9.25)

for an even function f(z), and (9.24) with (9.27) or (9.28) for an odd func-

tion f(z), respectively. If f(z) is neither an odd nor even function, both of

them work.

When the above-mentioned hybrid-base approximation is used, we have

even larger freedom to choose the initial guess u0(z). For example, for a

2nd-order boundary value/eigenvalue problem in a finite interval z ∈ [0, a],

we may choose such an initial guess in the form

u0(z) = B0 +B1 cosκπz

a+B2 sin

κπz

a(9.30)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

380 Y.-L. Zhao and S.-J. Liao

or

u0(z) = (B0 +B1z +B2z2) cos

κπz

a, (9.31)

where B0, B1 and B2 are determined by linear boundary conditions, κ is a

positive integer.

When the above-mentioned trigonometric functions are used to solve

boundary value/eigenvalue problems in a finite interval z ∈ [0, a] by means

of the BVPh 2.0, we should set TypeL = 2, ApproxQ = 1 and HYBRID = 1

with TypeBase = 1 for the odd expression (9.29) and TypeBase = 2 for

the even expression (9.26), respectively.

9.6. A simple user guide of the BVPh 2.0

In this section, we will take a glance at the Mathematica package BVPh 2.0.

9.6.1. Key modules

BVPh The module BVPh[k_,m_] gives the kth to mth-order homotopy

approximations of a system of ordinary differential equations (ODEs)

subject to some boundary conditions. The systemmay have an unknown

parameter (when TypeEQ = 2) or may not have an unknown parameter

(when TypeEQ = 1). It is the basic module. For example, BVPh[1,10]

gives the 1st-order to 10th-order homotopy-approximations. Thereafter,

BVPh[11,15] further gives the 11th-order to 15th-order homotopy-

approximations. For problems with an unknown parameter, the initial

guess of the unknown parameter is determined by an algebraic equation.

Thus, if there are more than one initial guesses of the unknown param-

eter, it is required to choose one among them by inputting an integer,

such as 1 or 2, corresponding to the 1st or the 2nd initial guess of the

unknown parameter, respectively.

iter The module iter[k_,m_,r_] provides us homotopy approxima-

tions of the kth to mth iteration by means of the rth-order iteration for-

mula. It calls the basic module BVPh. For example, iter[1,10,3] gives

homotopy-approximations of the 1st to 10th iteration by the 3rd-order

iteration formula. Furthermore, iter[11,20,3] gives the homotopy-

approximations of the 11th to 20th iterations. The iteration stops when

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 381

the averaged squared residual error of the system is less than a critical

value ErrReq, whose default is 10−20.

GetErr The module GetErr[k_] gives the averaged squared residual er-

ror of the governing equation at the kth-order homotopy-approximation

gained by the module BVPh. Note that, errer[i,k] provides the

residual of the ith governing equation at the kth-order homotopy-

approximation gained by BVPh, and ErrTotal[k] gives the total av-

eraged squared residual error of the system at the kth-order homotopy-

aprroximation gained by BVPh.

hp The module hp[f_,m_,n_] gives the [m,n] homotopy-pade approx-

imation of a list of the homotopy-approximations f, where f[[i+1]]

denotes the ith-order homotopy-approximation of the same governing

equation.

GetBC The module GetBC[i_,k_] gives the ith boundary condition of

the kth-order deformation equation.

9.6.2. Control parameters

TypeEQ A control parameter for the type of governing equations:

TypeEQ = 1 corresponding to a nonlinear problem without an unknown

parameter, TypeEQ = 2 corresponds to a nonlinear problem with an

unknown parameter (called eigenvalue problem or eigenvalue-like prob-

lem), respectively.

TypeL A control parameter for the type of auxiliary linear operator:

TypeL = 1 corresponds to polynomial approximation, and TypeL = 2

corresponds to a trigonometric approximation or a hybrid-base approx-

imation, respectively.

ApproxQ A control parameter for approximation of solutions. When

ApproxQ = 1, the right-hand side term of all higher-order deformation

equations are approximated by Chebyshev polynomials (9.19), trigono-

metric functions in § 9.5.2, or by the hybrid-base functions in § 9.5.3.

When ApproxQ = 0, there is no such kind of approximation. When

TypeL = 2, ApproxQ = 1 is valid only for problems in a finite interval

z ∈ [0, a], where a > 0 is a constant.

HYBRID A control parameter for the hybrid-base functions. When

HYBRID = 1, hybrid-base functions are employed in approximation.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

382 Y.-L. Zhao and S.-J. Liao

When HYBRID = 0, trigonometric functions without polynomials are

employed in approximation. This parameter is usually used in conjunc-

tion with TypeBase, and is valid only when TypeL = 2 and ApproxQ = 1

for problems in a finite interval z ∈ [0, a].

TypeBase A control parameter for the type of Fourier series approxi-

mation: TypeBase = 1 corresponds to the odd Fourier approximation

(9.23) or (9.29), TypeBase = 2 corresponds to the even Fourier approx-

imation (9.22) or (9.26), respectively. This parameter is usually used

in conjunction with HYBRID, and is valid only when TypeL = 2 and

ApproxQ = 1 for problems in a finite interval z ∈ [0, a].

Ntruncated A control parameter to determine the number of truncated

terms used to approximate the right-hand side of higher-order deforma-

tion equations. The larger Ntruncated, the better the approximations,

but the more CPU time. It is valid only when ApproxQ = 1. The default

is 10.

NtermMax A positive integer used in the module truncated, which ig-

nores all polynomial terms whose order is higher than NtermMax. The

default is 90.

ErrReq A critical value of the averaged squared residual error of govern-

ing equations to stop the computation. The default is 10−20.

NgetErr A positive integer used in the module BVPh. The averaged

squared residual error of governing equations is calculated when the

order of approximation is divisible by NgetErr. The default is 2.

Nintegral Number of discrete points with equal space, which are used

to numerically calculate the integral of a function. It is used in the

module int. The default is 50.

ComplexQ A control parameter for complex variables. ComplexQ = 1

corresponds to the existence of complex variables in governing equa-

tions and/or boundary conditions. ComplexQ = 0 corresponds to the

nonexistence of such kind of complex variables. The default is 0.

FLOAT A control parameter for floating-point computation. When

FLOAT = 1, floating-point numbers are employed in computation. When

FLOAT = 0, rational numbers are employed in computation. The default

is 1.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 383

9.6.3. Input

NumEQ The number of governing equations.

f[i ,z ,u ,· · · ,lambda ] The ith governing equation with or without

an unknown parameter, corresponding to Fi[z, u, · · · ] or Fi[z, u, · · · , λ]in either a finite interval z ∈ [a, b] or a semi-infinite interval z ∈ [b,+∞),

where a and b are bounded constants. Note that the formal parameter

lambda denotes the unknown parameter λ to be determined, or the

eigenvalue λ for eigenvalue problems, but has no meaning at all for

problems without an unknown parameter λ, or non-eigenvalue problems.

NumBC The number of boundary conditions.

BC[k ,z ,u ,· · · ] The kth boundary condition corresponding to

Bk[z, u, · · · ], where 1 ≤ k ≤ NumBC. Note that the symbol infinity

denotes ∞ in boundary conditions.

U[i,0] The initial guess Ui,0(z), i.e., ui,0(z).

c0[i] The convergence-control parameter c0,i, corresponding to the ith

governing equation.

H[i ,z ] The auxiliary function corresponding to the ith governing

equation. The default is H[i_,z_]:=1.

L[i ,f ] The auxiliary linear operator corresponding to the ith govern-

ing equation.

zL[i] The left endpoint of the interval of the solution corresponding to

the ith governing equation. Note that intervals of the solutions are not

necessarily the same, especially for multi-layer flow problem.

zR[i] The right endpoint of the interval of the solution corresponding

to the ith governing equation.

zLintegral[i] The left endpoint of the integral interval to compute the

averaged squared residual error of the ith governing equation. When the

left endpoint of the solution interval for the ith governing equation is a

finite number, zLintegral[i] is automatically set to zL[i]. Otherwise,

the user has to specify the value of zLintegral[i].

zRintegral[i] The right endpoint of the integral interval to compute

the averaged squared residual error of the ith governing equation. When

the right endpoint of the solution interval for the ith governing equa-

tion is a finite number, zRintegral[i] is automatically set to zR[i].

Otherwise, the user has to specify the value of zRintegral[i].

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

384 Y.-L. Zhao and S.-J. Liao

9.6.4. Output

U[i,k] The kth-order homotopy-approximation of the solution to the

ith governing equation given by the basic module BVPh.

V[i,k] The kth-iteration homotopy-approximation of the solution to the

ith governing equation given by the iteration module iter.

Lambda[k] The kth-order homotopy-approximation of the eigenvalue λ

or the unknown parameter λ given by the basic module BVPh.

LAMBDA[k] The kth-iteration homotopy-approximation of the eigenvalue

λ or the unknown parameter λ given by the iteration module iter.

error[i,k] The residual of the ith governing equation given by the kth-

order homotopy-approximation (obtained by the basic module BVPh).

Err[k] A list of the averaged squared residual error of each governing

equation given by the kth-order homotopy-approximation (obtained by

the basic module BVPh).

ErrTotal[k] The total of the averaged squared residual error for each

governing equation given by the kth-order homotopy-approximation

(obtained by the basic module BVPh).

ERR[k] A list of the averaged squared residual error of each governing

equation given by the kth-iteration homotopy-approximation (obtained

by the iteration module iter).

ERRTotal[k] The total of the averaged squared residual error for each

governing equation given by the kth-iteration homotopy-approximation

(obtained by the iteration module iter).

9.6.5. Global variables

All control parameters and output variables mentioned above are global.

Besides these, the following variables and parameters are also global.

z The independent variable z.

u[i,k] The solution to the kth-order deformation equation of the ith

governing equation.

lambda[k] A constant variable, corresponding to λk.

delta[i,k] A function dependent upon z, corresponding to the right-

hand side term δi,k(z) in the high-order deformation equation.

L[i,w] The ith auxiliary linear operator Li applied to w.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 385

Linv[i,f] The inverse operator of Li, corresponding to L−1i , applied to

f .

sNum A positive integer to determine which initial guess λ0 is chosen

when there are multiple solutions of λ0.

9.7. Examples

More examples are given in this section to show the usage the package

BVPh 2.0.

9.7.1. Example 1: A system of ODEs in finite interval

Consider a system of coupled ODEs [7]

(1 +K)f ′′′′ −ReMf ′′ + 2Reff ′′′ −Kg′′ = 0, (9.32)(1 +

K

2

)g′′ −ReK[2g − f ′′] +Re[2fg′ − f ′g] = 0, (9.33)

subject to

f(0) = 0, f(1) = 0, f ′(1) = 1, f ′′(0) = 0, (9.34)

g(1) = 0, g(0) = 0, (9.35)

where K is the ratio of viscosities, Re is the Reynolds number and M is

the Hartman number. Hayat [7] has solved this problem by the HAM.

Here we solve this problem by BVPh 2.0. Since there are two ODEs

in system (9.32)–(9.33) without an unknown to be determined, we have

NumEQ = 2 and TypeEQ=1. The system is input as

TypeEQ = 1;

NumEQ = 2;

f[1,z_,f_,g_,Lambda_]:=(1+K)*D[f,z,4]

-Rey*M*D[f,z,2]+2*Rey*f*D[f,z,3]-K*D[g,z,2];

f[2,z_,f_,g_,Lambda_]:=(1+K/2)*D[g,z,2]

-Rey*K*(2*g-D[f,z,2])+Rey*(2*f*D[g,z]-D[f,z]*g);

The six boundary conditions are defined as

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

386 Y.-L. Zhao and S.-J. Liao

NumBC = 6;

BC[1,z_,f_,g_]:=f/.z->0;

BC[2,z_,f_,g_]:=f/.z->1;

BC[3,z_,f_,g_]:=(D[f, z]-1)/.z->1;

BC[4,z_,f_,g_]:=D[f,z,2]/.z->0;

BC[5,z_,f_,g_]:=g/.z->1;

BC[6,z_,f_,g_]:=g/.z->0;

Now let us input the solution intervals

zL[1]=0; zR[1]=1;

zL[2]=0; zR[2]=1;

Since all the solution intervals are finite, we do not have to specify the

integral interval to compute the averaged squared residual error.

The initial guesses are chosen as f0 = (z3 − z)/2 and g0 = 0. They are

input as

U[1,0] = (z^3-z)/2;

U[2,0] = 0;

The auxiliary linear operators are chosen as L1 = ∂4

∂z4 and L2 = ∂2

∂z2 .

They are defined as

L[1,u_]:=D[u,z,4];

L[2,u_]:=D[u,z,2];

Note that we use the delayed assignment SetDelayed(:=) to define these

linear operators.

Without loss of generality, let us consider the case when Re = M = 2

and K = 1/2. These physical parameters are input as

Rey = M = 2;

K = 1/2;

At this time, we have input all the data for this problem, except the

convergence-control parameters c0[k]. Hayat [7] chose the convergence-

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 387

control parameters c0[1]=c0[2]=-0.7 through ~-curve. Here we minimize

the averaged squared residual error of the 4th-order approximations to get

optimal values for c0[k]

GetOptiVar[4,,c0[1],c0[2]];

The convergence-control parameters c0[1] and c0[2] are found to be about

−0.5825 and −0.721452, respectively.

Then we call the main module BVPh to get the 20th-order approxima-

tions

BVPh[1, 20];

The 20th-order approximations are stored in U[i,20],i=1,2, while

the corresponding averaged squared residual error of the system is

ErrTotal[20]. We can use

Plot[U[1,20],U[2,20],z,0,1,AxesLabel->"z","",

PlotStyle->Thin, Red, Dashed, Blue,

PlotRange->0, 1, -0.2, 0.2]

to plot the 20th-order approximations, which is shown in Fig. 9.3. This

figure agrees with Hayat’s Figs. 9 and 12 whenM = 2, Re = 2 andK = 0.5.

The 20th-order approximations give the values of f ′′(1) = 3.61076396287

and g′(1) = −0.738463496789, which are the same with Hayat’s result

[7]. The total error ErrTotal[k] of the system for every two order of

approximations is plotted by the command

ListLogPlot[Table[2 i, ErrTotal[2*i], i, 1, 10],

Joined -> True, Mesh -> All,

PlotRange -> 2, 20, 10^(-34), 1,

AxesLabel -> "m", "error"]

in Fig. 9.4. We can see from it that the error decreases beautifully.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

388 Y.-L. Zhao and S.-J. Liao

0.2 0.4 0.6 0.8 1.0z

-0.2

-0.1

0.0

0.1

0.2

Fig. 9.3. The curve of f(z) (solid), g(z) (dashed) for Example 1.

5 10 15 20m10-34

10-28

10-22

10-16

10-10

10-4

error

Fig. 9.4. Total error vs. order of approximation for Example 1.

9.7.2. Example 2: A system of ODEs with algebraic

property at infinity

Consider a set of two coupled nonlinear differential equations [13]

f ′′′(η) + θ(η) − f ′2 = 0, (9.36)

θ′′(η) = 3σf ′(η)θ(η), (9.37)

subject to

f(0) = f ′(0) = 0, θ(0) = 1, f ′(+∞) = θ(+∞) = 0, (9.38)

where the prime denotes differentiation with respect to the similarity vari-

able η, σ is the Prandtl number, f(η) and θ(η) relate to the velocity profile

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 389

and temperature distribution of the boundary layer, respectively. Liao [13]

employed the HAM to solve this system analytically. Now we use the

BVPh 2.0 to solve it.

Under the transformation

ξ = 1 + λη, F (ξ) = f ′(η), S(ξ) = θ(η), (9.39)

Eqs. (9.36) and (9.37) become

λ2F ′′(ξ) + S(ξ)− F 2(ξ) = 0, (9.40)

λ2S′′(ξ) = 3σF (ξ)S(ξ), (9.41)

subject to

F (1) = 0, S(1) = 1, F (+∞) = S(+∞) = 0. (9.42)

Since there are two ODEs in system (9.40)–(9.41) without an unknown

to be determined, we have NumEQ = 2 and TypeEQ=1. This new system is

defined as

TypeEQ = 1;

NumEQ = 2;

f[1,z_,F_,S_,Lambda_]:=la^2*D[F,z,2]+S-F^2;

f[2,z_,F_,S_,Lambda_]:=la^2*D[S,z, 2]-3*sigma*F*S;

The four boundary conditions (9.42) are defined as

NumBC = 4;

BC[1,z_,F_, S_] := F /. z -> 1;

BC[2,z_,F_, S_] := (G - 1) /. z -> 1;

BC[3,z_,F_, S_] := F /. z -> infinity;

BC[4,z_,F_, S_] := G /. z -> infinity;

Now let us input the solution intervals and integral intervals to compute

averaged squared residual error

zL[1] = 1; zR[1] = infinity;

zL[2] = 1; zR[2] = infinity;

zRintegral[1] = 10;

zRintegral[2] = 10;

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

390 Y.-L. Zhao and S.-J. Liao

The initial guesses are chosen as F0 = γ(ξ−2−ξ−3), S0 = ξ−4, and they

are input as

U[1, 0] = gamma*(z^(-2) - z^(-3));

U[2, 0] = z^(-4);

The auxiliary linear operators are LF = ξ3∂2

∂ξ2 +∂∂ξ and LS = ξ

5∂2

∂ξ2 +∂∂ξ ,

which are defined as

L[1, u_] := D[u, z, 2]*z/3 + D[u, z];

L[2, u_] := D[u, z, 2]*z/5 + D[u, z];

Without loss of generality, let us consider the case when σ = 1, γ = 3

and λ = 1/3. We use the same convergence-control parameters c0[1] =

c0[2]= −1/2 as Liao [13]. These physical parameters and the control

parameters c0[k] are defined as

sigma = 1; gamma = 3;

la = 1/3; c0[1] = -1/2; c0[2] = -1/2;

Then we call the main module BVPh

BVPh[1, 20];

to get the 20th-order approximation. If we are not satisfied with the accu-

racy of the 20th-order approximation, we can use BVPh[21,40], instead of

BVPh[1,40], to get 40th-order approximation or higher order approxima-

tion.

Note that U[1,40] and U[2,40] are the 40th-order approximations of

the transformed system (9.40), (9.41) and (9.42). To plot the curve of the

40th-order approximations for the original problem, we first replace z with

1+λη to obtain the 40th-order approximations for f ′(η) and g(η), then plot

the curve we want. This is done in Mathematica by the following command

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 391

trans = z -> 1 + la*\[Eta];

Plot[Evaluate[U[1, 40], U[2, 40] /. trans],

\[Eta], 0, 10,PlotRange -> 0, 10, 0, 1,

AxesLabel -> "\[Eta]", "",

PlotStyle -> Thin, Red, Dashed, Blue]

and the curve is shown in Fig. 9.5. Here trans=z->1+la*\[Eta] is the

corresponding transformation, and \[Eta] is the symbol η in Mathematica.

The total error ErrTotal[k] of the transformed system for every two

order approximations is plotted in Fig. 9.6 by the following command

ListLogPlot[Table[2 i, ErrTotal[2*i], i, 1, 20],

Joined -> True, Mesh -> All,

PlotRange -> 2, 40, 10^(-10), 0.01,

AxesLabel -> "m", "error"]

Note that ErrTotal[k] not only measures the accuracy of the kth-order

approximations for the transformed problem, but also measures the corre-

sponding approximations for the original problem.

0 2 4 6 8 10Η0.0

0.2

0.4

0.6

0.8

1.0

Fig. 9.5. The curve of f ′(η) (solid) and θ(η) (dashed) for Example 2.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

392 Y.-L. Zhao and S.-J. Liao

5 10 15 20 25 30 35 40m10-10

10-8

10-6

10-4

0.01error

Fig. 9.6. Total error vs. order of approximation for Example 2.

The 40th-order approximations of f ′′(0) and g′′(0) are 0.693268 and

−0.769879, respectively. Kuiken’s numerical result is f ′′(0) ≈ 0.693212 and

g′(0) ≈ −0.769861. To get more accurate result, we have two choices. One

is to call the module BVPh to get higher order approximation as before, the

other is to apply the Pade approximation to the current approximations.

The latter is done by calling the module hp as follows

hp[Table[D[(U[1,i]/.trans),\[Eta]]/.\[Eta]->0,

i,0,40],20,20]

hp[Table[D[(U[2,i]/.trans),\[Eta]]/.\[Eta]->0,

i,0,40],20,20]

which give 0.693212 and −0.769861, the [20, 20] homotopy-Pade approxi-

mations of f ′′(0) and g′(0), respectively.

Note that we can compare the curve of 2nth-order approximation and

the [n, n] homotopy-Pade approximation in a simple and efficient way. Here

we compare U[1,40] and the [20, 20] homotopy-Pade approximation of

U[1,i], i = 0 · · · 40, in the Mathematica by the following command.

Plot[U[1, 40]/.trans, hp[Table[U[1,i]/.trans,

i, 0, 40],20, 20],\[Eta],0,10,PlotRange->Full,

AxesLabel->"\[Eta]", "",

PlotStyle->Thin,Red,Dashed,Blue

October 24, 2013 14:55 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 393

2 4 6 8 10Η

0.05

0.10

0.15

0.20

0.25

0.30

0.35

Fig. 9.7. The curve of 40th-order approximation of f ′(η) (solid) and [20, 20] homotopy-Pade approximations of f ′(η) (dashed) for Example 2.

The comparison is shown in Fig. 9.7. From it we can see that the two are

almost the same. This validate the convergence of the approximations to

some extent. The above command is very efficient, because the Plot com-

mand in Mathematica first substitute the sample points into the expression

and then applies the hp to a list of numerical values, rather than applies

the hp to a list of expressions and then substitute the sample points into

the resulting expression.

9.7.3. Example 3: A system of ODEs with an unknown

parameter

Consider a system of ODEs [15]

U ′′ + (GrPr)θ −Nrφ+ σ = 0, (9.43)

θ′′ +Nbθ′φ′ +Nt(θ

′)2 +Nb +Nt − U = 0, (9.44)

φ′′ +Nt

Nbθ′′ − LeU = 0, (9.45)

subject to

U(−1) = U(1) = 0, θ(−1) = θ(1) = 0, φ(−1) = φ(1) = 0, (9.46)

with an additional condition∫ 1

0

UdY = RePr, (9.47)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

394 Y.-L. Zhao and S.-J. Liao

where Gr is the Grashof number, Pr the Prandtl number, Nr the buoyancy

ratio, σ the pressure parameter, Nb the Brownian motion parameter, Nt

the thermophoresis parameter, Le the Lewis number, and Re the Reynolds

number. All of the above parameters will be given for a special case except

σ, which is to be determined from the system. Xu [15] solved this problem

by the HAM.

Here we solve this problem by BVPh 2.0. Since there are three ODEs

in system (9.43)–(9.45) with an unknown σ to be determined, we have

NumEQ = 3 and TypeEQ=2. The system is input as

TypeEQ = 2; NumEQ = 3;

f[1,z_,f_,g_,s_,sigma_] :=

D[f,z,2]+Gr*Pr*g-Nr*s+sigma;

f[2,z_,f_,g_,s_,sigma_] :=

D[g,z,2]+Nb*D[g,z]*D[s,z]+Nt*(D[g,z])^2-f;

f[3,z_,f_,g_,s_,sigma_] :=

D[s,z,2]+Nt/Nb*D[f,z,2]-Le*f;

The seven boundary conditions, including the additional condition

(9.47), are defined as

NumBC = 7;

BC[1,z_,f_,g_,s_] :=f/.z->-1;

BC[2,z_,f_,g_,s_] :=f/.z->1;

BC[3,z_,f_,g_,s_] :=g/.z->-1;

BC[4,z_,f_,g_,s_] :=g/.z->1;

BC[5,z_,f_,g_,s_] :=s/.z->-1;

BC[6,z_,f_,g_,s_] :=s/.z->1;

BC[7,z_,f_,g_,s_] :=Integrate[f,z,0,1]-Ra*Pr;

Now let us input the solution intervals

zL[1] = -1; zR[1] = 1;

zL[2] = -1; zR[2] = 1;

zL[3] = -1; zR[3] = 1;

Since all the solution intervals are finite, we do not have to specify the

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 395

integral interval to compute the averaged squared residual error.

The initial guesses are chosen as U0 = ε1 − 3(−25 + ε1)z2/2 + 5(−15 +

2ε1)z4/2, θ0 = ε2(1 − z2) and φ0 = ε3(1 − z2), where ε1, ε2 and ε3 are

constants to be optimized. They are input as

U[1,0]=eps1-3/2*(-25+4eps1)z^2+5/2*(-15+2eps1)*z^4;

U[2,0]=eps2*(1-z^2);

U[3,0]=eps3*(1-z^2);

The auxiliary linear operators are chosen as L1 = L2 = L3 = ∂2

∂Y 2 .

They are defined as

L[1, u_] := D[u, z, 2];

L[2, u_] := D[u, z, 2];

L[3, u_] := D[u, z, 2];

Note that we use the delayed assignment SetDelayed(:=) to define these

linear operators.

Without loss of generality, let us consider the case when Nr = 3/20,

Nt = Nb = 1/20, Le = 10, Gr = 5, Pr = 1, and Re = 5. These physical

parameters are input as

Nr = 3/20; Nt = 1/20;

Nb = 1/20; Le = 10;

Gr = 5; Pr = 1; Ra = 5;

At this time, we have input all the data for this problem, except the

convergence-control parameters c0[k], eps1, eps2 and eps3. We minimize

the averaged squared residual error of the 3th-order approximations to get

optimal values for these parameters by the module GetOptiVar as follow

c0[1] = c0[2] = c0[3] = h;

GetOptiVar[3, , eps1, eps2, eps3, h];

Note that we put constraints c0[1]=c0[2]=c0[3] on c0[1], c0[2] and

c0[3] to simplify the computation. There is no constraint on eps1, eps2

and eps3.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

396 Y.-L. Zhao and S.-J. Liao

After some computation, we get optimal values for all the convergence-

control parameters c0[1] = c0[2] = c0[3] ≈ −0.769452, eps1 ≈ 7.56408,

eps2 ≈ −2.58887 and eps3 ≈ −30.0044. Now we can use

BVPh[1,10]

to get the 10th-order approximation. If we are not satisfied with the ac-

curacy of the 10th-order approximation, we can use BVPh[11,20] to get

20th-order approximation or higher order approximation.

-1.0 -0.5 0.5 1.0z

-25

-20

-15

-10

-5

5

Fig. 9.8. The curve of U (solid), θ (dashed) and φ(z) (dot dashed) for Example 3.

The 20th-order approximations of U , θ and φ are stored in U[1,20],

U[2,20] and U[3,20], the 20th-order approximation of σ is stored in

Lambda[19], while the corresponding averaged squared residual error of

the system is stored in ErrTotal[20]. Lambda[19] is about 18.272555944,

which is the same with Xu’s result [15]. The 20th-order approximations

are plotted in Fig. 9.8. The total error of the system for every two order of

approximations is plotted in Fig. 9.9.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 397

5 10 15 20m10-20

10-16

10-12

10-8

10-4

1

error

Fig. 9.9. Total error vs. order of approximation for Example 3.

9.7.4. Example 4: A system of ODEs in different intervals

Consider a two-phase flow [16]:

(i) Region 1

d2u1dy2

+Gr

Resin(φ)θ1 = P, (9.48)

d2θ1dy2

+ PrEc

(du1dy

)2

= 0, (9.49)

(ii) Region 2

d2u2dy2

+Gr

Re

nbh2

λsin(φ)θ2 −

M2h2

λu2 =

h2

λP, (9.50)

d2θ2dy2

+ EcPrλ

λT

(du2dy

)2

+ EcPrh2

λTM2u22 = 0, (9.51)

subject to

u1(1) = 1, θ1(1) = 1, (9.52)

u1(0) = u2(0), θ1(0) = θ2(0), (9.53)

u′1(0) =λ

hu′2(0), θ

′1(0) =

λThθ′2(0), (9.54)

u2(−1) = 0, θ2(−1) = 0, (9.55)

whereGr is the Grashof number, Ec is the Eckert number, Pr is the Prandtl

number, Re is the Reynolds number, M is the Hartmann number and P

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

398 Y.-L. Zhao and S.-J. Liao

is the dimensionless pressure gradient. This model describes a two-fluid

magnetohydrodynamic Poiseuille–Couette flow and heat transfer in an in-

clined channel. Umavathi [16] investigate this model analytically by regular

perturbation method and numerically by finite difference technique. The

BVPh 2.0 can solve this problem (9.48)–(9.55) directly without difficulty.

Since all the parameters in the system will be given, we have NumEQ = 4

and TypeEQ=1. The system is input as

TypeEQ = 1;

NumEQ = 4;

f[1,z_,u1_,s1_,u2_,s2_,Lambda_]:=

D[u1, z, 2]+ Gr/Ra*Sin[phi]*s1 - P ;

f[2,z_,u1_,s1_,u2_,s2_,Lambda_]:=

D[s1, z, 2] + Pr*Ec*(D[s1, z])^2;

f[3,z_,u1_,s1_,u2_,s2_,Lambda_]:=D[u2,z, 2]-h^2/lamb*P

+Gr/Ra*Sin[phi]*n*b*h^2/lamb*s2-M^2*h^2/lamb*u2;

f[4,z_,u1_,s1_,u2_,s2_,lambda_]:=D[s2,z,2]

+Pr*Ec*lamb/lambT*D[u2,z]^2+Pr*Ec*h^2/lambT*M^2*u2^2;

The eight boundary conditions (9.52)–(9.55) are defined as

NumBC=8;

BC[1,z_,u1_,s1_,u2_,s2_]:=(u1-1)/.z->1;

BC[2,z_,u1_,s1_,u2_,s2_]:=(u1-u2)/.z->0;

BC[3,z_,u1_,s1_,u2_,s2_]:=u2/.z->-1;

BC[4,z_,u1_,s1_,u2_,s2_]:=(D[u1,z]-D[u2,z]*lamb/h)/.z->0;

BC[5,z_,u1_,s1_,u2_,s2_]:=(s1-1)/.z->1;

BC[6,z_,u1_,s1_,u2_,s2_]:=(s1-s2)/.z->0;

BC[7,z_,u1_,s1_,u2_,s2_]:=s2/.z->-1;

BC[8,z_,u1_,s1_,u2_,s2_]:=(D[s1,z]-D[s2,z]*lambT/h)/.z->0;

Now let us input the solution intervals

zL[1] = 0; zR[1] = 1; (* u1 *)

zL[2] = 0; zR[2] = 1; (* s1 *)

zL[3] = -1; zR[3] = 0; (* u2 *)

zL[4] = -1; zR[4] = 0; (* s2 *)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 399

Note that the solution intervals are not the same. Since all the solution

intervals are finite, we do not have to specify the integral interval to compute

the averaged squared residual error.

The initial guesses are chosen as u1,0 =λh (z− z2)+ 1, θ1,0 = zλT

h +(1−λT

h )z2, u2,0 = 1 + z and θ2,0 = z + z2. They are input as

U[1, 0] = (z - z^2)*lamb/h+1; (* u1 *)

U[2, 0] = z*lambT/h +(1-lambT/h)*z^2; (* s1 *)

U[3, 0] = 1 + z; (* u2 *)

U[4, 0] = z^2 + z; (* s2 *)

The auxiliary linear operators are chosen as L1 = L2 = L3 = L4 = ∂2

∂y2 .

They are defined as

L[1,u_]:=D[u,z,2];

L[2,u_]:=D[u,z,2];

L[3,u_]:=D[u,z,2];

L[4,u_]:=D[u,z,2];

Note that we use the delayed assignment SetDelayed(:=) to define these

linear operators, and z is the independent variable in the package.

Without loss of generality, let us consider the case when Pr = 7/10,

Ec = 1/100, P = −5, b = 1, n = 1, Re = 1, M = 2, Gr = 5, h = 1, λ = 1,

λT = 1, and φ = π/6. These physical parameters are input as

P = -5; b = 1;

n = 1; Ra = 1;

M = 2; Gr = 5;

lamb = 1; lambT = 1;

h = 1; phi = Pi/6;

Pr = 7/10; Ec = 1/100;

At this time, we have input all the data for this problem, except the

convergence-control parameters c0[k]. We minimize the averaged squared

residual error of the 4th-order approximations to obtain optimal values for

c0[k] by the command

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

400 Y.-L. Zhao and S.-J. Liao

GetOptiVar[4,,c0[1],c0[2],c0[3],c0[4]];

Note that the second parameter of GetOptiVar is an empty list, which

means that we give no constraint on the convergence-control parameters

c0[k].

After some time, we obtain the optimal values for c0[k], which reads

c0[1] ≈ −0.898166, c0[2] ≈ −0.946828, c0[3] ≈ −0.780946 and c0[4]

≈ −1.12363. Then we call the main module BVPh to get the 30th-order

approximations

BVPh[1, 30];

The 30th-order approximations for u1, θ1, u2, θ2 are stored in U[1,30],

U[2,30], U[3,30] and U[4,30], respectively, while the corresponding aver-

aged squared residual error of the system is ErrTotal[30]. The 30th-order

approximations are plotted in Fig. 9.10. The value of θ(y) agrees with Uma-

vathi’s result [16] (black dots), as shown in Fig. 9.10. The 30th-order ap-

proximation of θ(y) gives the heat transfer rate Nu+ = θ′1(1) = 0.8860625

and Nu− = θ′2(1) = 1.122312, which agrees with Nu+ = 0.88606 and

Nu− = 1.12230 in Umavathi’s [16] Table 3. The total error ErrTotal[k]

of the system for every two order of approximations is plotted in Fig. 9.11.

-1.0 -0.5 0.0 0.5 1.0z

0.5

1.0

1.5

2.0

2.5

3.0

Fig. 9.10. The curve of u(y) (solid) and θ(y) (dashed) for Example 4. The black dotsare the values for θ(y) obtained by Umavathi [16].

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 401

5 10 15 20 25 30m10-21

10-17

10-13

10-9

10-5

0.1

error

Fig. 9.11. Total error vs. order of approximation for Example 4.

9.7.5. Example 5: Iterative solutions of the Gelfand equation

When the problem is defined in a finite interval, the BVPh 1.0 can solve

it using an iterative approach. The BVPh 2.0 has inherited this feature.

However, there are some minor differences in the input.

Consider the Gelfand equation [17–19]

u′′ + (K − 1)u′

z+ λeu = 0, u′(0) = u(1) = 0, (9.56)

where the prime denotes the differentiation with respect to z, K ≥ 1 is

a constant, u(z) and λ denote eigenfunction and eigenvalue, respectively.

Following Liao [14] , an additional boundary condition

u(0) = A (9.57)

is added to distinguish different eigenfunctions.

To solve this problem by BVPh 2.0, we have to input the differential

equations, boundary conditions, and initial guesses. Since the problem is a

single ODE with an unknown λ to be determined, we set NumEQ = 1 and

TypeEQ=2. The differential equation can be coded as follows

TypeEQ = 2;

NumEQ = 1;

f[1,z_,u_,lambda_] :=

D[u,z,2] +(K-1)*D[u,z]/z+lambda*Exp[u];

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

402 Y.-L. Zhao and S.-J. Liao

The three boundary conditions, including the additional condition

(9.57), are defined as

NumBC = 3;

BC[1, z_, u_] := (u-A)/. z -> 0;

BC[2, z_, u_] := D[u,z]/. z -> 0;

BC[3, z_, u_] := u /. z -> 1;

Now let us input the solution intervals

zL[1] = 0; zR[1] = 1;

Since the solution interval is finite, we do not have to specify the integral

interval to compute the averaged squared residual error.

The initial guess is chosen as U0 = A2 [1 + cos(πz)], which is input into

Mathematica as

U[1,0] = A/2*(1 + Cos[Pi*z]);

The auxiliary linear operator is chosen as L = ∂2

∂z2 +(πa

)2, which is

defined in Mathematica as

L[1,f_] := D[f,z,2]+Pi^2*f;

Note that we use the delayed assignment SetDelayed(:=) to define the

linear operator.

Without loss of generality, let us consider the case when A = 1 and

K = 2. The physical parameters are input as

K = 2; A = 1;

Because we want to approximate the right-hand sides using the hybrid-

base function and use an iterative approach to get the approximations, the

control parameters in BVPh 2.0 are modified to

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 403

TypeL = 2;

HYBRID = 1; (* hybrid-base functions *)

TypeBase = 2; (* even Fourier series *)

ApproxQ = 1;

Ntruncated = 30;

Here TypeL = 2, HYBRID = 1 and ApproxQ = 1 together mean that the

right-hand sides of all high-order deformation equations is approximated

by the hybrid-base approximations. TypeBase = 2 means the even ex-

pression (9.26) is used (TypeBase = 1 also applies to this problem).

Ntruncated = 20 means Nt = 30.

At this time, we have input all the data for this problem, except the

convergence-control parameter c0[1]. To get optimal c0[1], we minimize

the averaged squared residual error of the 6th-order approximations. This

is done in BVPh 2.0 by calling the module GetOptiVar

GetOptiVar[6, , c0[1]];

After some computation, we get the optimal value for the convergence-

control parameter c0[1]= −0.522418 · · · . Now we can use the 3rd-order

iteration HAM approach

iter[1,6,3]

to get the desired approximation. Here 6 means the iteration times. After

about 40 seconds, the 6th iteration gives the eigenvalue 1.90921, which

is the same with Liao’s result [14]. The kth iteration approximations of

u and λ are stored in V[1,k], and LAMBDA[k], while the corresponding

averaged squared residual error is stored in ERRTotal[k]. The 6th iteration

approximation is plotted in Fig. 9.12 by

Plot[V[1,6],z,0,1,AxesLabel->"z", "u(z)"]

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

404 Y.-L. Zhao and S.-J. Liao

0.2 0.4 0.6 0.8 1.0z

0.2

0.4

0.6

0.8

1.0

uHzL

Fig. 9.12. The curve of the eigenfunction u(z) corresponding to the eigenvalue λ =1.90921 when A = 1 and K = 2 for Example 5.

The total error ERRTotal[k] of the problem for each iteration is plotted

in Fig. 9.13 by the command

ListLogPlot[Table[i, ERRTotal[i], i, 1, 6],

PlotRange->1,6,10^-10,0.01,Joined->True, Mesh->All,

AxesLabel->"m","error"]

1 2 3 4 5 6m10-10

10-8

10-6

10-4

0.01error

Fig. 9.13. Total error for each iteration vs. iteration times m for Example 5.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 405

9.8. Conclusions

The homotopy analysis method (HAM) has been successfully applied to

solve lots of nonlinear problems in science and engineering. Based on the

HAM, the Mathematica package BVPh 1.0 was issued by Liao in May, 2012.

The aim of BVPh is to provide an analytic tool for as many nonlinear BVPs

as possible in the frame work of the HAM.

However, the BVPh 1.0 can only deal with problems of a single ODE.

Unlike BVPh 1.0, the new version BVPh 2.0 works for many types of sys-

tems of coupled nonlinear ODEs. In this chapter, we briefly describe how

to install and use the BVPh 2.0. Five typical examples are employed to

demonstrate the validity of BVPh 2.0, including a system of two coupled

ODEs in finite interval, a system of two coupled ODEs in semi-infinite

interval, a system of two coupled ODEs with algebraic property at in-

finity, a system of three coupled ODEs with an unknown parameter to

be determined, and a system of four coupled ODEs in different inter-

vals. Besides, new algorithms are used in some modules of BVPh 2.0.

Hence, BVPh 2.0 is much faster than BVPh 1.0 in most cases. The package

BVPh 2.0 and all input data for these examples are free available online at

http://numericaltank.sjtu.edu.cn/BVPh.htm.

It is well known that the iterative method can gain accurate approx-

imations more efficiently by means of the HAM. The BVPh 2.0 has also

inherited the feature of BVPh 1.0 to solve the problems in finite interval

using the iterative method. For problems in semi-infinite interval, an itera-

tive method for two typical kinds of based functions is proposed [20]. This

iterative approach will be employed in the future version of BVPh.

Appendix A. Codes for examples

Here are the input data for all the examples in this chapter. Note that the

listings without an end-of-line semicolon is wrapped to fit the page width.

However, if you break the long command intentionally in Mathematica, it

will run as multi-line commands and may not work as you expected.

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

406 Y.-L. Zhao and S.-J. Liao

A.1. Sample codes to run the illustrative example

(* Filename: runIllustrative.nb *)

(* 1. Clear all global variables *)

ClearAll["Global‘*"];

(* 2. Read in the package BVPh 2.0 *)

<< "E:\\Package\\BVPh2_0.m"

(* 3. Set the current working directory to *)

(* "the current directory" *)

SetDirectory[ToFileName[Extract["FileName" /.

NotebookInformation[EvaluationNotebook[]], 1,

FrontEnd‘FileName]]];

(* 4. Read in your input data in current directory *)

(* Note that the two files runIllustrative.nb and *)

(* Illustrative.m are in the current directory *)

<< Illustrative.m

A.2. Input data of BVPh 2.0 for the illustrative example

(* Filename: Illustrative.m *)

Print["The input file ",$InputFileName," is loaded !"];

(* Modify control parameters in BVPh if necessary *)

(* Define the governing equation *)

TypeEQ = 1;

NumEQ = 2;

f[1,z_,f_,g_,Lambda_]:=

D[f,z,3]-D[f,z]^2+f*D[f,z,2]+2*la*g+

beta*(2*f*D[f, z]*D[f,z,2]-f^2*D[f,z,3]);

f[2,z_,f_,g_,Lambda_]:=

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 407

D[g,z,2]-D[f,z]*g+f*D[g,z]-2*la*D[f,z]+

beta*(2*f*D[f, z]*D[g, z]-f^2*D[g,z, 2]);

(* Define Boundary conditions *)

NumBC = 5;

BC[1,z_,f_,g_]:=(D[f, z]-1)/.z->0;

BC[2,z_,f_,g_]:=f/.z->0;

BC[3,z_,f_,g_]:=g/.z->0;

BC[4,z_,f_,g_]:=D[f,z]/.z->infinity;

BC[5,z_,f_,g_]:=g/.z->infinity;

(* solution interval and integral interval for error *)

zL[1] = 0;

zR[1] = infinity;

zL[2] = 0;

zR[2] = infinity;

zRintegral[1] = 10;

zRintegral[2] = 10;

(* Define initial guess *)

U[1,0] = 1-Exp[-z];

U[2,0] = ahpha*z*Exp[-z];

(* Define the auxiliary linear operator *)

L[1,u_] := D[u,z,3]-D[u,z];

L[2,u_] := D[u,z,2]-u;

(* Define physical parameters *)

beta = 1/5;

la = 1/10;

(* Print input data *)

PrintInput[f[z],g[z]];

(* Get optimal c0 *)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

408 Y.-L. Zhao and S.-J. Liao

GetOptiVar[3, , c0[1],c0[2],alpha];

(* Gain 10th-order HAM approximation *)

BVPh[1, 10];

A.3. Input data of BVPh 2.0 for Example 1

(* Filename: Example1.m *)

Print["The input file ",$InputFileName," is loaded !"];

(* Modify control parameters in BVPh if necessary *)

ErrReq=10^-30;

(* Define the governing equation *)

TypeEQ = 1;

NumEQ = 2;

f[1,z_,f_,g_,Lambda_]:=(1+K)*D[f,z,4]

-Rey*M*D[f,z,2]+2*Rey*f*D[f,z,3]-K*D[g,z,2];

f[2,z_,f_,g_,Lambda_]:=(1+K/2)*D[g,z,2]

-Rey*K*(2*g-D[f,z,2])+Rey*(2*f*D[g,z]-D[f,z]*g);

(* Define Boundary conditions *)

NumBC = 6;

BC[1,z_,f_,g_]:=f/.z->0;

BC[2,z_,f_,g_]:=f/.z->1;

BC[3,z_,f_,g_]:=(D[f, z]-1)/.z->1;

BC[4,z_,f_,g_]:=D[f,z,2]/.z->0;

BC[5,z_,f_,g_]:=g/.z->1;

BC[6,z_,f_,g_]:=g/.z->0;

(* solution interval and integral interval for error *)

zL[1]=0;

zR[1]=1;

zL[2]=0;

zR[2]=1;

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 409

(* Define initial guess *)

U[1,0] = (z^3-z)/2;

U[2,0] = 0;

(* Define the auxiliary linear operator *)

L[1,u_]:=D[u,z,4];

L[2,u_]:=D[u,z,2];

(* Define physical parameters *)

Rey = M = 2;

K = 1/2;

(* Print input data *)

PrintInput[f[z],g[z]];

(* Get optimal c0 *)

GetOptiVar[4,,c0[1],c0[2]];

(* Gain 20th-order HAM approximation *)

BVPh[1, 20];

A.4. Input data of BVPh 2.0 for Example 2

(* Filename: Example2.m *)

Print["The input file ",$InputFileName," is loaded !"];

(* Modify control parameters in BVPh if necessary *)

(* Define the governing equation *)

TypeEQ = 1;

NumEQ = 2;

f[1,z_,F_,S_,Lambda_]:=la^2*D[F,z,2]+S-F^2;

f[2,z_,F_,S_,Lambda_]:=la^2*D[S,z, 2]-3*sigma*F*S;

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

410 Y.-L. Zhao and S.-J. Liao

(* Define Boundary conditions *)

NumBC = 4;

BC[1,z_,F_, S_] := F /. z -> 1;

BC[2,z_,F_, S_] := (G - 1) /. z -> 1;

BC[3,z_,F_, S_] := F /. z -> infinity;

BC[4,z_,F_, S_] := G /. z -> infinity;

(* solution interval and integral interval for error *)

zL[1] = 1;

zR[1] = infinity;

zL[2] = 1;

zR[2] = infinity;

zRintegral[1] = 10;

zRintegral[2] = 10;

(* Define initial guess *)

U[1, 0] = gamma*(z^(-2) - z^(-3));

U[2, 0] = z^(-4);

(* Defines the auxiliary linear operator *)

L[1, u_] := D[u, z, 2]*z/3 + D[u, z];

L[2, u_] := D[u, z, 2]*z/5 + D[u, z];

(* Define physical and control parameters *)

sigma = 1;

gamma = 3;

la = 1/3;

c0[1] = -1/2;

c0[2] = -1/2;

(* Print input data *)

PrintInput[f[z], g[z]];

(* Gain 20th-order HAM approximation *)

BVPh[1, 20];

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 411

A.5. Input data of BVPh 2.0 for Example 3

(* Filename: Example3.m *)

Print["The input file ",$InputFileName," is loaded !"];

(* Modify control parameters in BVPh if necessary *)

(* Define the governing equation *)

TypeEQ = 2;

NumEQ = 3;

f[1,z_,f_,g_,s_,sigma_] :=

D[f,z,2]+Gr*Pr*g-Nr*s+sigma;

f[2,z_,f_,g_,s_,sigma_] :=

D[g,z,2]+Nb*D[g,z]*D[s,z]+Nt*(D[g,z])^2-f;

f[3,z_,f_,g_,s_,sigma_] :=

D[s,z,2]+Nt/Nb*D[f,z,2]-Le*f;

(* Define boundary conditions *)

NumBC = 7;

BC[1,z_,f_,g_,s_] :=f/.z->-1;

BC[2,z_,f_,g_,s_] :=f/.z->1;

BC[3,z_,f_,g_,s_] :=g/.z->-1;

BC[4,z_,f_,g_,s_] :=g/.z->1;

BC[5,z_,f_,g_,s_] :=s/.z->-1;

BC[6,z_,f_,g_,s_] :=s/.z->1;

BC[7,z_,f_,g_,s_] :=Integrate[f,z,0,1]-Ra*Pr;

(* Define solution interval *)

zL[1] = -1;

zR[1] = 1;

zL[2] = -1;

zR[2] = 1;

zL[3] = -1;

zR[3] = 1;

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

412 Y.-L. Zhao and S.-J. Liao

(* Defines the auxiliary linear operator *)

L[1, u_] := D[u, z, 2];

L[2, u_] := D[u, z, 2];

L[3, u_] := D[u, z, 2];

(* Define physical parameters *)

Nr = 1/5;

Nt = 1/20;

Nb = 1/20;

Le = 10;

Gr = 5;

Pr = 1;

Ra = 5;

(* Define initial guess *)

U[1,0]=eps1-3/2*(-25+4eps1)z^2+5/2*(-15+2eps1)*z^4;

U[2,0]=eps2*(1 - z^2);

U[3,0]=eps3*(1 - z^2);

(* Print input data *)

PrintInput[f[z], g[z], s[z]];

(* Get optimal convergence-control parameters *)

c0[1] = c0[2] = c0[3] = h;

GetOptiVar[3, , eps1, eps2, eps3, h];

(* Gain 10th-order HAM approximation *)

BVPh[1, 20];

A.6. Input data of BVPh 2.0 for Example 4

(* Filename: Example4.m *)

Print["The input file ",$InputFileName," is loaded !"];

(* Modify control parameters in BVPh if necessary *)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 413

(* Define the governing equation *)

TypeEQ = 1;

NumEQ = 4;

f[1,z_,u1_,s1_,u2_,s2_,Lambda_]:=

D[u1, z, 2]+ Gr/Ra*Sin[phi]*s1 - P ;

f[2,z_,u1_,s1_,u2_,s2_,Lambda_]:=

D[s1, z, 2] + Pr*Ec*(D[s1, z])^2;

f[3,z_,u1_,s1_,u2_,s2_,Lambda_]:=D[u2,z, 2]

-h^2/lamb*P+Gr/Ra*Sin[phi]*n*b*h^2/lamb*s2

-M^2*h^2/lamb*u2;

f[4,z_,u1_,s1_,u2_,s2_,lambda_]:=D[s2,z,2]

+Pr*Ec*lamb/lambT*D[u2,z]^2+Pr*Ec*h^2/lambT*M^2*u2^2;

(* Define Boundary conditions *)

NumBC=8;

BC[1,z_,u1_,s1_,u2_,s2_]:=(u1-1)/.z->1;

BC[2,z_,u1_,s1_,u2_,s2_]:=(u1-u2)/.z->0;

BC[3,z_,u1_,s1_,u2_,s2_]:=u2/.z->-1;

BC[4,z_,u1_,s1_,u2_,s2_]:=

(D[u1,z]-D[u2,z]/m/h)/.z->0;

BC[5,z_,u1_,s1_,u2_,s2_]:=(s1-1)/.z->1;

BC[6,z_,u1_,s1_,u2_,s2_]:=(s1-s2)/.z->0;

BC[7,z_,u1_,s1_,u2_,s2_]:=s2/.z->-1;

BC[8,z_,u1_,s1_,u2_,s2_]:=

(D[s1,z]-D[s2,z]/K/h)/.z->0;

(* Define solution interval *)

zL[1]=0; (* u1 *)

zR[1]=1;

zL[2]=0; (* s1 *)

zR[2]=1;

zL[3]=-1;(* u2 *)

zR[3]=0;

zL[4]=-1;(* s2 *)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

414 Y.-L. Zhao and S.-J. Liao

zR[4]=0;

(* Define initial guess *)

U[1, 0] = (z - z^2)*lamb/h+1; (* u1 *)

U[2, 0] = z*lambT/h +(1-lambT/h)*z^2; (* s1 *)

U[3, 0] = 1 + z; (* u2 *)

U[4, 0] = z^2 + z; (* s2 *)

(* Define the auxiliary linear operator *)

L[1,u_]:=D[u,z,2];

L[2,u_]:=D[u,z,2];

L[3,u_]:=D[u,z,2];

L[4,u_]:=D[u,z,2];

(* Define physical parameters *)

P = -5; b = 1;

n = 1; Ra = 1;

M = 2; Gr = 5;

lamb = 1; lambT = 1;

h = 1; phi = Pi/6;

Pr = 7/10; Ec = 1/100;

(* Print input data *)

PrintInput[u1[z], s1[z], u2[z], s2[z]];

(* Get optimal c0 *)

GetOptiVar[4,,c0[1],c0[2],c0[3],c0[4]]

(* Gain 10th-order HAM approximation *)

BVPh[1,30];

A.7. Input data of BVPh 2.0 for Example 5

(* Filename: Example5.m *)

Print["The input file ",$InputFileName," is loaded !"];

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 415

(* Modify control parameters in BVPh if necessary *)

TypeL = 2;

HYBRID = 1; (* hybrid-base functions *)

TypeBase = 2; (* even Fourier series *)

ApproxQ = 1;

Ntruncated = 20;

(* Define the governing equation *)

TypeEQ = 2;

NumEQ = 1;

f[1,z_,u_,lambda_] :=

D[u,z,2] +(K-1)*D[u,z]/z+lambda*Exp[u];

(* Define Boundary conditions *)

NumBC = 3;

BC[1, z_, u_] := (u-A)/. z -> 0;

BC[2, z_, u_] := D[u,z]/. z -> 0;

BC[3, z_, u_] := u /. z -> 1;

(* Define solution interval *)

zL[1] = 0;

zR[1] = 1;

(* Define initial guess *)

U[1,0] = A/2*(1 + Cos[Pi*z]);

(* Define the auxiliary linear operator *)

L[1,f_] := D[f,z,2]+Pi^2*f;

(* Define physical parameters *)

K = 2;

A=1;

(* Print input data *)

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

416 Y.-L. Zhao and S.-J. Liao

PrintInput[u[z]];

(* Get optimal c0 *)

GetOptiVar[6,,c0[1]];

(* Print input data *)

PrintInput[u[z]];

(* Use 3rd-order iteration approach *)

iter[1,6,3]

Acknowledgment

This work is partly supported by National Natural Science Foundation of

China under Grant No. 11272209 and State Key Laboratory of Ocean

Engineering under Grant No. GKZD010056.

References

[1] L. F. Shampine, I. Gladwell and S. Thompson, Solving ODEs with MATLAB.Cambridge University Press, Cambridge (2003).

[2] J. Kierzenka, L. F. Shampine, A BVP solver based on residual control andthe Matlab PSE, ACM TOMS. 27(3), 299–316 (2001).

[3] Z. Battles and L. N. Trefethen, An extension of Matlab to continuous func-tions and operators, SIAM J. Sci. Comput. 25(5), 1743–1770 (2004).

[4] L. N. Trefethen, Computing numerically with functions instead of numbers,Math. Comput. Sci. 1, 9–19 (2007).

[5] Y. P. Liu, S. J. Liao and Z. B. Li, Symbolic computation of strongly nonlinearperiodic oscillations, J. Symb. Comput. 55, 72–95 (2013).

[6] M. Sajid, Z. Iqbal, T. Hayat and S. Obaidat, Series solution for rotatingflow of an upper convected Maxwell fluid over a strtching sheet, Commun.

Theor. Phys. 56(4), 740–744 (2011).[7] T. Hayat, M. Nawa and A. A. Hendi, Heat transfer analysis on axisymmetric

MHD flow of a micropolar fluid between the radially stretching sheets, J.Mech. 27(4), 607–617 (2011).

[8] S. J. Liao, Notes on the homotopy analysis method: Some definitions andtheorems, Commun. Nonlinear Sci. Numer. Simulat. 14(4), 983–997 (2009).

[9] S. J. Liao, Proposed homotopy analysis techniques for the solution of non-

linear problem. Ph.D. thesis, Shanghai Jiao Tong University (1992).[10] S. J. Liao, A uniformly valid analytic solution of two-dimensional viscous

flow over a semi-infinite flat plate, J. Fluid Mech. 385, 101–128 (1999).

October 24, 2013 10:44 World Scientific Review Volume - 9in x 6in Advances/Chap. 9

HAM-Based Package BVPh 2.0 for Nonlinear Boundary Value Problems 417

[11] S. J. Liao, On the analytic solution of magnetohydrodynamic flows of non-newtonian fluids over a stretching sheet, J. Fluid Mech. 488, 189–212 (2003).

[12] S. J. Liao, Series solutions of unsteady boundary-layer flows over a stretchingflat plate, Stud. Appl. Math. 117(3), 239–263 (2006).

[13] S. J. Liao, Beyond Perturbation—Introductioin to the Homotopy Analysis

Method. Chapman & Hall/CRC Press, Boca Raton (2003).[14] S. J. Liao, Homotopy Analysis Method in Nonlinear Differential Equations.

Springer-Verlag Press, New York (2012).[15] H. Xu, T. Fan and I. Pop, Analysis of mixed convection flow of a nanofluid in

a vertical channel with the Buongiorno mathematical model, Int. Commun.

Heat Mass. 44, 15–22 (2013).[16] J. C. Umavathi, I. C. Liu and J. Prathap Kumar. Magnetohydrodynamic

Poiseuille-Couette flow and heat transfer in an inclined channel, J. Mech.

26(4), 525–532 (2010).[17] J. P. Boyd, An analytical and numerical study of the two-dimensional Bratu

equation, J. Sci. Comput. 1(2), 183–206 (1986).[18] J. Jacobsen and K. Schmitt, The Liouville-Bratu-Gelfand problem for radial

operators, J. Differ. Equations. 184, 283–298 (2002).[19] J. S. McGough, Numerical continuation and the Gelfand problem, Appl.

Math. Comput. 89(1-3), 225–239 (1998).[20] Y. L. Zhao, Z. L. Lin and S. J. Liao, An iterative analytical approach for

nonlinear boundary value problems in a semi-infinite domain, Comput. Phys.

Commun. 184(9): 2136–2144 (2013).