Formulas and equations for expressions reference

Use these operators to create expressions.

The following operators are supported in parameters and dimension edit boxes.

Algebraic operators

Order of operations

Edit boxes use the algebraic order of operations, shown in the following table in descending precedence.

Operation

Symbol

Example

parenthesis

( )

(sin(15 deg))

exponentiation

^

width ^2

negation (unary subtraction)

-

(-2.00 + length)

multiplication or division

* or /

sin(pi/4 rad) or (0.5 * base * height)

addition or subtraction

+ or -

(-2.00 + height - 0.35 * base)

Syntax

The edit box uses the units specified in the default document properties. If you do not specify units in an edit box, terms and coefficients are assigned default units. An expression is evaluated according to the algebraic order of operations and default unit values.

If an expression contains syntax errors, they are shown in red. If no syntax errors are found, the characters are shown in black.

Syntax errors
Exponents are applied to units as well as the expression. For example:

2 + 3^3

The edit box assigns default units to all terms unless a unit is specified. The results are in error because dissimilar units cannot be added: 2 mm + (3 mm)^3ul is evaluated as 2 mm + 27 mm^3. Because the units are ambiguous, the expression is shown in red to indicate an error:

2 + 3^3

Including units and specifying which units are unitless results in the correct evaluation: 2 mm + ((3 ul) ^ 3 ul ) * 1 mm.

Typecasting
Does not allow assignment of units to an expression. The following example is not permitted:

(-2.00 + 3^3) m^2

Unit evaluation
Units are evaluated before the arithmetic portion of an expression. Therefore, the power operator applies to a unit before it applies to an adjacent numeric value. For example:

2 m^2

does not evaluate to 4 square meters, but rather means 2 square meters. The correct syntax is:

(2 m)^2 = 4 m^2

Correct syntax
In expressions, assign a unit to each numerical value in the expression. The following expression is in error because the system expects default units:

(2 + 1 * (3^2))

Use "ul" to indicate a unitless value: 2 mm + 1 mm * (3ul^2ul).

When entering an angle, the default unit is degrees. To enter radians, use this syntax:

(-0.25 deg * 3.1415 rad/1 deg) + (2ul * 3.1415 ul ) * 1 rad

Units

The following is a partial list of supported common units. you can use the unit types wherever you can use a parameter,, such as in equations. The complete list of unit types is shown in the Parameters dialog box.

Tip: When adding a user parameter, click Manage tab Parameters panel Parameters to open the Parameters dialog box. Click Add to add a user parameter and then click the Units column.

Length

"millimeter" "mm"

"centimeter" "cm"

"meter" "m"

"inch" "in"

"foot" "ft"

"micron"

"nauticalMile"

"mil"

Mass

"gram" "g"

"lbmass"

"slug"

"ouncemass"

Time

"second" "s"

"hour" "hr""

"minute" "min"

(can conflict with milli-inch)

Temperature

"Kelvin" "k"

"Celsius" "c""

"Fahrenheit" "f"

 

Angularity

"radian" "rad""

"degree" "deg" "°"

"grad"

"steradian" "sr"

Velocity

"Meters Per Second" "mps"

"Feet Per Second" "fps"

"Miles Per Hour" "mph"

"Revolutions Per Minute" "rpm"

Area

"circular mil"

     

Volume

"liter" "l"

"gallon" "gal"

   

Force

"newton" "N"

"dyne"

"lbforce"

"ounceforce"

Pressure

"pascal" "Pa""

"psi"

"ksi"

 

Power

"watt" "W""

"horsepower" "hp"

   

Work

"joule" "J"

"erg"

"calorie" "cal""

"btu"

Unitless

"unitless" "ul""

     

Electrical

"ampere" "A"

"volt" "V"

"ohm"

"coulomb" "C"

"farad" "F"

"gamma"

"gauss"

"henry" "H"

"hertz" "Hz"

"maxwell"

"mho"

"oersted"

"siemens" "S"

"tesla" "T"

"weber" "Wb"

 

Luminosity

"candela" "cd""

"lumen" "lm"

"lux" "lx"

 

Substance

"mole"

     

Prefixes

Autodesk Inventor supports the following prefixes:

"exa" "E"

1.0e18

"peta" "P"

1.0e15

"tera" "T"

1.0e12

"giga" "G"

1.0e9

"mega" "M"

1.0e6

"kilo" "k"

1.0e3

"hecto" "h"

1.0e2

"deca" "da"

1.0e1

"deka" "da"

1.0e1

"deci" "d"

1.0e-1

"centi" "c"

1.0e-2

"milli" "m"

1.0e-3

"micro" "micro"

1.0e-6

"nano" "n"

1.0e-9

"pico" "p"

1.0e-12

"femto" "f"

1.0e-15

"atto" "a"

1.0e-18

Functions

You can uyse the following functions in edit boxes.

Syntax

Return Type

Expected Types

cos(expr)

unitless

angle

sin(expr)

unitless

angle

tan(expr)

unitless

angle

acos(expr)

angle

unitless

asin(expr)

angle

unitless

atan(expr)

angle

unitless

cosh(expr)

unitless

angle

sinh(expr)

unitless

angle

tanh(expr)

unitless

angle

acosh(expr)

angle

unitless

asinh(expr)

angle

unitless

atanh(expr)

angle

unitless

sqrt(expr)

unit^1/2

any

sign(expr)

unitless

any

Return 0 if negative, 1 if positive

exp(expr)

unitless

any

Return exponential power. For example, returns 2.688E43 for 100.

floor(expr)

ul

ul

Next lowest whole number

ceil(expr)

ul

ul

Next highest whole number

round(expr)

ul

ul

Closest whole number

abs(expr)

any

any

max(expr1;expr2)

any

any

min(expr1;expr2)

any

any

ln(expr)

unitless

unitless

log(expr)

unitless

unitless

pow(expr1; expr2)

unit^expr2

any, and unitless respectively

Can construct unit valid equation that can go invalid "pow(3.0; d12)". Decimal powers rounds at eighth decimal place.

random()

unitless

unitless

isolate(expr;unit;unit)

 

Mechanical Desktop migration