Math Functions Reference (iLogic)

iLogic provides a set of Math functions that can be added to rules.

In the iLogic Edit Rule dialog box, use one of the following methods to access the Math functions:

Standard Math functions

The standard VB.NET Math library provides most of the Math functions used in iLogic:

IsNumeric PI
MinOfMany Sqrt
MaxOfMany Abs
Round Sign
Round decimal precision Int
Round Closest to Increment Fix
Round Up to Increment Log10
Round Down to Increment Ln
Ceil Pow
Floor Min
Sin Max
Cos CDbl
Tan EqualWithinTolerance

iLogic Math functions

iLogic provides some Math functions. The following functions emulate the functions available in standard Inventor parameter equations:

Ceil (same as Math.Ceiling)
Sign0(a) = 1 if a > 0.0, = 0 otherwise
Ln (same as Math.Log)

Because certain Inventor functions differ from the VB.NET standard Math functions of the same name, they are converted when captured for use in an iLogic rule:

Trigonometric functions

Sin(0) = 0 Cos(PI) = -1
Sin(PI) = 0 Tan(0) = 0
Sin(PI/2) = 1 Tan(PI/4) = 1
Cos(0) = 1 PI = 3.1415926......
Cos(PI/2) = 0  

Sin(), Cos(), and Tan() are standard trigonometric functions with arguments expressed in radians (not degrees):

If you use the Capture Current State option on a trigonometric formula in the Edit Rule dialog box, it is not be converted to VB.NET code. Instead, the formula is left as an Inventor formula. You can edit the formula manually to change it into a VB.NET formula (with angles in radian units).

To convert from degrees to radians, use the following formula:

radians = degrees *(PI/180)

Other Math functions

Function Purpose Examples
Abs() Return the absolute value of the argument.

Abs(10) = 10

Abs(-9.87) = 9.87

Sqrt() Return the square root of the argument.

Sqrt(25) = 5

Sqrt(100) = 10

Sqrt(3) = 1.732051

Sign() Return a number indicating the sign of the argument.

If the value is positive, Sign(value) = 1

If the value is negative, Sign(value) = -1

If the value is zero, Sign(value) = 0

Round() Round the argument to a whole number (integer), or to a specified number of decimal places.

Syntax: Round(argument, optional # of decimal places desired)

Round(2.55689) = 3

Round(2.55689, 1) = 2.6

Round(2.55689, 3) = 2.557

Round(PI, 4) = 3.1416

Ceil() Round the argument to the next higher integer.

Ceil(2.56) = 3

Ceil(Sqrt(3))= 2

Floor() Round the argument to the next lower integer.

Floor(1.789) = 1

Floor(PI) = 3

Log10() Return the base 10 logarithm of the argument.

Log10(10) = 1

Log10(100) = 2

Log10(15) = 1.176091

Ln() Return the natural logarithm of the argument. (base e logarithm).

Ln(5) = 1.609438

Ln(37) = 3.610918

Pow(argument1, argument2) Return the result of raising argument1 to the exponent of argument2.

Pow(2, 2) = 2 2 = 4

Pow(2, 3) = 2 3 = 8

Pow(3, 2) = 3 2 = 9

Comparison functions

Function Purpose Examples
Min(argument1, argument2) Return the lesser of the two arguments.

Min(2, 4) = 2

Min(9, 4) = 4

Min(Sqrt(2), Sqrt(3)) = 1.4142.....

Max(argument1,argument2) Return the greater of the two arguments.

Max(2, 4) = 4

Max(9, 4) = 9

Sqrt(3)) = 1.73205.....

MinOfMany( ,,, ) Return the lesser of many arguments.

MinOfMany(2,4,3,6,7,8) = 2

MinOfMany(9,4,5,67,3,5) = 3

MinOfMany(Sqrt(2), Sqrt(3), Sin(PI/2)) = 1

MaxOfMany( ,,, ) Return the largest of many arguments.

MaxOfMany(2,4,3,6,7,8) = 8

MaxOfMany(9,4,5,67,3,5) = 67

MaxOfMany(Sqrt(2), Sqrt(3), Sin(PI/ignored>/2)) = 1.73205.....

EqualWithinTolerance(a, b, 0.001) Compares the values of two parameters (represented by a and b) and compares the difference to the tolerance value (specified here as 0.001). If the difference is less than the tolerance, the function returns the Boolean value True. If the difference is greater than the tolerance, the function returns the Boolean value False.

If a = 10.00 and b=10.01

EqualWithinTolerance(a, b, 0.015) = True [Abs(a-b) is less than the tolerance value of 0.015 in]

EqualWithinTolerance(a, b, 0.001) = False [Abs(a-b) is greater than the tolerance value of 0.001]

EqualWithinTolerance(a,b) Use a default tolerance of 0.0000001