Attachment 'math_N_v1.htm'
DownloadMath_N Library
This library includes the definition of 23 external builtin predicates for the execution of mathematical calculations in the field of the Natural numbers. All the predicates in the library have as suffix Nat.
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 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 (Napierian) logarithm of number. 

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

Compute the square root of number. 

Compute the greatest common divisor for number1 and number2. 

Compute the least common multiple for number1 and number2. 

Compute the factorial of number . 

Convert the text string_num, representing a natural number, into the corresponding number. 

Convert the natural number into the corresponding text string_num. 

Convert the text string_bin, representing a binary number, into the corresponding decimal number. 

Convert the decimal number into the text stringa_bin representing the corresponding binary value. 

Return true if number is even. 

Return true if number is odd. 

Compute the number of combinations or groupings of number1 things taken number2 at a time. 

Compute the number of permutations or arrangements of number1 things taken number2 at a time. 
#addNat 
It computes the addition between two numbers.
Syntax
#addNat(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 either one of the arguments is not a natural number or the result is greater than the maximum allowed integer number.
See also
#subNat 
It computes the subtraction between two numbers.
Syntax
#subNat(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 either one of the arguments is not a natural number or number1 is less than number2 .
See also
#divNat 
It computes the division between two numbers.
Syntax
#divNat(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 natural number or number2 is zero.
See also
#multNat 
It computes the multiplication between two numbers.
Syntax
#multNat(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 either one of the arguments is not a natural number or the result is greater than the maximum allowed integer number.
See also
#modNat 
It computes the remainder of the division between two numbers.
Syntax
#modNat(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 natural number or number2 is zero.
See also
#powNat 
It raises a number to a given power.
Syntax
#powNat(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 natural number or base and exponent are zero.
See also
#logNat 
It computes the logarithm of a number to a given base.
Syntax
#logNat(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 natural number or the result is a negative number.
See also
#log10Nat 
It computes the logarithm of a number to base 10.
Syntax
#log10Nat(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 either one of the arguments is not a natural number or the result is a negative number.
See also
#log2Nat 
It computes the logarithm of a number to base 2.
Syntax
#log2Nat(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 either one of the arguments is not a natural number or the result is a negative number.
See also
#lnNat 
It computes the natural (Napierian) logarithm of a number.
Syntax
#lnNat(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
#rootNat 
It computes the nth radix of a number (where n is equal to a given index).
Syntax
#rootNat(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 natural number or index is zero.
See also
#sqrtNat 
It computes the square root of a number.
Syntax
#sqrtNat(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 one of the arguments is not a natural number.
See also
#gcdNat 
It computes the Greatest Common Divisor (GCD) for two numbers.
Syntax
#gcdNat(number1, number2, result)
number1 and number2 are the numbers we want to compute the GCD
result is the GCD for number1 and number2
Available Patterns
iii (number1, number2, result) : Returns true if result is the GCD for numbe1 and number2
iio (number1, number2, Result) : Set Result to the GCD for number1 and number2
Notes
Returns false if one of the arguments is not a natural number.
See also
#lcmNat 
It computes the Least Common Multiple (LCM) for two numbers.
Syntax
#lcmNat(number1, number2, result)
number1 and number2 are the numbers we want to compute the LCM
result is the LCM for number1 and number2
Available Patterns
iii (number1, number2, result) : Returns true if result is the LCM for numbe1 and number2
iio (number1, number2, Result) : Set Result to the LCM for number1 and number2
Notes
Returns false if one of the arguments is not a natural number.
See also
#factNat 
It computes the factorial of a number.
Syntax
#factNat(number, result)
number is the number we want to compute the factorial
result is the factorial of number
Available Patterns
ii (number, result) : Returns true if result is the factorial of number
io (number, Result) : Set Result to the factorial of number
Notes
Returns false if one of the arguments is not a natural number.
See also
#s2nNat 
It converts a string, representing a natural number, into the corresponding number.
Syntax
#s2nNat(string_num, number)
string_num is the text string representing number
number is the numerical value corresponding to the text string_num
Available Patterns
ii (string_num, number) : Returns true if number is the numerical value represented by string_num
io (string_num, Number) : Set Number to the numerical value represented by string_num
oi (String_num, number) : Set String_num to the text corresponding to the value of number
Notes
Returns false if either string_num is not a text string or number is not a natural number.
See also
#n2sNat 
It converts a number into the corresponding string.
Syntax
#n2sNat(number, string_num)
number is the numerical value corresponding to the text string_num
string_num is the text string representing number
Available Patterns
ii (number, string_num) : Returns true if string_num is the text corresponding to the numerical value of number
io (number, String_num) : Set String_num to the text corresponding to the value of number
oi (Number, string_num) : Set Number to the numerical value represented by string_num
Notes
Returns false if either number is not a natural number or string_num is not a text string.
See also
#b2dNat 
It converts a string, representing a binary number, into the corresponding decimal number.
Syntax
#b2dNat(string_bin, number)
string_bin is the string representing number with the binary radix
number is the decimal value corresponding to the binary value represented by string_bin
Available Patterns
ii (string_bin, number) : Returns true if the value represented by string_bin is equal to the binary value of number
io (string_bin, Number) : Set Number to the decimal value corresponding to the binary value represented by string_bin
oi (String_bin, number) : Set String_bin to the text representing the binary value corresponding to the decimal value of number
Notes
Returns false if either string_bin is not a text string or number is not a natural number.
See also
#d2bNat 
It converts a decimal number into the string representing the corresponding binary value.
Syntax
#d2bNat(number, string_bin)
number is the decimal value corresponding to the binary value represented by string_bin
string_bin is the string representing number with the binary radix
Available Patterns
ii (number, string_bin) : Returns true if number is equal to the decimal value of the binary number represented by string_bin
io (number, String_bin) : Set String_bin to the text representing the binary value corresponding to the decimal value of number
oi (Number, string_bin) : Set Number to the decimal value corresponding to the binary value represented by string_bin
Notes
Returns false if either number is not a natural number or string_bin is not a text string.
See also
#evenNat 
It returns true if a number is even.
Syntax
#evenNat(number)
number is the number to be checked
Available Patterns
i (number) : Returns true if number is even.
Notes
Returns false if number is not a natural number.
See also
#oddNat 
It returns true if a number is odd.
Syntax
#oddNat(number)
number is the number to be checked
Available Patterns
i (number) : Returns true if number is odd.
Notes
Returns false if number is not a natural number.
See also
#combNat 
It computes the number of combinations or groupings.
Syntax
#combNat(number1, number2, result)
number1 is the number of elements to consider
number2 is the number of elements in each combination
result is the number of achievable combinations
Available Patterns
iii (number1, number2, result) : Return true if result is equal to the number of achievable combinations of number1 things taken number2 at a time
iio (number1, number2, Result) : Set Result to the number of achievable combinations of number1 things taken number2 at a time
Notes
Returns false if either one of the arguments is not a natural number or number1 is less than number2.
See also
#permNat 
It computes the number of permutations or arrangement.
Syntax
#permNat(number1, number2, result)
number1 is the number of elements to consider
number2 is the number of elements in each permutation
result is the number of achievable permutations
Available Patterns
iii (number1, number2, result) : Return true if result is equal to the number of achievable permutations of number1 things taken number2 at a time
iio (number1, number2, Result) : Set Result to the number of achievable permutations of number1 things taken number2 at a time
Notes
Returns false if either one of the arguments is not a natural number or number1 is less than number2.
See also
Attached Files
You are not allowed to attach a file to this page.