Week 7
Notes – Adam Ata
Numerical
Integration
Trapezoidal rule
A1=(f(x0)+f(x1))*h/2
A2=(f(x1)+f(x2))*h/2
A3=(f(x2)+f(x3))*h/2
![]()
![]()
In general:
+![]()
Example:
: with m = 4 and h = .5
= ![]()
Example:
with m = 3 and h = pi/6
=
77048
Exact solution is 1
Simpson rule
Approximates the function using a
quadratic polynomial every 3 points.






Letting ![]()



When [a,b] is divided into 2M
subintervals, h = (b-a)/2M
Example: 2M = 6
![]()
![]()
In general:

Example:
with 2M = 4, ![]()

Exact
solution is 1
With 2M =2,
![]()

Numerical
Optimization:
Used to
obtain the minimum or maximum of a function
Definitions:
Local maximum
at x=p exists if f(x)<=f(p) for all x near p
Local
minimum at x=p exists if f(x)>=f(p) for all x near p
If there is
a maximum or a minimum at x=p then f ’(p)=0
Obtaining a
maximum or minimum can be done by solving f ‘(x) = 0

When a
maximum exists at x=p, f’’(p)<0
When a
maximum exists at x=p, f’’(p)>0
Minimuzation
using the steepest descent or Gradient Method:
Assume we
want to minimize f(x) at N variables where ![]()

points in the direction of greater
increase.
For
maximization:
where h is the step size
For
minimization: ![]()
Example: ![]()
Finding the
minimum:
![]()
![]()
![]()
![]()
![]()
….![]()
Solutions
of Differential Equations:
Consider
the equation: ![]()
By
separating the variables and integrating, ![]()
Some differential
equations are impossible to solve analytically though.
Euler’s
Method
Let [a, b]
be the interval over which we want to find the solution y ‘ = f(t, y) with ![]()
We will
find a set of points,
that approximate ![]()
Divide [a,
b] into M equal subintervals with the step size, ![]()
![]()
Solve ![]()
Using the
first two terms of the taylor series expansion of y(t),
![]()
Now to
obtain ![]()
![]()
In general ![]()
Example: ![]()
![]()
![]()
![]()
![]()
Heun’s
Method
Solve ![]()
Use
fundamental theorem of calculus to integrate y’(t) over ![]()

and use numerical integration to
approximate it.
Trapezoidal
rule:
But we
still need to know
.
Use Euler’s
Approximation: ![]()
![]()
In general:
![]()
![]()
Example:
![]()
![]()
![]()
![]()
![]()
![]()
Taylor
Series Method
![]()
Want to
solve y’=f(t, y)
![]()
We can
obtain ![]()
Example: ![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
