User:Phlsph7/Rational arithmetic

Rational arithmetic is the branch of arithmetic that deals with the manipulation of numbers that can be expressed as a ratio of two integers. The set of rational numbers is represented by the symbol Q and includes fractions like $$\tfrac{1}{2}$$, $$\tfrac{11}{3}$$, and $$- \tfrac{3}{7}$$ as well as regular integers like -3 and 14.

Most arithmetic operations on rational numbers can be calculated by performing a series of integer arithmetic operations on the numerators and the denominators of the involved numbers. If two rational numbers have the same denominator then they can be added by adding their numerators and keeping the common denominator. For example, $$\tfrac{2}{7} + \tfrac{3}{7} = \tfrac{5}{7}$$. A similar procedure is used for subtraction. If the two numbers do not have the same denominator then they must be transformed to find a common denominator. This can be achieved by scaling the first number with the denominator of the second number while scaling the second number with the denominator of the first number. For example, $$\tfrac{1}{3} + \tfrac{1}{2} = \tfrac{1 \cdot 2}{3 \cdot 2} + \tfrac{1 \cdot 3}{2 \cdot 3} = \tfrac{2}{6} + \tfrac{3}{6} = \tfrac{5}{6}$$.

Two rational numbers are multiplied by multiplying their numerators and their denominators respectively, as in $$\tfrac{2}{3} \cdot \tfrac{2}{5} = \tfrac{2 \cdot 2}{3 \cdot 5} = \tfrac{4}{15}$$. Dividing one rational number by another can be achieved by multiplying the first number with the reciprocal of the second number. This means that the numerator and the denominator of the second number change position. For example, $$\tfrac{3}{5} : \tfrac{2}{7} = \tfrac{3}{5} \cdot \tfrac{7}{2} = \tfrac{21}{10}$$. Unlike integer arithmetic, rational arithmetic is closed under division except if the divisor is not 0.

Both integer arithmetic and rational arithmetic are not closed under exponentiation and logarithm. One way to calculate exponentiation with a fractional exponent is to perform two separate calculations: one exponentiation using the numerator of the exponent followed by drawing the nth root of the result based on the denominator of the exponent. For example, $$5^\tfrac{2}{3} = \sqrt[3]{5^2}$$. The first operation can be completed using methods like repeated multiplication or exponentiation by squaring. One way to get an approximate result for the second operation is to employ Newton's method, which uses a series of steps to gradually refine an initial guess until it reaches the desired level of accuracy. The Taylor series or the continued fraction method can be used to calculate logarithms.

The decimal fraction notation is a special way of representing rational numbers whose denominator is a power of 10. For example, the rational numbers $$\tfrac{1}{10}$$, $$\tfrac{371}{100}$$, and $$\tfrac{44}{10000}$$ are written as 0.1, 3.71, and 0.0044 in the decimal fraction notation. Modified versions of integer calculation methods like addition with carry and long multiplication can be applied to calculations with decimal fractions. Not all rational numbers have an exact finite representation in the decimal notation. For example, the rational number $$\tfrac{1}{3}$$ corresponds 0.333... with an infinite number of 3s. The shortened notation for this type of repeating decimal is 0.$\overline{3}$. Every repeating decimal expresses a rational number.