3.8. Parametric Functions

A parametric function is a programmed sequence of mathematical operations which returns a single value, such as SIN(X), SQRT(B), and LOG(13.2). The following table provides a complete list of functions currently available in Mechanical APDL.

ABS(x)Absolute value of x.
SIGN(x,y)Absolute value of x with sign of y. y=0 results in positive sign.
CXABS(x,y)Absolute value of the complex number x + yi ( )
EXP(x) Exponential of x (ex).
LOG(x) Natural log of x (ln (x)).
LOG10(x) Common log of x (log10(x)).
SQRT(x) Square root of x.
NINT(x) Nearest integer to x.
MOD(x,y)Remainder of x/y, computed as x - (INT(x/y) * y). y=0 returns zero (0).
RAND(x,y) Random number (uniform distribution) in the range x to y (x = lower bound, y = upper bound).
GDIS(x,y) Random sample of a Gaussian (normal) distribution with mean x and standard deviation y.
SIN(x), COS(x), TAN(x) Sine, Cosine, and Tangent of x. x is in radians by default, but can be changed to degrees with *AFUN.
SINH(x), COSH(x), TANH(x) Hyperbolic sine, Hyperbolic cosine, and Hyperbolic tangent of x.
ASIN(x), ACOS(x), ATAN(x) Arcsine, Arccosine, and Arctangent of x. x must be between -1.0 and +1.0 for ASIN and ACOS. Output is in radians by default, but can be changed to degrees with *AFUN. Range of output is -pi/2 to +pi/2 for ASIN and ATAN, and 0 to pi for ACOS.
ATAN2(y,x) Arctangent of y/x with the sign of each component considered. Output is in radians by default, but can be changed to degrees with *AFUN. Range of output is -pi to +pi.
VALCHR(CPARM)Numerical value of CPARM (if CPARM is non-numeric, returns 0.0).
CHRVAL(PARM) Character value of numerical parameter PARM. Number of decimal places depends on magnitude.
UPCASE(CPARM)Upper case equivalent of CPARM.
LWCASE(CPARM)Lower case equivalent of CPARM.
LARGEINT(x,y)Forms a 64-bit pointer from low (x) and high (y) 32-bit integers.

The following are examples of parametric functions:

PI=ACOS(-1)             ! PI = arc cosine of -1, PI calculated to machine accuracy
Z3=COS(2*THETA)-Z1**2
R2=SQRT(ABS(R1-3))
X=RAND(-24,R2)          ! X = random number between -24 and R2
*AFUN,DEG               ! Units for angular functions are degrees
THETA=ATAN(SQRT(3))     ! THETA evaluates to 60 degrees
PHI=ATAN2(-SQRT(3),-1)  ! PHI evaluates to -120 degrees
*AFUN,RAD               ! Units for angular functions reset to radians
X249=NX(249)            ! X-coordinate of node 249
SLOPE=(KY(2)-KY(1))/(KX(2)-KX(1))
                        ! Slope of line joining keypoints 1 and 2
CHNUM=CHRVAL(X)         ! CHNUM = character value of X
UPPER=UPCASE(LABEL)     ! UPPER = uppercase character value of parameter LABEL