<< Click to Display Table of Contents >>

Navigation:  Problem Descriptor Reference > The Elements of a Descriptor >


Previous pageReturn to chapter overviewNext page

Value Expressions

Problem descriptors are composed predominantly of arithmetic expressions made of one or more operators, variables, defined values and pairs of parentheses that evaluate to numerical values.  In evaluating value expressions, FlexPDE follows the  algebraic rules of precedence in which unary operators are evaluated first, followed by binary operators in the following order:



multiplication and division

addition and subtraction

relational operators (<, <=, =, <>, >=, >)

relational combinations (AND, OR)


When included in expressions, subexpressions enclosed in pairs of parentheses are evaluated first, without regard to the precedence of any operators which precede or follow them.  Parentheses may be nested to any level, with inner subexpressions being evaluated first and proceeding outward.  Parentheses must always be used in pairs.



a = b*(c+d)




Conditional-Value Expressions

Problem descriptors can contain conditional expressions of the form


IF condition THEN subexpression ELSE subexpression .


This form selects one of the two alternative values as the value of the expression.  It is used in expressions like

y = IF a THEN b ELSE c

analogous to the expression "y = a ? b : c" in the C programming language.


It is not the procedural alternative construct

IF a THEN y=b ELSE y=c        { Wrong ! }

familiar in procedural programming languages.


The THEN or ELSE subexpressions my contain nested IF...THEN...ELSE expressions.  Each ELSE will bind to the nearest previous IF.

Conditional expressions used in material parameters can cause numerical trouble in the solution of a PDE system, because they imply an instantaneous change in the result value.  This instantaneous change violates assumptions of continuity upon which the solver algorithms are based.

See URAMP, RAMP and SWAGE for switching functions that transition smoothly between alternative values.