Next: , Previous: , Up: Mathematical Packages   [Contents][Index]

5.4 Irrational Real Functions

(require 'math-real)

Although this package defines real and complex functions, it is safe to load into an integer-only implementation; those functions will be defined to #f.

Function: real-exp x
Function: real-ln x
Function: real-log y x
Function: real-sin x
Function: real-cos x
Function: real-tan x
Function: real-asin x
Function: real-acos x
Function: real-atan x
Function: atan y x

These procedures are part of every implementation that supports general real numbers; they compute the usual transcendental functions. ‘real-ln’ computes the natural logarithm of x; ‘real-log’ computes the logarithm of x base y, which is (/ (real-ln x) (real-ln y)). If arguments x and y are not both real; or if the correct result would not be real, then these procedures signal an error.

Function: real-sqrt x

For non-negative real x the result will be its positive square root; otherwise an error will be signaled.

Function: real-expt x1 x2

Returns x1 raised to the power x2 if that result is a real number; otherwise signals an error.

(real-expt 0.0 x2)

  • returns 1.0 for x2 equal to 0.0;
  • returns 0.0 for positive real x2;
  • signals an error otherwise.
Function: quo x1 x2
Function: rem x1 x2
Function: mod x1 x2

x2 should be non-zero.

    (quo x1 x2)                     ==> n_q
    (rem x1 x2)                     ==> x_r
    (mod x1 x2)                     ==> x_m

where n_q is x1/x2 rounded towards zero, 0 < |x_r| < |x2|, 0 < |x_m| < |x2|, x_r and x_m differ from x1 by a multiple of x2, x_r has the same sign as x1, and x_m has the same sign as x2.

From this we can conclude that for x2 not equal to 0,

     (= x1 (+ (* x2 (quo x1 x2))
           (rem x1 x2)))
                                       ==>  #t

provided all numbers involved in that computation are exact.

    (quo 2/3 1/5)                         ==>  3
    (mod 2/3 1/5)                         ==>  1/15

    (quo .666 1/5)                        ==>  3.0
    (mod .666 1/5)                        ==>  65.99999999999995e-3
Function: ln z

These procedures are part of every implementation that supports general real numbers. ‘Ln’ computes the natural logarithm of z

In general, the mathematical function ln is multiply defined. The value of ln z is defined to be the one whose imaginary part lies in the range from -pi (exclusive) to pi (inclusive).

Function: abs x

For real argument x, ‘Abs’ returns the absolute value of x’ otherwise it signals an error.

(abs -7)                               ==>  7

Function: make-rectangular x1 x2
Function: make-polar x3 x4

These procedures are part of every implementation that supports general complex numbers. Suppose x1, x2, x3, and x4 are real numbers and z is a complex number such that

z = x1 + x2i = x3 . e^i x4

Then

(make-rectangular x1 x2)               ==> z
(make-polar x3 x4)                     ==> z

where -pi < x_angle <= pi with x_angle = x4 + 2pi n for some integer n.

If an argument is not real, then these procedures signal an error.


Next: , Previous: , Up: Mathematical Packages   [Contents][Index]