==================================================================== Fraction ==================================================================== The Fraction domain implements quotients. The elements must belong to a domain of category IntegralDomain: multiplication must be commutative and the product of two non-zero elements must not be zero. This allows you to make fractions of most things you would think of, but don't expect to create a fraction of two matrices! The abbreviation for Fraction is FRAC. Use / to create a fraction. :: a := 11/12 11 -- 12 Type: Fraction Integer b := 23/24 23 -- 24 Type: Fraction Integer The standard arithmetic operations are available. :: 3 - a*b**2 + a + b/a 313271 ------ 76032 Type: Fraction Integer Extract the numerator and denominator by using numer and denom, respectively. :: numer(a) 11 Type: PositiveInteger denom(b) 24 Type: PositiveInteger Operations like max, min, negative?, positive? and zero? are all available if they are provided for the numerators and denominators. Don't expect a useful answer from factor, gcd or lcm if you apply them to fractions. :: r := (x**2 + 2*x + 1)/(x**2 - 2*x + 1) 2 x + 2x + 1 ----------- 2 x - 2x + 1 Type: Fraction Polynomial Integer Since all non-zero fractions are invertible, these operations have trivial definitions. :: factor(r) 2 x + 2x + 1 ----------- 2 x - 2x + 1 Type: Factored Fraction Polynomial Integer Use map to apply factor to the numerator and denominator, which is probably what you mean. :: map(factor,r) 2 (x + 1) -------- 2 (x - 1) Type: Fraction Factored Polynomial Integer Other forms of fractions are available. Use continuedFraction to create a continued fraction. :: continuedFraction(7/12) 1 | 1 | 1 | 1 | +---+ + +---+ + +---+ + +---+ | 1 | 1 | 2 | 2 Type: ContinuedFraction Integer Use partialFraction to create a partial fraction. :: partialFraction(7,12) 3 1 1 - -- + - 2 3 2 Type: PartialFraction Integer Use conversion to create alternative views of fractions with objects moved in and out of the numerator and denominator. :: g := 2/3 + 4/5*%i 2 4 - + - %i 3 5 Type: Complex Fraction Integer g :: FRAC COMPLEX INT 10 + 12%i --------- 15 Type: Fraction Complex Integer See Also: * ``)help ContinuedFraction`` * ``)help PartialFraction`` * ``)help Integer`` * ``)show Fraction``