Expressions have pretty much the same syntax as they would have on paper, with the following exceptions:

- Each expression must end with a semicolon. This is because the expression string can actually contain multiple expressions. The semicolon is used to mark the end of the expression.

Examples:

- 4*x+5;
- y=5+2;g=4+6;
- y=r*sin(a);x=r*cos(a);
- The asterisk '*' must be used to multiply.

Examples:

- y=5*6;
Valid- g=(x+1)*(x-1);
Valid- g=(x+1)(x-1);
InvalidMore than one expression may be contained within an expression string. As shown above, each expression must end with a semicolon, even if only one expression is in the string. The value of an expression string is the value of the last expression in the string.

Examlples:

- g=7;
Value: 7- k=z+1;
Value: z+1- r=4;k=6;o=9+r-k;
Value: 9+r-kSome functions may take reference parameters. These parameters are references to other variables. You can mix reference parameters with normal parameters. The order of the normal parameters must remain the same and the order of the reference parameters must remain the same.

Examples:

- min(1,2,3,4,&mval);
&mval is a reference to a variable mval- min(1,2,&mval,3,4);
You may mix them inside like this.- min(1,2,(&mval),3,4);
You may not nest reference parameters in any wayExpressions may also be nested with parenthesis.

Examples:

- y=sin(x-cos(5+max(4,5,6*x)));
- 6+(5-2*(x+y));
Expressions may also have whitespace characters and comments. Whitespace characters such as newlines, linefeeds, carriage returns, spaces, and tabs are ignored. Comments begin with the pound sign '#' and end at the end of the line.

Example:

#Set the x value x = d * cos(r); #Set the y value y = d * sin(r);If a variable is used in an expression, but that variable does not exist, it is considered zero. If it does exist then its value is used instead.

Notice:An expression canNOTassign to a constant and an expression canNOTuse a constant as a reference parameter.

The order of operators are processed correctly in ExprEval. The parameters to functions may be evaluated out of order, depending on the function itself.

The following illustrates the order of operators:

OperatorDirectionExampleFunctions and Parenthesis N/A (x + 5) * sin(d); Negation Right to Left y = -2; Exponents Left to Right y = x ^ 2; Multiplication and Division Left to Right x * 5 / y; Addition and Subtraction Left to Right 4 + 5 - 3; Assignment Right to Left x = y = z = 0;

The following functions are provided with ExprEval:

FunctionMin. ArgsMax. ArgsMin. Ref ArgsMax. Ref ArgsResult/Commentabs(v) 1 1 0 0 Absolute value of v.

abs(-4.3) returns 4.3mod(v,d) 2 2 0 0 Remainder of v/d.

mod(5.2,2.5) return 0.2ipart(v) 1 1 0 0 The integer part of v.

ipart(3.2) returns 3fpart(v) 1 1 0 0 The fractional part of v.

fpart(3.2) returns 0.2min(v,...) 1 None 0 0 The minimum number passed.

min(3,2,-5,-2,7) returns -5max(v,...) 1 None 0 0 The maximum number passed.

max(3,2,-5,-2,7) returns 7pow(a,b) 2 2 0 0 The value a raised to the power b.

pow(3.2,1.7) returns 3.2^{1.7}sqrt(a) 1 1 0 0 The square root of a.

sqrt(16) returns 4sin(a) 1 1 0 0 The sine of a radians.

sin(1.5) returns around 0.997sinh(a) 1 1 0 0 The hyperbolic sine of a.

sinh(1.5) returns around 2.129asin(a) 1 1 0 0 The arc-sine of a in radians.

asin(0.5) returns around 0.524cos(a) 1 1 0 0 The cosine of a radians.

cos(1.5) returns around 0.0707cosh(a) 1 1 0 0 The hyperbolic cosine of a.

cosh(1.5) returns around 2.352acos(a) 1 1 0 0 The arc-cosine of a in radians.

acos(0.5) returns around 1.047tan(a) 1 1 0 0 The tangent of a radians.

tan(1.5) returns around 14.101tanh(a) 1 1 0 0 The hyperbolic tangent of a.

tanh(1.5) returns around 0.905atan(a) 1 1 0 0 The arc-tangent of a in radians.

atan(0.3) returns about 0.291atan2(y,x) 2 2 0 0 The arc-tangent of y/x, with quadrant correction.

atan2(4,3) returns about 0.927log(a) 1 1 0 0 The base 10 logarithm of a.

log(100) returns 2pow10(a) 1 1 0 0 10 raised to the power of a.

pow10(2) returns 100ln(a) 1 1 0 0 The base e logarithm of a.

ln(2.8) returns around 1.030exp(a) 1 1 0 0 e raised to the power of a.

exp(2) returns around 7.389logn(a,b) 2 2 0 0 The base b logarithm of a.

logn(16,2) returns 4ceil(a) 1 1 0 0 Rounds a up to the nearest integer.

ceil(3.2) returns 4floor(a) 1 1 0 0 Rounds a down to the nearest integer.

floor(3.2) returns 3rand(&seed) 0 0 1 1 Returns a number between 0 up to but not including 1. random(a,b,&seed) 2 2 1 1 Returns a number between a up to and including b. randomize(&seed) 0 0 1 1 Seed the random number generator with a value based on the current time.

Return value is unknowndeg(a) 1 1 0 0 Returns a radians converted to degrees.

deg(3.14) returns around 179.909rad(a) 1 1 0 0 Returns a degrees converted to radians.

rad(180) returns around 3.142recttopolr(x,y) 2 2 0 0 Returns the polar radius of the rectangular co-ordinates.

recttopolr(2,3) returns around 3.606recttopola(x,y) 2 2 0 0 Returns the polar angle (0...2PI) in radians of the rectangular co-ordinates.

recttopola(2,3) returns around 0.588poltorectx(r,a) 2 2 0 0 Returns the x rectangular co-ordinate of the polar co-ordinates.

poltorectx(3,1.5) returns around 0.212poltorecty(r,a) 2 2 0 0 Returns the y rectangular co-ordinate of the polar co-ordinates.

poltorecty(3,1.5) returns around 2.992if(c,t,f) 3 3 0 0 Evaluates and returns t if c is not 0.0. Else evaluates and returns f.

if(0.1,2.1,3.9) returns 2.1select(c,n,z[,p]) 3 4 0 0 Returns n if c is less than 0.0. Returns z if c is 0.0. If c is greater than 0.0 and only three arguments were passed, returns z. If c is greater than 0.0 and four arguments were passed, return p.

select(3,1,4,5) returns 5equal(a,b) 2 2 0 0 Returns 1.0 if a is equal to b. Else returns 0.0

equal(3,2) returns 0.0above(a,b) 2 2 0 0 Returns 1.0 if a is above b. Else returns 0.0

above(3,2) returns 1.0below(a,b) 2 2 0 0 Returns 1.0 if a is below b. Else returns 0.0

below(3,2) returns 0.0avg(a,...) 1 None 0 0 Returns the average of the values passed.

avg(3,3,6) returns 4clip(v,min,max) 3 3 0 0 Clips v to the range from min to max. If v is less than min, it returns min. If v is greater than max it returns max. Otherwise it returns v.

clip(3,1,2) returns 2clamp(v,min,max) 3 3 0 0 Clamps v to the range from min to max, looping if needed.

clamp(8.2,1.3,4.7) returns 1.4pntchange(side1old, side2old, side1new, side2new, oldpnt) 5 5 0 0 This is used to translate points from different scale. It works no matter the orientation as long as the sides are lined up correctly.

pntchange(-1,1,0,480,-0.5) returns 120 (x example)

pntchange(-1,1,480,0,-0.5) returns 360 (y example)poly(x,c1,...) 2 None 0 0 This function calculates the polynomial. x is the value to use in the polynomial. c1 and on are the coefficients.

poly(4,6,9,3,1,4) returns 2168

same as 6*4^{4}+ 9*4^{3}+ 3*4^{2}+ 1*4^{1}+ 4*4^{0}and(a,b) 2 2 0 0 Returns 0.0 if either a or b are 0.0 Else returns 1.0

and(2.1,0.0) returns 0.0or(a,b) 2 2 0 0 Returns 0.0 if both a and b are 0.0 Else returns 1.0

or(2.1,0.0) returns 1.0not(a) 1 1 0 0 Returns 1.0 if a is 0.0 Else returns 0.0

not(0.3) returns 0.0for(init,test,inc,a1,...) 4 None 0 0 This function acts like a for loop in C. First init is evaluated. Then test is evaluated. As long as the test is not 0.0, the action statements (a1 to an) are evaluated, the inc statement is evaluated, and the test is evaluated again. The result is the result of the final action statement.

for(x=0,below(x,11),x=x+1,y=y+x) returns 55.0 (if y was initially 0.0)many(expr,...) 1 None 0 0 This function treats many subexpressions as a single object (function). It is mainly for the 'for' function.

for(many(j=5,k=1),above(j*k,0.001),many(j=j+5,k=k/2),0)

The following constants are provided with ExprEval:

ConstantMath FormValueM_E e 2.7182818284590452354 M_LOG2E log _{2}(e)1.4426950408889634074 M_LOG10E log _{10}(e)0.43429448190325182765 M_LN2 ln(2) 0.69314718055994530942 M_LN10 ln(10) 2.30258509299404568402 M_PI π 3.14159265358979323846 M_PI_2 π/2 1.57079632679489661923 M_PI_4 π/4 0.78539816339744830962 M_1_PI 1/π 0.31830988618379067154 M_2_PI 2/π 0.63661977236758134308 M_1_SQRTPI 1/√(π) 0.56418958354776 M_2_SQRTPI 2/√(π) 1.12837916709551257390 M_SQRT2 √(2) 1.41421356237309504880 M_1_SQRT2 1/√(2) 0.70710678118654752440

Application defined expression functions go here.

FunctionMin. ArgsMax. ArgsMin. Ref ArgsMax. Ref ArgsResult/Comment

Application defined expression constants go here.

ConstantMath FormValue

Application defined expression variables go here.

VariableMath FormValue