• Home
  • Textbooks
  • Mathematical Methods for Physics and Engineering: A Comprehensive Guide
  • Numerical methods

Mathematical Methods for Physics and Engineering: A Comprehensive Guide

K. F. Riley, M. P. Hobson, S. J. Bence

Chapter 28

Numerical methods - all with Video Answers

Educators


Chapter Questions

01:21

Problem 1

Use an iteration procedure to find to four significant figures the root of the equation $40 x=\exp x$

Erika Bustos
Erika Bustos
Numerade Educator
03:36

Problem 2

Using the Newton-Raphson procedure find, correct to three decimal places, the root nearest to 7 of the equation $4 x^{3}+2 x^{2}-200 x-50=0$.

M Hassan Anwar
M Hassan Anwar
Numerade Educator
02:44

Problem 3

(a) Show that if a polynomial equation $g(x) \equiv x^{m}-f(x)=0$, where $f(x)$ is a polynomial of degree less than $m$ and for which $f(0) \neq 0$, is solved using a rearrangement iteration scheme $x_{n+1}=\left[f\left(x_{n}\right)\right]^{1 / m}$, then, in general, the scheme will have only first-order convergence.
(b) By considering the cubic equation
$$
x^{3}-a x^{2}+2 a b x-\left(b^{3}+a b^{2}\right)=0
$$
for arbitrary non-zero values of $a$ and $b$, demonstrate that, in special cases, a rearrangement scheme can give second- (or higher-) order convergence.

Aman Gupta
Aman Gupta
Numerade Educator
03:16

Problem 4

The square root of a number $N$ is to be determined by means of the iteration scheme
$$
x_{n+1}=x_{n}\left[1-\left(N-x_{n}^{2}\right) f(N)\right].
$$
Determine how to choose $f(N)$ so that the process has second-order convergence. Given that $\sqrt{7} \approx 2.65$, calculate $\sqrt{7}$ as accurately as a single application of the formula will allow.

Julie Silva
Julie Silva
Numerade Educator
12:41

Problem 5

Solve the following set of simultaneous equations using Gaussian elimination (including interchange where it is formally desirable),
$$
\begin{aligned}
x_{1}+3 x_{2}+4 x_{3}+2 x_{4} &=0 \\
2 x_{1}+10 x_{2}-5 x_{3}+x_{4} &=6 \\
4 x_{2}+3 x_{3}+3 x_{4} &=20 \\
-3 x_{1}+6 x_{2}+12 x_{3}-4 x_{4} &=16.
\end{aligned}
$$

James Kiss
James Kiss
Numerade Educator
01:18

Problem 6

The following table of values of a polynomial $p(x)$ of low degree contains an error. Identify and correct the erroneous value and extend the table up to $x=1.2$.
$$
\begin{array}{llll}
\hline \hline x & p(x) & x & p(x) \\
\hline 0.0 & 0.000 & 0.5 & 0.165 \\
0.1 & 0.011 & 0.6 & 0.216 \\
0.2 & 0.040 & 0.7 & 0.245 \\
0.3 & 0.081 & 0.8 & 0.256 \\
0.4 & 0.128 & 0.9 & 0.243 \\
\hline \hline
\end{array}
$$

Arulmozhi T
Arulmozhi T
Numerade Educator
04:39

Problem 7

Simultaneous linear equations that result in tridiagonal matrices can be treated sometimes as three-term recurrence relations and their solution found in a similar manner to that described in chapter 15. Consider the tridiagonal simultaneous equations
$$
x_{i-1}+4 x_{i}+x_{i+1}=3\left(\delta_{i+1,0}-\delta_{i-1,0}\right), \quad i=0, \pm 1, \pm 2, \ldots
$$
Prove that for $i>0$ the equations have a general solution of the form $x_{i}=$ $\alpha p^{i}+\beta q^{i}$, where $p$ and $q$ are the roots of a certain quadratic equation. Show that a similar result holds for $i<0 .$ In each case express $x_{0}$ in terms of the arbitrary constants $\alpha, \beta, \ldots$
Now impose the condition that $x_{i}$ is bounded as $i \rightarrow \pm \infty$ and obtain a unique solution.

Bryan Lynn
Bryan Lynn
Numerade Educator
01:24

Problem 8

A possible rule for obtaining an approximation to an integral is the mid-point rule, given by
$$
\int_{x_{0}}^{x_{0}+\Delta x} f(x) d x=\Delta x f\left(x_{0}+\frac{1}{2} \Delta x\right)+\mathrm{O}\left(\Delta x^{3}\right)
$$
Writing $h$ for $\Delta x$, and evaluating all derivates at the mid-point of the interval $(x, x+\Delta x)$, use a Taylor series expansion to find, up to $\mathrm{O}\left(h^{5}\right)$, the coefficients of the higher-order errors in both the trapezium and midpoint rules. Hence find a linear combination of these two rules that gives $\mathrm{O}\left(h^{5}\right)$ accuracy for each step $\Delta x$.

Joseph Liao
Joseph Liao
Numerade Educator
02:37

Problem 9

Given a random number $\eta$ uniformly distributed on $(0,1)$, determine the function $\xi=\xi(\eta)$ that would generate a random number $\xi$ distributed as
(a) $2 \xi$ on $0 \leq \xi<1$
(b) $\frac{3}{2} \sqrt{\xi}$ on $0 \leq \xi<1$
(c) $\frac{\pi}{4 a} \cos \frac{\pi \xi}{2 a} \quad$ on $\quad-a \leq \xi<a$.
(d) $\frac{1}{2} \exp (-|\xi|) \quad$ on $-\infty<\xi<\infty$.

Amany Waheeb
Amany Waheeb
Numerade Educator
11:15

Problem 10

$A, B$ and $C$ are three circles of unit radius with centres in the $x y$-plane at $(1,2),(2.5,1.5)$ and $(2,3)$ respectively. Devise a hit or miss Monte Carlo calculation to determine the size of the area that lies outside $C$ but inside $A$ and $B$, as well as inside the square centred on $(2,2.5)$ that has sides of length 2 parallel to the coordinate axes. You should choose your sampling region so as to make the estimation as efficient as possible. Take the random number distribution to be uniform on $(0,1)$ and determine the inequalities that have to be tested using the random numbers chosen.

Chris Trentman
Chris Trentman
Numerade Educator
02:02

Problem 11

Use a Taylor series to solve the equation
$$
\frac{d y}{d x}+x y=0, \quad y(0)=1
$$
evaluating $y(x)$ for $x=0.0$ to $0.5$ in steps of $0.1$

Hamilton Santhakumar
Hamilton Santhakumar
Numerade Educator
02:24

Problem 12

Consider the application of the predictor-corrector method described near the end of subsection $28.6 .3$ to the equation
$$
\frac{d y}{d x}=x+y
$$
Show, by comparison with a Taylor series expansion, that the expression obtained for $y_{i+1}$ in terms of $x_{i}$ and $y_{i}$ by applying the three steps indicated (without any repeat of the last two) is correct to $\mathrm{O}\left(h^{2}\right) .$ Using steps of $h=0.1$ compute the value of $y(0.3)$ and compare it with the value obtained by solving the equation analytically.

Jacob Denson
Jacob Denson
Numerade Educator
13:52

Problem 13

A more refined form of the Adams predictor-corrector method for solving the first-order differential equation
$$
\frac{d y}{d x}=f(x, y)
$$
is known as the Adams-Moulton-Bashforth scheme. At any stage (say the $n$ th) in an $N$ th-order scheme the values of $x$ and $y$ at the previous $N$ solution points are first used to predict the value of $y_{n+1}$. This approximate value of $y$ at the next solution point $x_{n+1}$, denoted by $\bar{y}_{n+1}$, is then used together with those at the previous $N-1$ solution points to make a more refined (corrected) estimation of $y\left(x_{n+1}\right)$. The calculational procedure for a third-order scheme is summarised by the two equations
$$
\begin{aligned}
&\bar{y}_{n+1}=y_{n}+h\left(a_{1} f_{n}+a_{2} f_{n-1}+a_{3} f_{n-2}\right) \quad \text { (predictor) } \\
&y_{n+1}=y_{n}+h\left(b_{1} f\left(x_{n+1}, \bar{y}_{n+1}\right)+b_{2} f_{n}+b_{3} f_{n-1}\right) \quad \text { (corrector) }
\end{aligned}
$$
(a) Find Taylor series expansions for $f_{n-1}$ and $f_{n-2}$ in terms of the function $f_{n}=f\left(x_{n}, y_{n}\right)$ and its derivatives at $x_{n}$.
(b) Substitute them into the predictor equation and, by making that expression for $\bar{y}_{n+1}$ coincide with the true Taylor series for $y_{n+1}$ up to order $h^{3}$, establish simultaneous equations that determine the values of $a_{1}, a_{2}$ and $a_{3}$.
(c) Find the Taylor series for $f_{n+1}$ and substitute it and that for $f_{n-1}$ into the corrector equation. Make the corrected prediction for $y_{n+1}$ coincide with the true Taylor series by choosing the weights $b_{1}, b_{2}$ and $b_{3}$ appropriately.
(d) The values of the numerical solution of the differential equation
$$
\frac{d y}{d x}=\frac{2(1+x) y+x^{3 / 2}}{2 x(1+x)}
$$
at three values of $x$ are given in the following table:
$$
\begin{array}{clll}
x & 0.1 & 0.2 & 0.3 \\
y(x) & 0.030628 & 0.084107 & 0.150328
\end{array}
$$
Use the above predictor-corrector scheme to find the value of $y(0.4)$ and compare your answer with the accurate value, $0.225577$.

Gideon Idumah
Gideon Idumah
Numerade Educator
05:57

Problem 14

If $d y / d x=f(x, y)$ then show that
$$
\frac{d^{2} f}{d x^{2}}=\frac{\partial^{2} f}{\partial x^{2}}+2 f \frac{\partial^{2} f}{\partial x \partial y}+f^{2} \frac{\partial^{2} f}{\partial y^{2}}+\frac{\partial f}{\partial x} \frac{\partial f}{\partial y}+f\left(\frac{d f}{d y}\right)^{2}
$$
Hence verify, by substitution and the subsequent expansion of arguments in Taylor series of their own, that the scheme given in $(28.75)$ coincides with the Taylor expansion (28.64), i.e.
$$
y_{i+1}=y_{i}+h y_{i}^{(1)}+\frac{h^{2}}{2 !} y_{i}^{(2)}+\frac{h^{3}}{3 !} y_{i}^{(3)}+\cdots
$$
up to terms in $h^{3}$.

Sriram Soundarrajan
Sriram Soundarrajan
Numerade Educator
18:21

Problem 15

To solve the ordinary differential equation
$$
\frac{d u}{d t}=f(u, t)
$$
for $f=f(t)$, the explicit two-step finite difference scheme
$$
u_{n+1}=\alpha u_{n}+\beta u_{n-1}+h\left(\mu f_{n}+v f_{n-1}\right)
$$
may be used. Here, in the usual notation, $h$ is the time step, $t_{n}=n h, u_{n}=u\left(t_{n}\right)$ and $f_{n}=f\left(u_{n}, t_{n}\right) ; \alpha, \beta, \mu$, and $v$ are constants.
(a) A particular scheme has $\alpha=1, \beta=0, \mu=3 / 2$ and $v=-1 / 2$. By considering Taylor expansions about $t=t_{n}$ for both $u_{n+j}$ and $f_{n+j}$, show that this scheme gives errors of order $h^{3}$.
(b) Find the values of $\alpha, \beta, \mu$, and $v$ that will give the greatest accuracy.

Mike Gaerlan
Mike Gaerlan
Numerade Educator
06:54

Problem 16

Set up a finite difference scheme to solve the ordinary differential equation
$$
x \frac{d^{2} \phi}{d x^{2}}+\frac{d \phi}{d x}=0
$$
in the range $1 \leq x \leq 4$ and subject to the boundary conditions $\phi(1)=2$ and $d \phi / d x=2$ at $x=4 .$ Using $N$ equal increments, $\Delta x$, in $x$, obtain the general difference equation and state how the boundary conditions are incorporated into the scheme. Setting $\Delta x$ equal to the (crude) value 1 , obtain the relevant simultaneous equations and so obtain rough estimates for $\phi(2), \phi(3)$ and $\phi(4)$.
Finally, solve the original equation analytically and compare your numerical estimates with the accurate values.

SN
Shumayal N
Numerade Educator
01:02

Problem 17

Write a computer program that would solve, for a range of values of $\lambda$, the differential equation
$$
\frac{d y}{d x}=\frac{1}{\sqrt{x^{2}+\lambda y^{2}}}, \quad y(0)=1
$$
using a third-order Runge-Kutta scheme. Consider the difficulties that might arise when $\lambda<0$.

Manik Pulyani
Manik Pulyani
Numerade Educator
02:03

Problem 18

Use the isocline approach to sketch the family of curves that satisfies the nonlinear first-order differential equation
$$
\frac{d y}{d x}=\frac{a}{\sqrt{x^{2}+y^{2}}}.
$$

Naman Kumar
Naman Kumar
Numerade Educator
02:47

Problem 19

For some problems, numerical or algebraic experimentation may suggest the form of the complete solution. Consider the problem of numerically integrating the first-order wave equation
$$
\frac{\partial u}{\partial t}+A \frac{\partial u}{\partial x}=0,
$$
in which $A$ is a positive constant. A finite difference scheme for this partial differential equation is
$$
\frac{u(p, n+1)-u(p, n)}{\Delta t}+A \frac{u(p, n)-u(p-1, n)}{\Delta x}=0
$$
where $x=p \Delta x$ and $t=n \Delta t$, with $p$ any integer and $n$ a non-negative integer. The initial values are $u(0,0)=1$ and $u(p, 0)=0$ for $p \neq 0$.
(a) Carry the difference equation forward in time for two or three steps and attempt to identify the pattern of solution. Establish the criterion for the method to be numerically stable.
(b) Suggest a general form for $u(p, n)$, expressing it in generator function form, i.e. 'as $u(p, n)$ is the coefficient of $s^{p}$ in the expansion of $G(n, s)$ '.
(c) Using your form of solution (or that given in the answers!), obtain an explicit general expression for $u(p, n)$ and verify it by direct substitution into the difference equation.
(d) An analytic solution of the original PDE indicates that an initial disturbance propagates undistorted. Under what circumstances would the difference scheme reproduce that behaviour?

Stanley Enemuo
Stanley Enemuo
Numerade Educator
02:57

Problem 20

In the previous question the difference scheme for solving
$$
\frac{\partial u}{\partial t}+\frac{\partial u}{\partial x}=0
$$
in which $A$ has been set equal to unity, was one-sided in both space $(x)$ and time $(t)$. A more accurate procedure (known as the Lax-Wendroff scheme) is
$$
\begin{aligned}
\frac{u(p, n+1)-u(p, n)}{\Delta t} &+\frac{u(p+1, n)-u(p-1, n)}{2 \Delta x} \\
&=\frac{\Delta t}{2}\left[\frac{u(p+1, n)-2 u(p, n)+u(p-1, n)}{(\Delta x)^{2}}\right]
\end{aligned}
$$
(a) Establish the orders of accuracy of the two finite difference approximations on the LHS of the equation.
(b) Establish the accuracy with which the expression in the brackets approximates $\partial^{2} u / \partial x^{2}$.
(c) Show that the RHS of the equation is such as to make the whole difference scheme accurate to second order in both space and time.

Vikash Ranjan
Vikash Ranjan
Numerade Educator
01:48

Problem 21

Laplace's equation
$$
\frac{\partial^{2} V}{\partial x^{2}}+\frac{\partial^{2} V}{\partial y^{2}}=0
$$
is to be solved for the region and boundary conditions shown in figure $28.7$.
Figure $28.7$ Region, boundary values and initial guessed solution for exercise $28.21$.
Starting from the given initial guess for the potential values $V$ and using the simplest possible form of relaxation, obtain a better approximation to the actual solution. Do not aim to be more accurate than $\pm 0.5$ units and so terminate the process when subsequent changes would be no greater than this.

Manik Pulyani
Manik Pulyani
Numerade Educator
01:29

Problem 22

Consider the solution $\phi(x, y)$ of Laplace's equation in two dimensions using a relaxation method on a square grid with common spacing $h$. As in the main text, denote $\phi\left(x_{0}+i h, y_{0}+j h\right)$ by $\phi_{i, j} .$ Further, define $\phi_{i, j}^{m, n}$ by
$$
\phi_{i, j}^{m, n} \equiv \frac{\partial^{m+n} \phi}{\partial x^{m} \partial y^{n}}
$$
evaluated at $\left(x_{0}+i h, y_{0}+j h\right)$.
(a) Show that
$$
\phi_{i, j}^{4,0}+2 \phi_{i, j}^{2,2}+\phi_{i, j}^{0,4}=0
$$
(b) Working up to terms of order $h^{5}$, find Taylor series expansions, expressed in terms of the $\phi_{i, j}^{m, n}$, for
$$
\begin{aligned}
&S_{\pm, 0}=\phi_{i+1, j}+\phi_{i-1, j} \\
&S_{0, \pm}=\phi_{i, j+1}+\phi_{i, j-1}
\end{aligned}
$$
(c) Find a corresponding expansion, to the same order of accuracy, for $\phi_{i \pm 1, j+1}+$ $\phi_{i \pm 1, j-1}$ and hence show that
$$
S_{\pm, \pm}=\phi_{i+1, j+1}+\phi_{i+1, j-1}+\phi_{i-1, j+1}+\phi_{i-1, j-1}
$$
has the form
$$
4 \phi_{i, j}^{0,0}+2 h^{2}\left(\phi_{i, j}^{2,0}+\phi_{i, j}^{0,2}\right)+\frac{h^{4}}{6}\left(\phi_{i, j}^{4,0}+6 \phi_{i, j}^{2,2}+\phi_{i, j}^{0,4}\right).
$$
(d) Evaluate the expression $4\left(S_{\pm, 0}+S_{0, \pm}\right)+S_{\pm, \pm}$and hence deduce that a possible relaxation scheme, good to the fifth order in $h$, is to recalculate each $\phi_{i, j}$ as the weighted mean of the current values of its four nearest neighbours (each with weight $\frac{1}{5}$ ) and its four next-nearest neighbours (each with weight $\frac{1}{20}$ ).

Manik Pulyani
Manik Pulyani
Numerade Educator
11:38

Problem 23

The Schrödinger equation for a quantum mechanical particle of mass $m$ moving in a one-dimensional harmonic oscillator potential $V(x)=k x^{2} / 2$ is
$$
-\frac{\hbar^{2}}{2 m} \frac{d^{2} \psi}{d x^{2}}+\frac{k x^{2} \psi}{2}=E \psi
$$
For physically acceptable solutions the wavefunction $\psi(x)$ must be finite at $x=0$, tend to zero as $x \rightarrow \pm \infty$ and be normalised so that $\int|\psi|^{2} d x=1 .$ In practice these constraints mean that only certain (quantised) values of $E$, the energy of the particle, are allowed. The allowed values fall into two groups, those for which the corresponding $y(0)=0$ and those for which the corresponding $y(0) \neq 0$.
Show that if the unit of length is taken as $\left[\hbar^{2} /(m k)\right]^{1 / 4}$ and the unit of energy as $\hbar(k / m)^{1 / 2}$ then the Schrödinger equation takes the form
$$
\frac{d^{2} \psi}{d y^{2}}+\left(2 E^{\prime}-y^{2}\right) \psi=0
$$
Devise an outline computerised scheme, using Runge-Kutta integration, that will enable you to:
(a) determine the three lowest allowed values of $E$;
(b) tabulate the normalised wavefunction corresponding to the lowest allowed energy.
You should consider explicitly:
(i) the variables to use in the numerical integration;
(ii) how starting values near $y=0$ are to be chosen;
(iii) how the condition on $\psi$ as $y \rightarrow \pm \infty$ is to be implemented;
(iv) how the required values of $E$ are to be extracted from the results of the integration;
(v) how the normalisation is to be carried out.

Ameer Said
Ameer Said
Numerade Educator