18.330 Lecture Notes:
Chebyshev Spectral Methods
Homer Reid
April 29, 2014
Contents
1 The question
2
2 The classical answer
3
3 The modern answer for periodic functions
5
4 The modern answer for non-periodic functions
6
5 Chebyshev polynomials
10
6 Chebys
18.330 Lecture Notes:
Orthogonal Polynomials, Gaussian Quadrature,
and Integral Equations
Homer Reid
May 1, 2014
In the previous set of notes we arrived at the definition of Chebyshev polynomials
Tn (x) via the following logic:
Given a function f (x) on t
18.330 Introduction to Numerical Analysis
Spring 2017
Problem Set 1 Solutions
Homer Reid
February 23, 2017
Problem 1. (a) Here are my julia codes.
# Evaluate Ramanujan formula 1, evaluating a total of N square roots
function RF1(N)
x=1.0;
for n=N:-1:2
x=s
18.330 Introduction to Numerical Analysis
Spring 2017
Problem Set 3
Due: Thursday, 3/9/2017, at the beginning of class
Problem 1. Construction of finite-difference stencils. (Subtitle: Fun
with Taylor series.) As discussed in class, a finite-difference st
#
# compute PhiLocal to a relative error tolerance of RelTol.
#
function PhiLocal(x,y,RelTol)
y2=y^2
# n=0 term
r=sqrt(x^2 + y2)
Sum=erfc(r)/r;
# the nth loop iteration adds the contributions of
# the positive ions at r=\pm 2n and the negative ions
#-
# this function computes the RHS of the simple planetary-motion ODE
# note: t is a scalar, and u is a six-component vector
#
function PlanetaryMotion(t,u)
du=0.0*u;
r=norm(u[1:3])
r3=r^3;
du[1] = u[4];
du[2] = u[5];
du[3] = u[6];
du[4] = -u[1]
#
# Given a vector of polynomial coefficients, evaluate
# the polynomial and its derivative at x.
# Note that the coefficients should be in descending order,
# i.e. for 3x^2 + 7x - 9 you would set Coeffs=[3 7 -9].
#
function EvalPolyAndDerivative(Coeffs,
#
# composite rectangular rule with N subintervals
#
function RectRule(func, x1, x2, N)
Delta = (x2-x1)/N;
I = 0.0;
x = x1;
for n=1:N
I += func(x) * Delta;
x += Delta;
end
I
end
#
# This function uses rectangular-rule quadrature,
# with various nu
18.330 Introduction to Numerical Analysis
Spring 2017
Problem Set 2
Due: Thursday, 3/2/2017, at the beginning of class
Problem 1. Choreographed orbits. In class we discussed the use of numerical ODE integrators to solve the problem of massive bodies inter
18.330 Introduction to Numerical Analysis
Spring 2017
Problem Set 1
Due: Thursday, 2/23/2017, at the beginning of class
Problem 1. Restoration of wacky Ramanujan formulas.
Over the course of his career, the early-20th-century mathematician Ramanujan disco
18.330 Introduction to Numerical Analysis, Spring 2015
Practice Problems for Midterm 2
May 1, 2015
1
Reference material
Fourier transforms. For a function f (t) defined on the entire real line < t < , we have
Z
Z
1
it
e
e
f (t)eit dt.
f (t) =
f ()e d,
f
18.330 Lecture Notes:
Ewald Summation
Homer Reid
April 10, 2014
1
Overview
In the first half of the course, we considered the computation of the electrostatic
potential due to the 1D ionic solid pictured in Figure 1, which consists of an
infinite chain of
18.330 Lecture Notes:
Fourier Analysis
Homer Reid
April 8, 2014
Contents
1 Fourier Analysis
2
2 The Fourier transform
4
3 Examples of Fourier transforms
8
4 The smoothness of f (t) and the decay of fe()
12
5 Fourier series
14
6 Fourier analysis is a lossl
18.330 Lecture Notes:
The FFT and its Applications
Homer Reid
April 24, 2014
Contents
1 The Discrete Fourier Transform
2
2 The DFT as Trigonometric Interpolation
4
3 The DFT as a rectangular-rule approximation to a Fourierseries coefficient
12
4 The DFT a
#
# solve the beam equation on the interval [0:10] given a loading
# function q(x), a stiffness parameter Alpha, and a dimension N
# (where N is the dimension of the solution vector, so the stepsize
# is (b-a)/(N+1) )
#
function SolveBeamEquation(q, Alpha
18.330 Introduction to Numerical Analysis
Spring 2017
Problem Set 2 Solutions
Homer Reid
March 3, 2017
Problem 1. (a) Let the position position vectors of the three planets be
r1 , r2 , r3 . Define
rij ri rj ,
rij |rij |,
rij
ri rj
.
ri j
Suppose the thr
#
# evaluate the sum directly
#
function DirectSum(N, Summand)
Sum=0.0;
for n=1:N
Sum+=Summand;
end
Sum
end
#
# evaluate the sum recursively.
#
global const BaseCaseThreshold=100 # globals are slow unless const
function RecursiveSum(N, Summand)
#
18.330 Lecture Notes:
Invitation to Numerical Analysis
Homer Reid
February 4, 2014
Suppose youre a material scientist. (Or a physicist, or a chemist, or a
biologist, or an electrical engineer, or a structural engineer, etc. The problems
well consider are
Chapter 4
Nonlinear equations
4.1
Root nding
Consider the problem of solving any nonlinear relation g (x) = h(x) in the
real variable x. We rephrase this problem as one of nding the zero (root)
of a function, here f (x) = g (x) h(x). The minimal assumptio
Chapter 7
Spectral Interpolation,
Dierentiation, Quadrature
7.1
7.1.1
Interpolation
Bandlimited interpolation
While equispaced points generally cause problems for polynomial interpolation, as we just saw, they are the natural choice for discretizing the F
18.330 : Homework 4 : Spring 2012 : Due Tuesday April 3
1. (1pt) Compute 31/3 to 10 digits of accuracy using Newtons method. Explain how you obtained your
answer.
2. One method to nd the solution of the equation x = (x) for some function is to use the xed
Chapter 2
Integrals as sums and
derivatives as dierences
We now switch to the simplest methods for integrating or dierentiating a
function from its function samples. A careful study of Taylor expansions
reveals how accurate the constructions are.
2.1
Nume
Chapter 1
Series and sequences
Throughout these notes well keep running into Taylor series and Fourier se
ries. Its important to understand what is meant by convergence of series be
fore getting to numerical analysis proper. These notes are sef-contained,
Chapter 6
Fourier analysis
(Historical intro: the heat equation on a square plate or interval.)
Fouriers analysis was tremendously successful in the 19th century for formulating series expansions for solutions of some very simple ODE and PDE.
This class s