Compute the absolute value of a number
y = abs(x)
The abs
function returns the absolute value of an arithmetic
type. If its argument is a complex number (Complex_Type
),
then it returns the modulus. If the argument is an array, a new
array will be created whose elements are obtained from the original
array by using the abs
function.
sign, sqr
Compute the arc-cosine of a number
y = acos (x)
The acos
function computes the arc-cosine of a number and
returns the result. If its argument is an array, the
acos
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the inverse cosh of a number
y = acosh (x)
The acosh
function computes the inverse hyperbolic cosine of a number and
returns the result. If its argument is an array, the
acosh
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the arc-sine of a number
y = asin (x)
The asin
function computes the arc-sine of a number and
returns the result. If its argument is an array, the
asin
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the inverse-sinh of a number
y = asinh (x)
The asinh
function computes the inverse hyperbolic sine of a number and
returns the result. If its argument is an array, the
asinh
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the arc-tangent of a number
y = atan (x)
The atan
function computes the arc-tangent of a number and
returns the result. If its argument is an array, the
atan
function will be applied to each element and the result returned
as an array.
atan2, cos, acosh, cosh
Compute the arc-tangent of the ratio of two variables
z = atan2 (y, x)
The atan2
function computes the arc-tangent of the ratio
y/x
and returns the result as a value that has the
proper sign for the quadrant where the point (x,y) is located. The
returned value z
will satisfy (-PI < z <= PI). If either of the
arguments is an array, an array of the corresponding values will be returned.
hypot, cos, atan, acosh, cosh
Compute the inverse-tanh of a number
y = atanh (x)
The atanh
function computes the inverse hyperbolic tangent of a number and
returns the result. If its argument is an array, the
atanh
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Round x up to the nearest integral value
y = ceil (x)
This function rounds its numeric argument up to the nearest integral value. If the argument is an array, the corresponding array will be returned.
floor, round
Compute the complex conjugate of a number
z1 = Conj (z)
The Conj
function returns the complex conjugate of a number.
If its argument is an array, the Conj
function will be applied to each
element and the result returned as an array.
Real, Imag, abs
Compute the cosine of a number
y = cos (x)
The cos
function computes the cosine of a number and
returns the result. If its argument is an array, the
cos
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the hyperbolic cosine of a number
y = cosh (x)
The cosh
function computes the hyperbolic cosine of a number and
returns the result. If its argument is an array, the
cosh
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the absolute difference between two values
y = _diff (x, y)
The _diff
function returns a floating point number equal to
the absolute value of the difference between its two arguments.
If either argument is an array, an array of the corresponding values
will be returned.
abs
Compute the exponential of a number
y = exp (x)
The exp
function computes the exponential of a number and
returns the result. If its argument is an array, the
exp
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Round x down to the nearest integer
y = floor (x)
This function rounds its numeric argument down to the nearest integral value. If the argument is an array, the corresponding array will be returned.
ceil, round
Compute sqrt(x^2+y^2)
r = hypot (x, y)
The hypot
function computes the quantity sqrt(x^2+y^2)
except that it employs an algorithm that tries to avoid arithmetic
overflow when x
or y
are large. If either argument is
an array, an array of the corresponding values will be returned.
atan2, cos, atan, acosh, cosh
Compute the imaginary part of a number
i = Imag (z)
The Imag
function returns the imaginary part of a number.
If its argument is an array, the Imag
function will be applied to each
element and the result returned as an array.
Real, Conj, abs
Test for infinity
y = isinf (x)
This function returns 1 if x corresponds to an IEEE infinity, or 0 otherwise. If the argument is an array, an array of the corresponding values will be returned.
isnan, _Inf
isnan
y = isnan (x)
This function returns 1 if x corresponds to an IEEE NaN (Not a Number), or 0 otherwise. If the argument is an array, an array of the corresponding values will be returned.
isinf, _NaN
Compute the logarithm of a number
y = log (x)
The log
function computes the natural logarithm of a number and
returns the result. If its argument is an array, the
log
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the base-10 logarithm of a number
y = log10 (x)
The log10
function computes the base-10 logarithm of a number and
returns the result. If its argument is an array, the
log10
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the maximum of two values
z = _max (x,y)
The _max
function returns a floating point number equal to the
maximum value of its two arguments.
If either argument is an array, an array of the corresponding values
will be returned.
This function returns a floating point result even when both arguments are integers.
max, _min, min
Compute the minimum of two values
z = _min (x,y)
The _min
function returns a floating point number equal to the
minimum value of its two arguments.
If either argument is an array, an array of the corresponding values
will be returned.
This function returns a floating point result even when both arguments are integers.
min, _max, max
Multiply a number by 2
y = mul2(x)
The mul2
function multiplies an arithmetic type by two and
returns the result. If its argument is an array, a new array will
be created whose elements are obtained from the original array by
using the mul2
function.
sqr, abs
Evaluate a polynomial
Double_Type polynom(Double_Type a, b, ...c, Integer_Type n, Double_Type x)
The polynom
function returns the value of the polynomial expression:
ax^n + bx^(n - 1) + ... c
The polynom
function should be extended to work with complex
and array data types. The current implementation is limited to
Double_Type
quantities.
exp
Compute the real part of a number
r = Real (z)
The Real
function returns the real part of a number. If its
argument is an array, the Real
function will be applied to
each element and the result returned as an array.
Imag, Conj, abs
Round to the nearest integral value
y = round (x)
This function rounds its argument to the nearest integral value and returns it as a floating point result. If the argument is an array, an array of the corresponding values will be returned.
floor, ceil
Set the format for printing floating point values.
set_float_format (String_Type fmt)
The set_float_format
function is used to set the floating
point format to be used when floating point numbers are printed.
The routines that use this are the traceback routines and the
string
function, any anything based upon the string
function. The default value is "%g"
s = string (PI); % --> s = "3.14159"
set_float_format ("%16.10f");
s = string (PI); % --> s = "3.1415926536"
set_float_format ("%10.6e");
s = string (PI); % --> s = "3.141593e+00"
string, sprintf, double
Compute the sign of a number
y = sign(x)
The sign
function returns the sign of an arithmetic type. If
its argument is a complex number (Complex_Type
), the
sign
will be applied to the imaginary part of the number. If
the argument is an array, a new array will be created whose elements
are obtained from the original array by using the sign
function.
When applied to a real number or an integer, the sign
function
returns -1
, 0
, or +1
according to whether the number is
less than zero, equal to zero, or greater than zero, respectively.
abs
Compute the sine of a number
y = sin (x)
The sin
function computes the sine of a number and
returns the result. If its argument is an array, the
sin
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the hyperbolic sine of a number
y = sinh (x)
The sinh
function computes the hyperbolic sine of a number and
returns the result. If its argument is an array, the
sinh
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the square of a number
y = sqr(x)
The sqr
function returns the square of an arithmetic type. If its
argument is a complex number (Complex_Type
), then it returns
the square of the modulus. If the argument is an array, a new array
will be created whose elements are obtained from the original array
by using the sqr
function.
For real scalar numbers, using x*x
instead of sqr(x)
will result in faster executing code. However, if x
is an
array, then sqr(x)
will execute faster.
abs, mul2
Compute the square root of a number
y = sqrt (x)
The sqrt
function computes the square root of a number and
returns the result. If its argument is an array, the
sqrt
function will be applied to each element and the result returned
as an array.
sqr, cos, atan, acosh, cosh
Compute the tangent of a number
y = tan (x)
The tan
function computes the tangent of a number and
returns the result. If its argument is an array, the
tan
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh
Compute the hyperbolic tangent of a number
y = tanh (x)
The tanh
function computes the hyperbolic tangent of a number and
returns the result. If its argument is an array, the
tanh
function will be applied to each element and the result returned
as an array.
cos, atan, acosh, cosh