Scheme's arithmetic functions are extended slightly, to include some operations common in computer vision and geometrical algorithms.
Notice that various special restrictions on numerical types and operations apply within user-defined coprocessor functions. For example, the function = cannot be applied to inexact numbers or points.
Many functions can return a missing value if a numerical, boolean, or point value is unavailable.
Also, certain standard mathematical functions are only partial, i.e. not defined for some possible input values. These functions return a missing value for the bad inputs, rather than triggering an error break. Examples include atan (binary version only), log, sqrt, asin, acos, random-real, expt, /, remainder, quotient, and modulo.
The function (random-real x y) takes two real inputs x and y, and returns a randomly generated real number in the range [x,y). This generator is randomly initialized.
The symbol pi is bound to the well-known constant.
The following operations are required for manipulating images whose values are bit-vectors, such as certain edge maps. The function names follow those in Scheme48's "big scheme."
The functions +, -, *, =, round, exact?, inexact?, inexact->exact, exact->inexact, zero?, integer? and real? can be applied to points of any dimension, not just numbers. The usual numerical operation is applied component-wise. One (but not more than one) of the inputs to * can be a point of dimension larger than 1. The first input to / can be a point of dimension larger than 1.
The following modular arithmetic operations are added (integer inputs only):
Even-quotient returns a missing value if the first input is not an even multiple of the second.
Also, the following vector operations are added
The usual rules of floating point contagion apply.
Notice that vector-magnitude is the same as abs when applied to a 1D point (number). Similarly, the dot-product of two numbers is their product.
It may seem tempting to generalize modular arithmetic operations (quotient, remainder, modulo) to vectors. However, it is not clear how to define their output when the remainder has both negative and positive components. Similar difficulties apply to negative? and positive?. These problems result from the fundamental fact that there is one obvious ordering on the real numbers (up to sign) but multiple reasonable ways to order points in 2D and 3D.
Ownership, Maintenance and Disclaimers
Manual Top Page