Assignment 3
Problem 1
a. The function L1 (x, y ) satises
L1 (1/2, 0) = 1, L1 (0, 1/2) = 0, L1 (1/2, 1/2) = 0
If L1 (x, y ) = ax + by = c, this implies
1
2a + c = 1
1
b+c=0
2
1
a + 1b + c = 0
2
2
which can be solved to obtain
L1 (x, y ) = 1 2y
Similarly
L
Assignment 3
Problem 1
a. Since Qi (x) and Qi (x) are continuous, Qi (xi1 ) = Qi (xi1 ) = 0 and Qi (xi+2 ) =
Qi (xi+2 ) = 0.
First nd a function Q with the required properties in the interval [1, 2], with
xj = i j . Since Q(1) = Q (1) = 0, in the subinter
Linear Algebra and Numerical Analysis: Matlab
Martin Mensik
1
Martin Mensik
Linear Algebra and Numerical Analysis : Matlab
Basic routines
Write a script le (not a function) that will do following tasks in order. All vectors should be of dimension
5 unless
MATLAB FOR NUMERICAL ANALYSIS
Home Exercises:
(Submit the printed figures and necessary commands for the following two exercises next week.)
Question1. For each of the following functions, find an interval a, b , so that f a and f b have
opposite signs, b
Numerical Analysis Lab Note #1
Matlab Basic
=
Variables
Like most other programming languages, the MATLAB language provides
mathematical expressions, but MATLAB does not require any type
declarations or dimension statements. When MATLAB encounters a new
v
Numerical Analysis Lab Note #2
Matlab Basic
Matrix, Vector, Function, and Script M-File
=
Matrices and Vectors
In Matlab, all variables can be viewed as matrices.
You can use "[ ]" to define a matrix.
Or, you can use functions "zeros", "ones", "rand", "ey
MATLAB has many tools that make this package well suited for numerical computations. This
tutorial deals with the rootfinding, interpolation, numerical differentiation and integration and
numerical solutions of the ordinary differential equations.
MATLAB Commands and Functions
Dr. Brian Vick
Mechanical Engineering Department
Virginia Tech
General Purpose Commands
Operators and Special Characters / 3
Commands for Managing a Session / 3
Special Variables and Constants / 4
System and File Commands / 4
NUMERICAL ANALYSIS PROGRAMS IN MATLAB
This README le gives instructions for the Matlab programs on the disk. The programs are designed
to run on a minimally congured computer. Minimal hard disk space plus the Matlab package are all that
is needed to. All
Assignment 1
Problem 4
a. Since P3 (0) = P3 (1/3) = P3 (2/3) = 0, we must have
2
1
P3 (x) = Ax(x )(x )
3
3
for some constant A. Now evaluating P3 (x) at x = 1 and using the condition P3 (1) = 1,
we get P3 (1) = A (1/3) (2/3), from which we obtain A = 9/2.
MATH 573 ASSIGNMENT 6
1. Determine the two point Gaussian quadrature formula and error term for approximating
1
f (x) dx.
0
2. In this problem, we develop a quadrature formula of the form
b
w(x)f (x) dx = H0 f (a) + H1 f (x1 ) + E,
(1)
a
where H0 , H1 , a
1. The Finite Fourier Transform
We consider the approximation of a periodic function f with period 2 , i.e., f (t + 2 ) =
f (t). Note that a function with a more general period can be reduced to this case in the
following simple way. If g (t + ) = g (t),
MATH 573 LECTURE NOTES
57
13.4. Estimation of local error. In practice, we not only want to produce an approximation to the solution at each step of the algorithm, we also want to produce an estimate of
the local error. If this error is too big, we will r
0.1. Linear multistep methods. The general linear (p + 1) step method has the form
p
yn+1 =
p
ai yni + h
bi fni ,
i=1
i=0
where fni = f (xni , yni ) and the ai and bi are constants.
Remarks: Any of the ai s and bi s may be zero, but we assume either ap or
68
MATH 573 LECTURE NOTES
13.6. Stability of linear multistep methods.
Denition: 1st and 2nd characteristic polynomial of a multistep method:
p
(z ) = z
p+1
p
ai z
pi
,
bi z pi .
(z ) =
i=0
i=1
The linear multistep method is consistent if (1) = 0 and (1)
MATH 573 LECTURE NOTES
71
13.7. Strong, weak, absolute and relative stability. To formalize the stability problem
discussed above, we now dene several concepts of stability that seek to dierentiate between
methods which exhibit numerical instability and t
74
MATH 573 LECTURE NOTES
13.8. Predictor-corrector methods. We consider the Adams methods, obtained from the
formula
xn+1
xn+1
f (x, y (x) dx
y (x) dx =
y (xn+1 y (xn ) =
xn
xn
by replacing f by an interpolating polynomial. If we use the points xn , xn1
MATH 573 ASSIGNMENT 1
Before beginning this assignment, copy the le Interppoly.m from the RESOURCES folder
to the directory you will be using when you start up Matlab.
The rst three problems in this assignment study the eect of the choice of interpolation
MATH 573 ASSIGNMENT 2
1a. Let I = cfw_1, 1/2, 0, 1/2, 1 and f (x) = 1/(1 + x2 ). Find the value of each of the
following at x = 3/4.
i) The polynomial P (x) of degree 4 interpolating f (x) on the set I .
ii) The piecewise linear function L(x) dened on a m
MATH 573 ASSIGNMENT 3
1a. Let a = x0 < x1 < < xN = b, where xi+1 xi = h. Let i be a xed integer satisfying
1 i N 2. Determine a piecewise polynomial function Qi (x) satisfying the following
properties:
(i) Qi (x) is a quadratic on each subinterval [xj 1 ,
MATH 573 ASSIGNMENT 4
1a. Let T be the triangle with vertices a1 = (1, 0), a2 = (0, 1), a3 = (0, 0). Find linear
polynomials L1 (x, y ), L2 (x, y ), L3 (x, y ) in x and y such that any linear polynomial L(x, y )
can be written as:
L(x, y ) = L(1/2, 0)L1 (
MATH 573 ASSIGNMENT 5
b
1. One form of the error for the approximation of a f (x) dx by the composite rectangle rule
h N 1 f (a + ih) (where h = (b a)/N ) is given by
i=0
N 1
b
f (x) dx h
a
f (a + ih) =
i=0
h
ba 2
[f (b) f (a)]
h f (),
2
12
for some a <
1. Cubic spline approximation
1.1. Cubic spline interpolation. We consider the problem of nding a C 2 piecewise cubic
function S (x) that satises S (xi ) = f (xi ), i = 0, . . . , n plus two additional conditions. These
are usually taken to be either S (x