Q2
(a)
function[noiter,x]=GaussSeidel(A,b,x0,tol)
[n,n1]=size(A);
if n1~=n
error('A should be square matrix!')
end
[n2,n3]=size(b);
if n2~=n
error('b should be n rows!')
end
if n3~=1
error('b should be one column!')
end
[n4,n5]=size(x0);
if n4~=n
error('x
Chapter 8
Fourier Analysis
We all use Fourier analysis every day without even knowing it. Cell phones, disc drives, DVDs, and JPEGs all involve fast finite Fourier transforms. This chapter discusses both the computation and the interpretation of FFTs. The
Chapter 7
Ordinary Differential Equations
Matlab has several different functions for the numerical solution of ordinary differential equations. This chapter describes the simplest of these functions and then compares all of the functions for efficiency, a
Chapter 11
Partial Dierential
Equations
A wide variety of partial dierential equations occurs in technical computing. We
cannot begin to cover them all in this book. In this chapter, we limit ourselves to
three model problems for second-order partial dier
Chapter 6
Quadrature
The term numerical integration covers several different tasks, including numerical evaluation of integrals and numerical solution of ordinary differential equations. So we use the somewhat old-fashioned term quadrature for the simples
Chapter 9
Random Numbers
This chapter describes algorithms for the generation of pseudorandom numbers with both uniform and normal distributions.
9.1
Pseudorandom Numbers
0.95012928514718
Here is an interesting number:
This is the first number produced by
Chapter 1
Introduction to MATLAB
This book is an introduction to two subjects: Matlab and numerical computing. This rst chapter introduces Matlab by presenting several programs that investigate elementary, but interesting, mathematical problems. If you al
Chapter 4
Zeros and Roots
This chapter describes several basic methods for computing zeros of functions and then combines three of the basic methods into a fast, reliable algorithm known as `zeroin'.
Let's compute 2. We will use interval bisection, which
Chapter 2
Linear Equations
One of the problems encountered most frequently in scientific computation is the solution of systems of simultaneous linear equations. This chapter covers the solution of linear systems by Gaussian elimination and the sensitivit
Preface
Numerical Computing with MATLAB is a textbook for an introductory course
in numerical methods, Matlab, and technical computing. The emphasis is on informed use of mathematical software. We want you learn enough about the mathematical functions in
Chapter 5
Least Squares
The term least squares describes a frequently used approach to solving overdetermined or inexactly specied systems of equations in an approximate sense. Instead
of solving the equations exactly, we seek only to minimize the sum of
AMATH 242 CM 271 CS 371
Assignment 6
Due : Tuesday, July 30, 20131
Instructor: K. D. Papoulia
1. Suppose you are given two vectors a = (a0 , . . . , an ) and b = (b0 , . . . , bn ) which
are the coecents of two polynomials p(x) = an xn + an1 xn1 + a0 and
AMATH 242 CM 271 CS 371
Assignment 5
Due : Thursday, July 18, 2013
Instructor: K. D. Papoulia
1. Recall that a Vandermonde matrix is an n n matrix formed from a vector x =
(x0 , x1 , x2 , . . . , xn1 ) as follows:
V (w) =
xn1
0
xn1
1
xn1
2
.
.
.
xn2
0
xn2
AMATH 242 CM 271 CS 371
Assignment 3
Due : Tuesday June 25, 2013
Instructor: K. D. Papoulia
1. Suppose one wishes to perform Gaussian elimination with partial pivoting on an nn
matrix A, where n is even. Sometimes it is advantageous for an implementation
AMATH 242 CM 271 CS 371
Assignment 4
Due : Thursday, July 11, 2013
Instructor: K. D. Papoulia
1. (a) Consider the function f (x) = x/ x2 + 1. This function has a unique root at
x = 0. Does Newtons method converge to the root? Implement it in Matlab, and
s
AMATH 242 / CM 271 / CS 371
Assignment 2
due Thursday, June 13, 2013
Instructor: K. D. Papoulia
1. Consider the following tridiagonal matrix
A=
0
0
0
c2
0
0
b3 c 3
0
0
. .
.
.
.
.
.
.
.
00
an1 bn1 cn1
00
an
bn
b1 c 1
a2 b 2
0 a3
0
0
nn
Matrices with a lot
AMATH 242 / CM 271 / CS 371
Assignment 1
due Thursday, May 30, 2013
Instructor: K. D. Papoulia
1. Consider the following Matlab computation:
> format long
> x=9.4
x=
9.400000000000000
> y=x-9
y=
0.400000000000000
> z=y-0.4
z=
3.330669073875470e-16
Explain
Chapter 3
Interpolation
Interpolation is the process of defining a function that takes on specified values at specified points. This chapter concentrates on two closely related interpolants: the piecewise cubic spline and the shape-preserving piecewise cu
Chapter 10
Eigenvalues and Singular
Values
This chapter is about eigenvalues and singular values of matrices. Computational
algorithms and sensitivity to perturbations are both discussed.
10.1
Eigenvalue and Singular Value Decompositions
An eigenvalue and
$
'
Matlab Tutorial
CS371 - Introduction to Computational Mathematics
May. 13, 2010
&
1
%
$
'
Outline
Matlab Overview
Useful Commands
Matrix Construction and
Flow Control
Script/Function Files
Basic Graphics
&
2
%
$
'
What is Matlab?
According to The