Attachment 'math_R_v1.htm'
DownloadMath_R Library
This library includes the definition of 25 external builtin predicates for the execution of mathematical calculations in the field of the Real numbers. As real numbers are not yet available in the DLV System, we use text strings to represent numbers having as C++ type the double data type.
DESCRIPTION 

Compute the addition number1+number2. 

Compute the subtraction number1number2. 

Compute the division number1/number2. 

Compute the multiplication number1*number2. 

Compute the remainder of the division number1/number2. 

Compute the result of base power to the exponent. 

Compute the result of (Naperian) e power to the exponent. 

Compute the logarithm of number to the given base. 

Compute the logarithm of number to base 10. 

Compute the logarithm of number to base 2. 

Compute the natural (Naperian) logarithm of number. 

Compute the nth root of number (where n is equal to index) . 

Compute the square root of number. 

Round number to the specified number of digit (precision). 

Compute the absolute value of number. 

Compute the smallest integer greater than number. 

Compute the greatest integer less than number. 

Compute the trigonometric function sine of the angle (measured in radians). 

Compute the trigonometric function cosine of the angle (measured in radians). 

Compute the trigonometric function tangent of the angle (measured in radians). 

Compute the trigonometric function arcsine of the sine value. 

Compute the trigonometric function arccosine of the cosine value. 

Compute the trigonometric function arctangent of the tangent value. 

Convert the measure of an angle from degrees to radians. 

Convert the measure of an angle from radians to degrees. 
#addR 
It computes the addition between two numbers.
Syntax
#addR(number1, number2, result)
number1 is the first number to sum
number2 is the second number to sum
result is the resulting sum
Available Patterns
iii (number1, number2, result) : Returns true if result is equal to number1 + number2
iio (number1, number2, Result) : Set Result to number1 + number2
ioi (number1, Number2, result) : Set Number2 to the result of result number1
oii (Number1, number2, result) : Set Number1 to the result of result number2
Notes
Returns false if one of the arguments is not a string.
See also
#subtR 
It computes the subtraction between two numbers.
Syntax
#subtR(number1, number2, result)
number1 is the first operand of the subtraction
number2 is the second operand of the subtraction
result is the result of the subtraction
Available Patterns
iii (number1, number2, result) : Returns true if result is equal to number1 number2
iio (number1, number2, Result) : Set Result to number1 number2
ioi (number1, Number2, result) : Set Number2 to number1 result
oii (Number1, number2, result) : Set Number1 to result + number2
Notes
Returns false if one of the arguments is not a string.
See also
#divR 
It computes the division between two numbers.
Syntax
#divR(number1, number2, result)
number1 is the first operand of the division
number2 is the second operand (different from zero) of the division
result is the result of the division
Available Patterns
iii (number1, number2, result) : Returns true if result is equal to number1 / number2
iio (number1, number2, Result) : Set Result to the result of number1 / number2
Notes
Returns false if either one of the arguments is not a string or number2 is zero.
See also
#timesR 
It computes the multiplication between two numbers.
Syntax
#timesR(number1, number2, result)
number1 is the first operand of the multiplication
number2 is the second operand of the multiplication
result is the result of the multiplication
Available Patterns
iii (number1, number2, result) : Returns true if result is equal to number1 * number2
iio (number1, number2, Result) : Set Result to number1 * number2
Notes
Returns false if one of the arguments is not a string.
See also
#modR 
It computes the remainder of the division between two numbers.
Syntax
#modR(number1, number2, result)
number1 is the first operand of the division
number2 is the second operand (different from zero) of the division
result is the remainder of number1 divided by number2
Available Patterns
iii (number1, number2, result) : Returns true if result is equal to the remainder of number1 / number2
iio (number1, number2, Result) : Set Result to the remainder of number1 / number2
Notes
Returns false if either one of the arguments is not a string or number2 is zero.
See also
#pow 
It raises a number to a given power.
Syntax
#pow(base, exponent, result)
base is the number to be raised to a power
exponent is the power to apply
result is the base raised to the exponent
Available Patterns
iii (base, exponent, result) : Returns true if result is equal to base ^ exponent
iio (base, exponent, Result) : Set Result to base ^ exponent
Notes
Returns false if either one of the arguments is not a string or base and exponent are zero.
See also
#exp 
It computes the result of e power to a given exponent. The constant e is equal to 2,71828182845904, the base of the natural logarithm.
Syntax
#exp(exponent, result)
exponent is the power to apply
result is e raised to the exponent
Available Patterns
ii (exponent, result) : Returns true if result is equal to e ^ exponent
io (exponent, Result) : Set Result to e ^ exponent
Notes
Returns false if one of the arguments is not a string.
See also
#log 
It computes the logarithm of a number to a given base.
Syntax
#log(base, number, result)
base is the base for the logarithm
number is the value we want to know the logarithm
result is the resulting value
Available Patterns
iii (base, number, result) : Returns true if result is the logarithm of number to the given base
iio (base, number, Result) : Set Result to the logarithm of number to the given base
Notes
Returns false if either one of the arguments is not a string or base is equal to one.
See also
#log10 
It computes the logarithm of a number to base 10.
Syntax
#log10(number, result)
number is the value we want to know the logarithm to base 10
result is the resulting value
Available Patterns
ii (number, result) : Returns true if result is the logarithm of number to base 10
io (number, Result) : Set Result to the logarithm of number to base 10
Notes
Returns false if one of the arguments is not a string.
See also
#log2 
It computes the logarithm of a number to base 2.
Syntax
#log2(number, result)
number is the value we want to know the logarithm to base 2
result is the resulting value
Available Patterns
ii (number, result) : Returns true if result is the logarithm of number to base 2
io (number, Result) : Set Result to the logarithm of number to base 2
Notes
Returns false if one of the arguments is not a string.
See also
#ln 
It computes the natural (Napierian) logarithm of a number.
Syntax
#ln(number, result)
number is the value we want to know the natural logarithm
result is the resulting value
Available Patterns
ii (number, result) : Returns true if result is the natural logarithm of number
io (number, Result) : Set Result to the natural logarithm of number
Notes
Returns false if either one of the arguments is not a natural number or the result is a negative number.
See also
#root 
It computes the nth radix of a number (where n is equal to a given index).
Syntax
#root (index, number, result)
index is the root index
number is the value we want to know the root
result is the resulting value
Available Patterns
iii (index, number, result) : Returns true if result is the nth root of number (where n is equal to index)
iio (index, number, Result) : Set Result to the nth root of number (where n is equal to index)
Notes
Returns false if either one of the arguments is not a string or index is zero or index is even and number is negative.
See also
#sqrt 
It computes the square root of a number.
Syntax
#sqrt (number, result)
number is the value we want to know the square root
result is the resulting value
Available Patterns
ii (number, result) : Returns true if result is the square root of number
io (number, Result) : Set Result to the square root of number
Notes
Returns false if either one of the arguments is not a string or number is negative.
See also
#round 
It rounds a number to the specified number of digit (precision).
Syntax
#round (number, precision, result)
number is the value to be rounded
precision is the number of digits we want
result is the rounded value
Available Patterns
iii (number, precision, result) : Returns true if result is the number rounded to the specified precision
iio (number, precision, Result) : Set Result to the number rounded to the specified precision
Notes
Returns false if either one of the arguments is not a string or precision is not an integer number.
See also
#fabs 
It computes the absolute value of a number.
Syntax
#fabs (number, result)
number is the object we want the absolute value
result is the absolute value of number
Available Patterns
ii (number, result) : Returns true if result is the absolute value of number
io (number, Result) : Set Result to the absolute value of number
Notes
Returns false if one of the arguments is not a string.
See also
#ceil 
It computes the smallest integer greater than a given number.
Syntax
#ceil (number, result)
number is the value to be ceiled
result is the smallest integer greater than number
Available Patterns
ii (number, result) : Returns true if result is the smallest integer greater than number
io (number, Result) : Set Result to the smallest integer greater than number
Notes
Returns false if either number is not a string or result is not an integer number.
See also
#floor 
It computes the greatest integer less than a given number.
Syntax
#floor (number, result)
number is the value to be floored
result is the greatest integer less than number
Available Patterns
ii (number, result) : Returns true if result is the greatest integer less than number
io (number, Result) : Set Result to the greatest integer less than number
Notes
Returns false if either number is not a string or result is not an integer number.
See also
#sin 
It computes the trigonometric function sine.
Syntax
#sin (angle, result)
angle is the value we want to know the sine (measured in radians)
result is the sine of angle
Available Patterns
ii (angle, result) : Returns true if result is the sine of angle
io (angle, Result) : Set Result to the sine of angle
Notes
Returns false if one of the arguments is not a string.
See also
#cos, #tan, #asin, #rad2deg, #deg2rad
#cos 
It computes the trigonometric function cosine.
Syntax
#cos (angle, result)
angle is the value we want to know the cosine (measured in radians)
result is the cosine of angle
Available Patterns
ii (angle, result) : Returns true if result is the cosine of angle
io (angle, Result) : Set Result to the cosine of angle
Notes
Returns false if one of the arguments is not a string.
See also
#sin, #tan, #acos, #rad2deg, #deg2rad
#tan 
It computes the trigonometric function tangent.
Syntax
#tan (angle, result)
angle is the value we want to know the tangent (measured in radians)
result is the tangent of angle
Available Patterns
ii (angle, result) : Returns true if result is the tangent of angle
io (angle, Result) : Set Result to the tangent of angle
Notes
Returns false if one of the arguments is not a string.
See also
#sin, #cos, #atan, #rad2deg, #deg2rad
#asin 
It computes the trigonometric function arcsine.
Syntax
#asin (sine, result)
sine is the value of the sine we want to know the angle
result is the angle having as sine the value sine
Available Patterns
ii (sine, result) : Returns true if result is the arcsine of sine
io (sine, Result) : Set Result to the arcsine of sine
Notes
Returns false if one of the arguments is not a string.
See also
#sin, #acos, #atan, #rad2deg, #deg2rad
#acos 
It computes the trigonometric function arccosine.
Syntax
#acos (cosine, result)
cosine is the value of the cosine we want to know the angle
result is the angle having as cosine the value cosine
Available Patterns
ii (cosine, result) : Returns true if result is the arccosine of cosine
io (cosine, Result) : Set Result to the arccosine of cosine
Notes
Returns false if one of the arguments is not a string.
See also
#cos, #asin, #atan, #rad2deg, #deg2rad
#atan 
It computes the trigonometric function arctangent.
Syntax
#atan (tangent, result)
tangent is the value of the tangent we want to know the angle
result is the angle having as tangent the value tangent
Available Patterns
ii (tangent, result) : Returns true if result is the arctangent of tangent
io (tangent, Result) : Set Result to the arctangent of tangent
Notes
Returns false if one of the arguments is not a string.
See also
#tan, #asin, #acos, #rad2deg, #deg2rad
#deg2rad 
It converts the measure of an angle from degrees to radians.
Syntax
#deg2rad (degrees, result)
degrees is the measure of an angle in degrees
result is the corresponding value in radians
Available Patterns
ii (degrees, result) : Returns true if result is the measure in radians of degrees
io (degrees, Result) : Set Result to the measure in radians of degrees
Notes
Returns false if one of the arguments is not a string.
See also
# rad2deg 
It converts the measure of an angle from radians to degrees.
Syntax
# rad2deg (radians, result)
radians is the measure of an angle in radians
result is the corresponding value in degrees
Available Patterns
ii (radians, result) : Returns true if result is the measure in degrees of radians
io (radians, Result) : Set Result to the measure in degrees of radians
Notes
Returns false if one of the arguments is not a string.
See also
Attached Files
You are not allowed to attach a file to this page.