Lecture 30
Euler Methods
Numerical Solution of an IVP
Suppose we wish to numerically solve the initial value problem
y = f (t, y),
y(a) = y0 ,
(30.1)
on an interval of time [a, b].
By a numerical solution, we must mean an approximation of the solution at

Lecture 34
Finite Difference Method Nonlinear ODE
Heat conduction with radiation
If we again consider the heat in a metal bar of length L, but this time consider the effect of radiation as well
as conduction, then the steady state equation has the form
ux

Lecture 31
Higher Order Methods
The order of a method
For numerical solutions of an initial value problem there are two ways to measure the error. The first is the
error of each step. This is called the Local Truncation Error or LTE. The other is the tota

Lecture 29
Reduction of Higher Order Equations to
Systems
The motion of a pendulum
Consider the motion of an ideal pendulum that consists of a mass m attached to an arm of length . If we
ignore friction, then Newtons laws of motion tell us
m =
mg
sin ,
w

Lecture 33
ODE Boundary Value Problems and Finite
Differences
Steady State Heat and Diffusion
If we consider the movement of heat in a long thin object (like a metal bar), it is known that the temperature,
u(x, t), at a location x and time t satisfies the

Lecture 25
Double Integrals for Non-rectangles
In the previous lecture we considered only integrals over rectangular regions. In practice, regions of interest
are rarely rectangles and so in this lecture we consider two strategies for evaluating integrals

Lecture 21
Integration: Left, Right and Trapezoid Rules
The Left and Right endpoint rules
In this section, we wish to approximate a definite integral
Z
b
f (x) dx ,
a
where f (x) is a continuous function. In calculus we learned that integrals are (signed)

Lecture 20
Least Squares Fitting: Noisy Data
Very often data has a significant amount of noise. The least squares approximation is intentionally wellsuited to represent noisy data. The next illustration shows the effects noise can have and how least squar

Lecture 28
The Main Sources of Error
Truncation Error
Truncation error is defined as the error caused directly by an approximation method. For instance, all
numerical integration methods are approximations and so there is error, even if the calculations a

Lecture 27
Numerical Differentiation
Approximating derivatives from data
Suppose that a variable y depends on another variable x, i.e. y = f (x), but we only know the values of f at
a finite set of points, e.g., as data from an experiment or a simulation:

Lecture 23
Plotting Functions of Two Variables
Functions on Rectangular Grids
Suppose you wish to plot a function f (x, y) on the rectangle a x b and c y d. The graph of a
function of two variables is of course a three dimensional object. Visualizing the

Lecture 22
Integration: Midpoint and Simpsons Rules
Midpoint rule
If we use the endpoints of the subintervals to approximate the integral, we run the risk that the values at the
endpoints do not accurately represent the average value of the function on th

Lecture 24
Double Integrals for Rectangles
The center point method
Suppose that we need to find the integral of a function, f (x, y), on a rectangle
R = cfw_(x, y) : a x b, c y d.
In calculus you learned to do this by an iterated integral
Z
ZZ
Z bZ d
f (x

Lecture 15
An Application of Eigenvectors: Vibrational
Modes
One application of ews and evs is in the analysis of vibration problems. A simple nontrivial vibration
problem is the motion of two objects with equal masses m attached to each other and fixed o

Lecture 18
Iterative solution of linear systems*
Newton refinement
Conjugate gradient method
62
Review of Part II
Methods and Formulas
Basic Matrix Theory:
Identity matrix: AI = A, IA = A, and Iv = v
Inverse matrix: AA1 = I and A1 A = I
Norm of a matrix:

Lecture 14
Eigenvalues and Eigenvectors
Suppose that A is a square (n n) matrix. We say that a nonzero vector v is an eigenvector (ev) and a
number is its eigenvalue (ew) if
Av = v.
(14.1)
Geometrically this means that Av is in the same direction as v, si

Lecture 8
Matrices and Matrix Operations in Matlab
Matrix operations
Recall how to multiply a matrix A times a vector v:
1 2
1
1 (1) + 2 2
3
Av =
=
=
.
3 4
2
3 (1) + 4 2
5
This is a special case of matrix multiplication. To multiply two matrices, A an

Lecture 4
Controlling Error and Conditional Statements
Measuring error and the Residual
If we are trying to find a numerical solution of an equation f (x) = 0, then there are a few different ways we
can measure the error of our approximation. The most dir

Lecture 3
Newtons Method and Loops
Solving equations numerically
For the next few lectures we will focus on the problem of solving an equation:
f (x) = 0.
(3.1)
As you learned in calculus, the final step in many optimization problems is to solve an equati

Lecture 16
Numerical Methods for Eigenvalues
As mentioned above, the ews and evs of an n n matrix where n 4 must be found numerically instead
of by hand. The numerical methods that are used in practice depend on the geometric meaning of ews and
evs which

Lecture 6
Secant Methods
In this lecture we introduce two additional methods to find numerical solutions of the equation f (x) = 0.
Both of these methods are based on approximating the function by secant lines just as Newtons method
was based on approxima

Lecture 5
The Bisection Method and Locating Roots
Bisecting and the if .
else .
end statement
Recall the bisection method. Suppose that c = f (a) < 0 and d = f (b) > 0. If f is continuous, then obviously
it must be zero at some x between a and b. The bise

Lecture 10
Some Facts About Linear Systems
Some inconvenient truths
In the last lecture we learned how to solve a linear system using Matlab. Input the following:
> A = ones(4,4)
> b = randn(4,1)
> x = A \ b
As you will find, there is no solution to the e

Lecture 7
Symbolic Computations
The focus of this course is on numerical computations, i.e. calculations, usually approximations, with floating
point numbers. However, Matlab can also do symbolic computations which means exact calculations using
symbols a

Lecture 11
Accuracy, Condition Numbers and Pivoting
In this lecture we will discuss two separate issues of accuracy in solving linear systems. The first, pivoting, is
a method that ensures that Gaussian elimination proceeds as accurately as possible. The

Lecture 9
Introduction to Linear Systems
How linear systems occur
Linear systems of equations naturally occur in many places in engineering, such as structural analysis,
dynamics and electric circuits. Computers have made it possible to quickly and accura

Lecture 17
The QR Method*
The Power Method and Inverse Power Method each give us only one ewev pair. While both of these
methods can be modified to give more ews and evs, there is a better method for obtaining all the ews
called the QR method. This is the

Lecture 1
Vectors, Functions, and Plots in Matlab
In this book > will indicate commands to be entered in the command window. You do not actually type
the command prompt > .
Entering vectors
In Matlab, the basic objects are matrices, i.e. arrays of numbers

Lecture 2
Matlab Programs
In Matlab, programs may be written and saved in files with a suffix .m called M-files. There are two types
of M-file programs: functions and scripts.
Function Programs
Begin by clicking on the new document icon in the top left of