Numerics and floating point
The part of the course that is the reason many readers are here. The IEEE modules expose the flags and the rounding mode, and ieee_value produces the NaN and the infinity that spread through a calculation. Comparing two reals takes a tolerance, and the random numbers take a seed. The rest is numerical method: integration, root finding, a linear system solved by elimination, a statistics module, and a report the method writes.
9.1
The IEEE modules
IEEE_ARITHMETIC, IEEE_EXCEPTIONS, IEEE_FEATURES, the flags and the rounding mode
Open
9.2
NaN, infinity and IEEE values
ieee_value, ieee_is_nan, ieee_is_finite, a NaN that spreads, and a comparison with it
Open
9.3
Comparing floating-point numbers
equality of reals, an absolute and a relative tolerance, epsilon and a test that passes
Open
9.4
Random numbers and seeding
RANDOM_SEED, RANDOM_NUMBER, a seed from the clock, and the same sequence twice
Open
9.5
Numerical integration
a trapezoid rule, Simpson's rule, the error that falls with n, and a measured convergence
Open
9.6
Root finding: bisection and Newton
bisection, its convergence, Newton and the derivative, and a tolerance loop
Open
9.7
Linear systems by hand
Gaussian elimination with partial pivoting, back substitution, and a residual check
Open
9.8
A statistics module
mean, variance, standard deviation and a least-squares line in a module with a test
Open
9.9
A numerical report with a table
a formatted table of results, alignment with the edit descriptors, and a header that repeats
Open