next up previous contents
Next: 6.5 Loops Up: 6. FORTRAN style interpreter Previous: 6.3 Logical expressions

   
6.4 Intrinsic functions

Several intrinsic functions are defined. Each function is referenced, as in FORTRAN, by its name immediately followed by a pair of parentheses ( and ) that include the list of arguments. Trigonometric and arithmetic functions are listed in Table 6.2. Table 6.3 contains various random number generating functions.


 
Table 6.2: Trigonometric and arithmetic functions
Type Name Description
real sin(r) cos(r) tan(r) Sine, cosine and tangent of <r> in radian
real sind(r) cosd(r) tand(r) Sine, cosine and tangent of <r> in degrees
real asin(r) acos(r) atan(r) Arc sin, cosine, tangent of <r>, result in radian
real asind(r) acosd(r) atand(r) Arc sin, cosine, tangent of <r>, result in degrees
real sqrt(r) Square root of <r>
real exp(r) Exponential of <r>, base e
real ln(r) Logarithm of <r>
real sinh(r) cosh(r) tanh(r) Hyperbolic sine, cosine and tangent of <r>
real abs(r) Absolute value of <r>
integer mod(r1, r2) Modulo <r1> of <r2>
integer int(r) Convert <r> to integer
integer nint(r) Convert <r> to nearest integer
real frac(r) Returns fractional part of <r>


 
Table 6.3: Random number functions
Type Name Description
real ran(r) Uniformly distributed pseudo random number between 0.0 and 1.0. Argument <r> is a dummy
real gran(r1, typ) Gaussian distributed random number with mean 0 and a width given by <r1>. If <typ> is "s" <r1> is taken as sigma, if <typ> is "f" <r1> is taken as FWHM.
real gbox(r1, r2, r3) Returns pseudo random number with distribution given by a box centered at 0 with a width of <r2> and two half Gaussian distributions with individual sigmas of <r1> and <r3> to the left and right, respectively.


next up previous contents
Next: 6.5 Loops Up: 6. FORTRAN style interpreter Previous: 6.3 Logical expressions
Thomas Proffen {Billinge}
1999-06-26