0% found this document useful (0 votes)
30 views80 pages

MAT2244 Unit 6. Numerical Methods December 2023

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views80 pages

MAT2244 Unit 6. Numerical Methods December 2023

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

MAT2244: Multivariable

Analysis

Unit 6:Numerical Analysis


methods(NAM) for Multiple
variable functions
12/12/2023 Numerical techniques in 2D by Prof. MV 1
Unit 6: Numerical Analysis methods(NAM)
for Multiple variable functions
6.0. Introduction (definition)
• In previous modules such for example in MAT1141 or MAT1242,most of the functions
we have encountered have only depended on one variable,

• But both within mathematics and in applications there is often a need for functions of
several variables.

• In this Unit we will deduce methods for numerical differentiation and integration of
functions of two variables.

• These methods are simple extensions of the numerical differentiation methods for
functions of one variable.

12/12/2023 Numerical techniques in 2D by Prof. MV 2


What is numerical analysis(NA)?
• Numerical analysis is the study of algorithms for the problems of
continuous mathematics(Definition of NA by L. N. Trefethe).
• The goal is to devise algorithms that give quick and accurate answers
to mathematical problems for scientists and/or engineers, nowadays
using computers. Œ
• The word continuous is important: numerical analysis concerns real/
complex variables, as opposed to discrete variables, which are the
domain of computer science.

12/12/2023 Numerical techniques in 2D by Prof. MV 3


Direct or iterative methods?

• Some problems can be solved by a finite sequence of elementary


operations:
• A direct method,
• Even in this simple example, we hit upon one problem: π is a
transcendental number that can’t be represented exactly in a
computer with finite memory.
• Instead, we will see that the computer uses a floating-point
approximation, which incurs rounding error.

12/12/2023 Numerical techniques in 2D by Prof. MV 4


• In direct methods, we only have to worry about rounding error, and
computational time/memory.
• But, unfortunately, most problems of continuous mathematics cannot
be solved by a finite algorithm.

12/12/2023 Numerical techniques in 2D by Prof. MV 5


• This is an iterative method – keep adding an extra term to improve
the approximation.
• Iterative methods are the only option for the majority of problems in
numerical analysis, and may actually be quicker even when a direct
method exists.
• The word “iterative” derives from the latin iterare, meaning “to
repeat”
• For the purpose of clarity we will be limited on NM in 2D

12/12/2023 Numerical techniques in 2D by Prof. MV 6


6.1. Numerical differentiation of functions of
two variables
6.1.1Recall of some definitions
• Differentiation: Differentiation generalises to functions of two
variables in a simple way: We keep one variable fixed and
differentiate the resulting function as a function of one variable
• Partial derivatives: Let f be a function defined on a set A ⊆ IRXIR .
The partial derivatives of f at an interior point (a,b) ∈ A are given by

12/12/2023 Numerical techniques in 2D by Prof. MV 7


• Geometrically, the partial derivatives give the slope of f at (a,b) in the
directions parallel to the two coordinate axes. The directional
derivative gives the slope in a general direction.
• The reason that we may want to compute derivatives numerically are
the same for functions of two variables as for functions of one
variable:
• The function may only be known via some procedure or computer
program
• One can compute directional derivatives very easily as long as we can
compute partial derivatives.
12/12/2023 Numerical techniques in 2D by Prof. MV 8
• The basic problem in numerical differentiation is therefore to find numerical
approximations to the partial derivatives.

• Since only one variable varies in the definition of a first-order partial derivative,
we can actually use the approximations that we obtained for functions of one
variable. The simplest approximation is the following.
• Proposition 1 Let f be a function defined on a set A ⊆ R 2 and suppose that the points
(a,b), (a + r h1,b) and (a,b + r h2) all lie in A for any r ∈ [0, 1]. Then the two partial
derivatives ∂f /∂x and ∂f /∂y can be approximated by

12/12/2023 Numerical techniques in 2D by Prof. MV 9


12/12/2023 Numerical techniques in 2D by Prof. MV 10
Example
• Let us consider the simplest mixed derivative

12/12/2023 Numerical techniques in 2D by Prof. MV 11


• Now we can use the same kind of approximation for the two first-
order partial derivatives in (7.5),

12/12/2023 Numerical techniques in 2D by Prof. MV 12


• These approximations require f to be a ’nice’ function. A sufficient
condition is that all partial derivatives up to order four are continuous
in a disc that contains the rectangle with corners(a −h1,b −h2) and (a
+h1,b +h2).

12/12/2023 Numerical techniques in 2D by Prof. MV 13


• Proposition 2 (Approximation of a mixed derivative). Suppose that f
has continuous derivatives up to order four in a disc that contains the
rectangle with corners (a−h1,b−h2) and (a+h1,b+h2). Then the mixed
second derivative of f can be approximated by

12/12/2023 Numerical techniques in 2D by Prof. MV 14


• This figure shows the weights involved in computing the mixed
second derivative with the approximation in example above. This kind
of figure is referred to as the computational molecule of the
approximation.
Numerical approximations to partial derivatives are often computed
at all points of a grid like the one shown here by sliding around the
grid a computational molecule like the one in previous figure .

12/12/2023 Numerical techniques in 2D by Prof. MV 15


• Numerical approximations of other mixed partial derivatives can be
deduced with the same technique as in example above,
• A formula like (7.7) is often visualised with a drawing like the one in
figure 1 which is called a computational molecule.
• The arguments of the function values involved in the approximation
are placed in a rectangular grid together with the corresponding
coefficients of the function values.

12/12/2023 Numerical techniques in 2D by Prof. MV 16


Remarks
1. More complicated approximations will usually be based on additional
values and involve more complicated coefficients.
2. Approximations to derivatives are usually computed at many points, and
often the points form a rectangular grid as in figure 2.
3. The computations can be performed by moving the computational
molecule of the approximation across the grid and computing the
approximation at each point, as indicated by the grey area in figure 7.4.

12/12/2023 Numerical techniques in 2D by Prof. MV 17


Exercises I

12/12/2023 Numerical techniques in 2D by Prof. MV 18


6.2. Numerical integration in 2D
6.2.1. Numerical integration methods (NIM)to evaluate double integrals
using generalized gaussian Quadrature
Introduction
• The need of numerical integration of double integrals arises in many
mathematical models, as most of these integrals cannot be evaluated
analytically.
• Even though extensive research has taken place to evaluate integrals
over triangular elements, integration over quadrilateral elements and
elements with curved boundaries is still a field of on-going research

12/12/2023 Numerical techniques in 2D by Prof. MV 19


• In this section, a general numerical integration formula is derived to
evaluate double integrals of the form

12/12/2023 Numerical techniques in 2D by Prof. MV 20


This figure shows Elements that can be written as R or R’

12/12/2023 Numerical techniques in 2D by Prof. MV 21


• Initially, a general derivation for the numerical integration of double
integrals using transformation techniques is explained and then
another integration formula for integration over a circular disc using a
combination of polar and linear transformations is derived.
• A numerical integration formula is derived over an element with an
arbitrary boundary r=u(α ) and finally as an application, an integration
method over a lunar model with two circular boundaries is provided.
6.2.2.Derivation of the generalized Gaussian quadrature rules to evaluate
double integral
Consider the integral (3.1)
12/12/2023 Numerical techniques in 2D by Prof. MV 22
The Jacobian of the transformation is :

12/12/2023 Numerical techniques in 2D by Prof. MV 23


• On applying the Gaussian quadrature rule twice, the following can be
achieved.

12/12/2023 Numerical techniques in 2D by Prof. MV 24


12/12/2023 Numerical techniques in 2D by Prof. MV 25
12/12/2023 Numerical techniques in 2D by Prof. MV 26
12/12/2023 Numerical techniques in 2D by Prof. MV 27
12/12/2023 Numerical techniques in 2D by Prof. MV 28
12/12/2023 Numerical techniques in 2D by Prof. MV 29
12/12/2023 Numerical techniques in 2D by Prof. MV 30
12/12/2023 Numerical techniques in 2D by Prof. MV 31
12/12/2023 Numerical techniques in 2D by Prof. MV 32
12/12/2023 Numerical techniques in 2D by Prof. MV 33
12/12/2023 Numerical techniques in 2D by Prof. MV 34
12/12/2023 Numerical techniques in 2D by Prof. MV 35
12/12/2023 Numerical techniques in 2D by Prof. MV 36
12/12/2023 Numerical techniques in 2D by Prof. MV 37
12/12/2023 Numerical techniques in 2D by Prof. MV 38
12/12/2023 Numerical techniques in 2D by Prof. MV 39
12/12/2023 Numerical techniques in 2D by Prof. MV 40
12/12/2023 Numerical techniques in 2D by Prof. MV 41
12/12/2023 Numerical techniques in 2D by Prof. MV 42
12/12/2023 Numerical techniques in 2D by Prof. MV 43
12/12/2023 Numerical techniques in 2D by Prof. MV 44
6.2.3. Evaluation of double integrals by using
Trapezium rule
• As many problems in scientific computing involve two-dimensional
domains, it is essential to be able to compute integrals over such
domains.
• Such integrals can be evaluated using the following strategies:
• If a two-dimensional domain Ω can be decomposed into rectangles,
then the integral of a function f(x,y) over Ω can be computed by
evaluating integrals of the form

12/12/2023 Numerical techniques in 2D by Prof. MV 45


12/12/2023 Numerical techniques in 2D by Prof. MV 46
12/12/2023 Numerical techniques in 2D by Prof. MV 47
• This algorithm combines the second and third strategies described above,
decomposing the domain into subdomains that are either triangles or regions
between two curves

12/12/2023 Numerical techniques in 2D by Prof. MV 48


12/12/2023 Numerical techniques in 2D by Prof. MV 49
12/12/2023 Numerical techniques in 2D by Prof. MV 50
12/12/2023 Numerical techniques in 2D by Prof. MV 51
12/12/2023 Numerical techniques in 2D by Prof. MV 52
12/12/2023 Numerical techniques in 2D by Prof. MV 53
6.2.3.Midpoint Rule To Approximate Double Integrals

Introduction
• In the past, we used midpoint rule to estimate the area under a
single variable function.
• We’d draw rectangles under the curve so that the midpoint at
the top of each rectangle touched the graph of the function.

12/12/2023 Numerical techniques in 2D by Prof. MV 54


• Then we’d add the area of each rectangle together to find an
approximation of the area under the curve.
• When we translate this into three-dimensional space, it means
that we use three-dimensional rectangular prisms, instead of
two-dimensional rectangles, to approximate the volume under a
multivariable function.

12/12/2023 Numerical techniques in 2D by Prof. MV 55


How to use the midpoint rule to approximate a double integral

https://www.kristakingmath.com/blog/midpoint-rule-for-double-integrals
12/12/2023 Numerical techniques in 2D by Prof. MV 56
12/12/2023 Numerical techniques in 2D by Prof. MV 57
Midpoint rule when m and n are equal

If we plug the values we’ve been given into the midpoint rule formula, we get

12/12/2023 Numerical techniques in 2D by Prof. MV 58


12/12/2023 Numerical techniques in 2D by Prof. MV 59
• Notice the double integral on the left side of the equation.
• We turned it into an iterated integral (where we can integrate with
respect to one variable at a time) by attaching the x-interval to the
inside integral and the y-interval to the outside integral.
• Since we put the limits of integration for x on the inside interval, that
means we also have to put dx on the inside before dy, which comes
second since the limits of integration for y are on the outside integral.
• We could evaluate this iterated integral to find exact volume under
the curve over the rectangle R=[0,2]×[0,4], but we’ve been asked to
use midpoint rule to approximate volume, so instead we’ll use the
right side of the formula.

12/12/2023 Numerical techniques in 2D by Prof. MV 60


• We’ll need to define the rectangle R, then divide it into smaller
rectangles based on m and n, and then find the midpoint of
each rectangle so that

• The rectangle R=[0,2]×[0,4] means that we want to integrate


over the x-interval [0,2] and over the y-interval [0,4].

12/12/2023 Numerical techniques in 2D by Prof. MV 61


12/12/2023 Numerical techniques in 2D by Prof. MV 62
12/12/2023 Numerical techniques in 2D by Prof. MV 63
We want to plug this sum into the approximation formula for

12/12/2023 Numerical techniques in 2D by Prof. MV 64


12/12/2023 Numerical techniques in 2D by Prof. MV 65
6.2.4. Numerical Integration by Sampson’s
rule
Introduction
Thef Simpson numerical method is a very versatile , accurate and easy
to implement that can be used to evaluate a definite integral of a
function f(x,y) between lower bounds and an upper bounds .

12/12/2023 Numerical techniques in 2D by Prof. MV 66


Simpson’s 1/3 rule

12/12/2023 Numerical techniques in 2D by Prof. MV 67


12/12/2023 Numerical techniques in 2D by Prof. MV 68
12/12/2023 Numerical techniques in 2D by Prof. MV 69
12/12/2023 Numerical techniques in 2D by Prof. MV 70
Simpson’s rule and Estimation of Error

12/12/2023 71
Numerical techniques in 2D by Prof. MV
12/12/2023 Numerical techniques in 2D by Prof. MV 72
12/12/2023 Numerical techniques in 2D by Prof. MV 73
• We will consider a number of examples which demonstrates how to
apply the two dimensional Simpson’s rule to evaluate double integrals

12/12/2023 Numerical techniques in 2D by Prof. MV 74


12/12/2023 Numerical techniques in 2D by Prof. MV 75
12/12/2023 Numerical techniques in 2D by Prof. MV 76
12/12/2023 Numerical techniques in 2D by Prof. MV 77
12/12/2023 Numerical techniques in 2D by Prof. MV 78
Exercise about Numerical integration
Attempt the following (Activity one):

12/12/2023 Numerical techniques in 2D by Prof. MV 79


Activity two

12/12/2023 Numerical techniques in 2D by Prof. MV 80

You might also like