COMP 350 Solutions for Assignment 4
1. (a) We work with the iteration formula:
xn+1 = xn f (xn )/g(xn ).
(1)
r xn+1 = (r xn ) + f (xn )/g(xn )
(2)
From this we have
In order to prove quadratic convergence, we substitute f (xn ) by using the expression obt
COMP 350 Numerical Computing
Assignment #4. Solving a nonlinear equation.
Date given: Monday, Oct 20. Date due: 5pm, Wednesday, Oct 29, 2014.
1. (a) (8 points) The Steensen method for solving the equation f (x) = 0 uses the
formula
f (xn )
xn+1 = xn
,
g(
COMP 350 Numerical Computing
Assignment #3: MATLAB, solving linear systems. Due: 5PM, Tuesday, Oct 13, 2008.
1. (3 marks) Count the number of ops involved in the following MATLAB code:
for k = 1:n1
i = k+1:n;
j = k+1:n;
A(i,j) = A(i,j)  A(i,k)*A(k,j);
e
COMP 350 Numerical Computing
Assignment #1: Computer Numbers and Arithmetic
Date Given: Monday, September 8. Date Due: Monday, September 22, 2014
You can submit either an electronic copy (in PDF format) of your assignment through myCourses
or a hard copy,
COMP 350 Solutions to Assignment 1
1. (a) exponent bias = 231 1 = 3
(b) The smallest nonnegative normalized oating point in this system
(1.000000)2 22
The largest nonnegative normalized oating point in this system
(1.111111)2 23
(c) The smallest nonnegati
COMP 350 Numerical Computing
Assignment #2: Overow, underow, numerical cancellation
Date Given: Wednesday, September 17. Date Due: Wednesday, October 1, 2014
This is a computer assignment. You can use any highlevel programming language, but not a
softwar
COMP 350 Numerical Computing
Assignment #2. Due: 5PM, Tuesday, Sept 30, 2008
This is a computer assignment. You can use any highlevel programming language, but not a software
package such as MATLAB etc. Print out your program and computed results. Do not
COMP 350 Solutions to Assignment 1 Fall 2008
1. (Computation steps are omitted here)
(2008.92)10 = (11111011000.1110101110)2
2. (a) exponent bias = 231  1 = 3
(b) The smallest nonnegative normalized oating point in this system
1.00000 22
The largest nonn
COMP 350 Numerical Computing
Assignment #1: Floating Point Computing Due: 5pm, Tuesday, Sep. 16, 2008
Place your clearly written or printed answers, rmly bound or stapled together, with your Name
and Student Number at the front, in the marked COMP 350 box
Classes of Real Numbers
All real numbers can be represented by a line:
1/2
1
0
1
2
3
4
The Real Line
real numbers
rational numbers
integers
nonintegral fractions
irrational numbers
Rational numbers
All of the real numbers which consist of a ratio of two
COMP 350 Numerical Computing
Assignment #3: Solving linear systems.
Date given: Wednesday, September 30. Date due: 5pm, Wednesday, October 14, 2015
1. (2 points) Solve the following system using GEPP (Gaussian elimination with partial pivoting):
1
2
3 4
COMP 350 Numerical Computing
Assignment #1: Floating Point Computing
Date Given: Wednesday, September 9. Date Due: 5pm, Wednesday, September 23, 2015
You can submit either an electronic copy (in PDF format) of your assignment through myCourses
or a hard c
COMP 350 Numerical Computing
Assignment #3: Solving linear systems.
Date given: Wednesday, September 30. Date due: 5pm, Wednesday, October 14, 2015
1. (2 points) Solve the following system using GEPP (Gaussian elimination with partial pivoting):
1
2
3 4
COMP 350 Numerical Computing
Assignment #1: Floating point in C, overow and underow, numerical cancellation
Date Given: Monday, September 21. Date Due: 5pm, Wednesday, September 30, 2015
Submit your assignment including your code through myCourses.
1. (5
COMP 350 Numerical Computing
Assignment #1: Floating Point Computing
Date Given: Wednesday, September 9. Date Due: 5pm, Wednesday, September 23, 2015
You can submit either an electronic copy (in PDF format) of your assignment through myCourses
or a hard c
Fall 2008 COMP 350 Solutions for Assignment #3:
1. for k = 1:n1
i = k+1:n;
j = k+1:n;
A(i,j) = A(i,j)  A(i,k)*A(k,j);
end
For each k, we need (n k)2 multiplications and (n k)2 subtractions. Notice k
changes from 1 to n 1. So the total number of ops is:
Fall 2008 COMP 350 Solutions for Assignment 4
1. We work with the iteration formula: xn+1 = xn f (xn )/g(xn ). From this we have r xn+1 = (r xn ) + f (xn )/g(xn ) (2) In order to prove quadratic convergence, we substitute f (xn ) by using the expression o
COMP 350 Numerical Computing
Assignment #4: Solving a nonlinear equation f (x) = 0.
Due 5:00pm, Tuesday, October 28
1. (8 points) (Steensens Method) This method uses the formula xn+1 = xn
f (xn )/g(xn ), where g(xn ) = [f (xn + f (xn ) f (xn )]/f (xn ).
Solving a Nonlinear Equation
Problem: Given
/(r),
find a root (solution) of
/(r) :6.
r If /
o If /
is a polynomial with degree 4 or less, formulas for roots exist.
o If
is.a general nonlinear function, no formula exists
is a polynomial with degree larger
c,Vr\ryt.t :
a&K
?uad;
,l
,L
( se)
Polynomial Interpolation (PI)
Problem:
Given n * 1 pointr (ro, go), (*r,yr),. . . ,(*n,Ur,), where fii dre distinct, seek a polvnomial
frr
p(z) with Ieast degree such that p(na)  y6 for i:0,1,. . .,ra, i.e., the polynom
Numerical Methods for Ordinary Differential Equations (ODE)
Introduction
In this course, we focus on the following general initialvalue problem
ODE:
I
I
at  f
(t,r)
orcfw_
*@)ns
(
dr(t) _
d
:
L r(a)
(M)
for a first order
f (t, *(r)
ro
In many applicati
R.ea;t,1
c,&
t( tt,t
g 6, )
Spline Interpolation
Def. A function ^9 is called a spline of degree k if
The domain of
S,
S',.5(*t)
,S
is an interval [a, b].
are continuous on [a, b].
There are points t6 (the knots of ^9) such that a : to (
is a polynomial
Reaa i^at
'frr Solrrnf, &F )o
E,kr^inahon
eMa+\o.n
Ca
u(
c,hp.2
ffi
Norrn is a rneasure of size of a vector or matrix.
.
Typical vector norms:

llrllr
It
.
i
it
f
u,l, llrll". :
,IL
rrr?x
\ ^,2t lf 2
\Z,'ut )
i\
lurl, llrll,
f
can be shown that
Ty
Ohr
rvtstttr^g
'
to
to anrerA W;n1 t15
o[qa!4cfw_
F.Iry",.fu
i
y,A *"yp"+U
/ ['
./'
Y
fittirg by a straight line
Given the data: nt * 1 points (*u, ao) (rr,yt),
.7.n'
Data
,
,
,tf
.
, (*rn, u,).
r(
(x r, yK) .i
Suppose there are some reasons to bel
Reading: C & K sections 7.1 & 7.2
Example: f(t,x)  3t^2 4t^1, x(1)=4
x(t) = integral of x'(t) dt = integral of (3t^24t^1)dt = t^3 4lnt +c , and 4 = 1+c, c =4
so we have x(t) = t^34lnt+c
Numerical Methods for Ordinary Dierential Equations (ODE)
Intr
Numerical Integration
Introduction
There are two types of integrals: indenite integral and denite integral. If we can nd an
antiderivative F (x) of a function f , and F is an elementary function, then we can compute
b
I=
f (x)dx = F (b) F (a).
a
Maple an