Get *Applied Calculus of Variations for Engineers, 2nd Edition* now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.

94 Applied calculus of variations for engineers

0

0

.2

0

.4

0

.6

0

.8

1

1.2

1.4

1.6

0 0.2 0.4 0.6 0.8 1

y_approx(x)

y_exact(x)

y_error(x)

FIGURE 7.1 Accuracy of the Ritz solution

The ﬁgure demonstrates that the Ritz solution satisﬁes the boundary con-

ditions and shows acceptable diﬀerences in the interior of the interval. Finally,

the variational problem’s extremum is computed for both cases. The analyt-

ical solution is based on the derivative

y

=

√

2πcos(πx),

and obtained as

1

0

y

2

(x)dx =2π

2

1

0

cos

2

(πx)dx = π

2

=9.87.

The Ritz solution’s derivative is

y

= −

√

30(2x − 1).

and the approximate extremum is

1

0

y

2

(x)dx =30

1

0

(2x − 1)

2

dx =

30

3

=10.

The approximate extremum is slightly higher than the analytic extremum,

but by only a very acceptable error.

Numerical methods of calculus of variations 95

7.2.1 Application: solution of Poisson’s equation

The second order boundary value problem of Poisson’s, introduced earlier, is

presented in the variational form of

I(y)=

D

((

∂u

∂x

)

2

+(

∂u

∂y

)

2

+2f (x, y)u(x, y))dxdy

whose Euler-Lagrange equation leads to the form

∂

2

u

∂x

2

+

∂

2

u

∂y

2

= f(x, y),

as was shown in the last chapter. For the simplicity of the discussion and

without the loss of generality, we impose the boundary condition of

u =0

on the perimeter of the domain D. Ritz’s method indicates the use of the

basis functions

b

i

(x, y)

and demands that they also vanish on the boundary. The approximate solu-

tion in this two-dimensional case is

u(x, y)=

n

i=1

α

i

b

i

(x, y).

The partial derivatives are

∂

u

∂x

=

n

i=1

α

i

∂b

i

(x, y)

∂x

,

and

∂

u

∂y

=

n

i=1

α

i

∂b

i

(x, y)

∂y

.

Substituting the approximate solution into the functional yields

I(

u)=

D

((

∂

u

∂x

)

2

+(

∂

u

∂y

)

2

+2f (x, y)u(x, y))dxdy.

Evaluating the derivatives, this becomes

I(

u)=

D

((

n

i=1

α

i

∂b

i

∂x

)

2

+(

n

i=1

α

i

∂b

i

∂y

)

2

+2f (x, y))

n

i=1

α

i

b

i

)dxdy,

which may be reordered into the form

I(

u)=

n

i=1

n

j=1

c

ij

α

i

α

j

+

n

i=1

d

i

α

i

.

96 Applied calculus of variations for engineers

The coeﬃcients are

c

ij

=

D

(

∂b

i

∂x

∂b

j

∂x

+

∂b

i

∂y

∂b

j

∂y

)dxdy

and

d

i

=

D

f(x, y)b

i

dxdy.

As above, the unknown coeﬃcients are solved from the conditions

∂I(

u)

∂α

i

=0,i=1, 2,...,n,

resulting in the linear system of equations

n

j=1

c

ij

α

j

+ d

j

=0,i=1, 2,...,n.

It may be shown that the system is nonsingular and always yields a nontrivial

solution assuming that the basis functions form a linearly independent set.

The computation of the terms of the equations, however, is rather tedious

and resulted in the emergence of the next method.

7.3 Galerkin’s method

The diﬀerence between the Ritz method and that of Galerkin’s is in the fact

that the latter addresses the diﬀerential equation form of a variational prob-

lem. Galerkin’s method minimizes the residual of the diﬀerential equation

integrated over the domain with a weight function; hence, it is also called the

method of weighted residuals.

This diﬀerence lends more generality and computational convenience to

Galerkin’s method. Let us consider a linear diﬀerential equation in two vari-

ables:

L(u(x, y)) = 0

and apply Dirichlet boundary conditions. Galerkin’s method is also based on

the Ritz approximation of the solution as

u =

n

i=1

α

i

b

i

(x, y),

Numerical methods of calculus of variations 97

in which case, of course there is a residual of the diﬀerential equation

L(

u) =0.

Galerkin proposed using the basis functions of the approximate solution also

as the weights, and requires that the integral vanishes with a proper selection

of the coeﬃcients:

D

L(u)b

j

(x, y)dxdy =0;j =1, 2,...,n.

This yields a system for the solution of the coeﬃcients as

D

L(

n

i=1

α

i

b

i

(x, y))b

j

(x, y)dxdy =0;j =1, 2,...,n.

This is also a linear system and produces the unknown coeﬃcients α

i

. We il-

lustrate the computational technique of Galerkin’s method also in connection

with Poisson’s equation:

L(u)=

∂

2

u

∂x

2

+

∂

2

u

∂y

2

− f(x, y)=0.

For this Galerkin’s method is presented as

D

(

∂

2

u

∂x

2

+

∂

2

u

∂y

2

− f(x, y))b

j

dxdy =0,j =1,...,n.

Therefore

D

(

n

i=1

α

i

∂

2

b

i

∂x

2

+

n

i=1

α

i

∂

2

b

i

∂y

2

− f(x, y))b

j

dxdy =0,j =1,...,n.

Reordering yields

n

i=1

α

i

D

(

∂

2

b

i

∂x

2

+

∂

2

b

i

∂y

2

)b

j

dxdy −

D

f(x, y)b

j

dxdy =0,j =1,...,n.

The system of equations becomes

Ba

= b

with solution vector of

a

=

⎡

⎢

⎢

⎣

α

1

α

2

...

α

n

⎤

⎥

⎥

⎦

.

98 Applied calculus of variations for engineers

The system matrix is of the form

B =

⎡

⎢

⎢

⎣

B

1,1

B

1,2

... B

1,n

B

2,1

B

2,2

... B

2,n

... ... ... ...

B

n,1

B

n,2

... B

n,n

⎤

⎥

⎥

⎦

whose terms are deﬁned as

B

j,i

=

D

(

∂

2

b

i

∂x

2

+

∂

2

b

i

∂y

2

)b

j

dxdy.

Finally, the right-hand side vector is

b

=

⎡

⎢

⎢

⎣

D

f(x, y)b

1

dxdy

D

f(x, y)b

2

dxdy

...

D

f(x, y)b

n

dxdy

⎤

⎥

⎥

⎦

.

Note that if Galerkin’s and Ritz’s methods are applied to the same problem,

the approximate solutions found are identical.

7.4 Kantorovich’s method

Both the Ritz and Galerkin methods are restricted in their choices of basis

functions, because their basis functions are required to satisfy the boundary

conditions. The clever method of Kantorovich, described in [13], relaxes this

restriction and enables the use of simpler basis functions.

Consider the variational problem of two variables

I(u)=extremum, (x, y) ∈ D,

with boundary conditions

u(x, y)=0, (x, y) ∈ ∂D.

Here ∂D again denotes the boundary of the domain.

The method proposes the construction of a function, such that

ω(x, y) ≥ 0, (x, y) ∈ D,

and

ω(x, y)=0, (x, y) ∈ ∂D.

Get *Applied Calculus of Variations for Engineers, 2nd Edition* now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.

Get Mark Richards’s *Software Architecture Patterns* ebook to better understand how to design components—and how they should interact.

Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.

Start your free trial Become a member now