首页 > > 详细

CS314辅导、讲解Matlab编程语言、讲解Matlab设计、辅导Matlab报告 辅导Python编程|讲解留学生Prolog

CS314 Numerical Methods
Fall 2018
Homework 03
Due 11:59PM, Thursday, Oct 11, 2018
*** Homework must be submitted via Blackboard in PDF file format. The PDF file (i.e. the main
file) should include Matlab code (if necessary) and also the Matlab code should be uploaded in
separate files (i.e., .m files).
*** Your PDF file should be named as follows: FistnameLastnameHWxx.pdf, where xx represents
the homework number, e.g., 01.
*** You should write up your own solution, and you are not permitted to share or copy someone
else’s written solution or code. All projects are individual projects.
1. (20 points) The IEEE floating point standard defines a single precision word to have 32 bits.
Of these, 1 bit is for the sign, 8 bits are used for the exponent, and the remaining 23 bits are for
the fraction. A normalized representation is used for all the numbers, except 0 and the subnormal
numbers. Assume that the extreme values are either end of the exponent range are reserved for
representing 0, Inf, Nan, subnormal numbers, etc. Answer the following questions.
(a) What are the largest and smallest (unsigned and unbiased) values that are stored in the exponent
field? Assume a biased exponent value is computed from the stored values, and that the value
of the bias is chosen to be the largest integer that is smaller than half the maximum value of the
unbiased exponent. What is the range of biased exponent values in single precision?
(b) What is the decimal value of the largest subnormal number represented in this system?
(c) How many distinct normalized numbers are stored in this system? Please include a few steps
showing your calculation, not just the final result.
(d) How many distinct subnormal numbers are represented on this system? Please include a few
steps showing your calculation, not just the final result.
2. (10 points) Write down the IEEE double precision representation for the decimal number
22/7, using round to nearest. You need to show details on the computation. If you only show the
final representation, you would receive zero point.
13. (15 points) For the function f(x) = x
2 3x + 2 whose root we wish to find, we can write
several mathematically equivalent fixed-point iterations:
(a) g1(x) = (x2 + 2)/3;
(b) g2(x) = 3 ? 2/x;
(c) g3(x) = (x2 ? 2)/(2x ? 3).
Analyze which of these fixed point iterations, xk+1 = gi(xk), i = 1, 2, 3, will converge (1) for the
root at x = 2, and (2) for the root at x = 1.
4. (20 points) Implement the scant method and Newton method to find all roots of the sinc
function in the interval [0, 10].
f(x) = (sin (x)/x, x 6= 0
1, x = 0.
Note that in your program, you should not test a floating point to see if it is exactly 0, due to
contamination by rounding errors. Instead, write the function f(x) as
f(x) = (
sin (x)/x, abs(x) > 1e ? 12
1, else.
(a) Use three methods: fzero provided in Matlab; the secant.m function and the newton.m
function you write yourself. Use the same convergence criterion. By changing the initial guesses,
you can converge to different roots in the interval [0, 10] (Note: the roots should be π, 2π, 3π).
(b) Create a table showing for each method, (1) the initial guess(es) used, (2) each root found,
and (3) the number of iteration taken to find the root.
5. (15 points) One way to compute a multiple root x
of a smooth nonlinear function f(x)
using Newton’s method is to consider the function f(x)/f0
(x).
(a) Show that the function f(x)/f0
(x) has a simple root at x
(b) Show that the Newton iteration yields
xk+1 = xk
(c) Write a Matlab program implementing this iteration, and use it to compute the multiple root
of f(x) = (x ? 1)2ex. Try different initial guesses, 0, 2, 3 and report the number of iterations your
method takes and the root that it finds. Explain what you observe.
26. (10 points) What are the absolute and relative condition numbers of the following functions?
Where are they ill-conditioned? The problem is taken from the textbook, Chapter 6, Problem 1.
(a) (x ? 1)α
(b) 1/(1 + x1)
(c) ln (x)
(d) x1ex
(e) arcsin (x)
7. (10 points) Use the fact that π = 4 * arctan(1) to approximate π out to the x
19-term. What is
the absolute error of this approximation? The relative error? If you carry out this approximation
for many terms you should see that it slowly but surely converges to π. Explain why the rate of
convergence is slow in this instance where x = 1.


联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!