0% found this document useful (0 votes)
51 views2 pages

Lab 0. Preliminary: 1 Instructions

This document provides instructions for Lab 0 on numerical analysis. It outlines 3 key points: 1. Students should create a PDF report with solutions to the practice problems and submit all files in a compressed folder to Moodle. 2. The purposes of the lab are to apply floating point formatting and rounding arithmetic, and implement these concepts in Matlab. 3. The practice problems involve: calculating sums using 3-digit rounding, deriving an alternative formula for the quadratic equation, and creating Matlab functions to determine floating point formatting and accurately compute quadratic roots.

Uploaded by

Kevin Morales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views2 pages

Lab 0. Preliminary: 1 Instructions

This document provides instructions for Lab 0 on numerical analysis. It outlines 3 key points: 1. Students should create a PDF report with solutions to the practice problems and submit all files in a compressed folder to Moodle. 2. The purposes of the lab are to apply floating point formatting and rounding arithmetic, and implement these concepts in Matlab. 3. The practice problems involve: calculating sums using 3-digit rounding, deriving an alternative formula for the quadratic equation, and creating Matlab functions to determine floating point formatting and accurately compute quadratic roots.

Uploaded by

Kevin Morales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Universidad Industrial de Santander, Colombia

Numerical Analysis, 2020-1


Henry Arguello
October 28, 2020

Lab 0. Preliminary

1 Instructions
ˆ Make a pdf report including the solution to each point of the practice with name
Lab0 name lastname.pdf.
ˆ Send the report and all created files in a rar or zip file with name Lab0 name lastname.rar in
the Moodle.

ˆ You are allowed to use internet, notes, and .m files that you have created before.

2 Purposes
ˆ To apply the floating point format and rounding arithmetic.

ˆ To implement the floating point format and rounding arithmetic in Matlab.

3 Practice
3.1 Applying
ˆ (0.5 points) Use three-digit rounding arithmetic to compute the following sums:
P6 1
a) k=1 3k
P6 1
b) k=1 37−k

ˆ (1.0 points) Improving the Quadratic Formula. Assume that a 6= 0 and b2 − 4ac > 0 and
consider the equation ax2 + bx + c = 0. The roots can be computed with the quadratic
formulas √ √
−b + b2 − 4ac −b − b2 − 4ac
x1 = , x2 = . (1)
2a 2a
Show that these roots can be calculated with the equivalent formulas
−2c −2c
x1 = √ , x2 = √ . (2)
2
b + b − 4ac b − b2 − 4ac

Hint. Rationalize the numerators in (1). Remark. In the cases when |b| ≈ b2 − 4ac, one
must proceed with caution to avoid loss of precision due to a catastrophic cancellation. If
b > 0, then x1 should be computed with formula (2), and x2 should be computed using (1).
However, if b < 0, then x1 should be computed using (1), and x2 should be computed using
(2).

1
3.2 Implementing
ˆ (2.0 points) Create a Matlab function called floating point function name lastname() to de-
termine the floating point format to stored decimal numbers in a computer with 32 bits of
precision. Use the following numbers to test your function:

a) 1612.07812510
b) 6317.913610
c) −962.015310

ˆ (1.5 points) Use the results obtained in Improving the Quadratic Formula to construct a Matlab
program that will accurately compute the√roots of a quadratic equation in all situations,
including the troublesome ones when |b| ≈ b2 − 4ac.

You might also like