CHAPTER 3

image

Real and Complex Numbers

3.1 Rational Numbers

A rational number is a number of the form p/q, where p and q are integers. That is, the rational numbers are those numbers that can be represented as the quotient of two integers. The way in which MATLAB treats rational numbers is different from the majority of calculators.

If we ask a calculator to calculate the sum 2/4 + 24/144, most will return something like 0.6666667, which is no more than an approximation of the result.

MATLAB can work with rational numbers in exact mode, so the result of arithmetic expressions involving rational numbers is always another rational number. To this end, ...

Get MATLAB Numerical Calculations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.