Lecture 2 18.086 Spring 2016

advertisement
Lecture 2
18.086 Spring 2016
Last lecture
•
Review of Fourier series, Fourier transform and why
we care (solving ODEs/PDEs, Green’s function,
discrete Fourier transform etc.; book: section 4.1)
•
Initial value problems (IVP): Perturbation with plane
waves => dispersion relation => “character of the
problem” (dissipative, oscillating etc.)
•
For linear DE, analyzing a single plane wave is
enough: Other solution can be written as a
superposition (Fourier)
18.335 Julia tutorial
•
Tomorrow (Friday 2/5/16), 5pm, 4-270
•
“Julia is a high-level, high-performance dynamic programming
language for technical computing, with syntax that is familiar to
users of other technical computing environments. It provides a
sophisticated compiler, distributed parallel execution, numerical
accuracy, and an extensive mathematical function library. The
library, largely written in Julia itself, also integrates mature, best-ofbreed C and Fortran libraries for linear algebra, random number
generation, signal processing, and string processing. In addition,
the Julia developer community is contributing a number of external
packages through Julia’s built-in package manager at a rapid
pace. IJulia, a collaboration between the IPython and Julia
communities, provides a powerful browser-based graphical
notebook interface to Julia.”
Julia tutorial
•
http://julialang.org/
Finite difference methods
•
Consider an initial value problem (IVP) of the form
0
u = f (t, u) with u(0, u) = u0 (x) given
•
Can be scalar or vectorial
f: given, e.g. from a spatial discretization (FD, FE, FV)
Need method to integrate in time which is:
stable, accurate and fast
Integration time step <=> properties of f(t,u) and
method
•
•
•
Finite difference methods
•
We will learn about: Euler, Trapezoidal rule, Adams-Bashforth, Runge-Kutta
•
Implicit and explicit methods
•
stiff equations
•
Error estimation, order of accuracy
•
Stability conditions
•
Best method: depends on problem f(t,u)
Stiff problems
Example: Lighting a flame. The radius y of the flame follows the
ODE:
dy/dt = y2- y3
y(0) = δ
0 < t < 2/δ
Solve it using ode45 in matlab:
delta = 0.01;
F = inline('y^2 - y^3','t','y');
opts = odeset('RelTol',1.e-4);
ode45(F,[0 2/delta],delta,opts);
Download