### How CrunchJr Works

CrunchJr is a powerful computational engine.  It allows you to enter an expression in the Submit box, and evaluate it for multiple values of the variables.  For example,

beta*sin(x-sqrt(beta))/(PI*x)

has two variables (beta and x).  Entering 4.002 and 3.73 for beta and 4.11, 4.7, 4.447 for x produces the output on the right (note that the highlighting of rows 3 and 4 is only to make it easier to read).  This page describes how the computation is performed.

CrunchJr reads expressions in the standard infix form, but stores them in postfix ("Reverse Polish") form.  Reverse Polish is named for the Polish mathematician, Jan Lukasiewicz.

 Infix Postfix | X + Y | X Y + X * Y + Z | X Y * Z + X + Y * Z | X Y Z * + (X - Y) / Sin(R - T) | X Y - R T - Sin / Sqrt(A+R)*Max(R,R-A,A+1) | A R + Sqrt R R A - A 1 + Max *

Postfix representation has several advantages over infix for computer evaluation:  Postfix is expressed without parentheses, postfix is easy to evaluate using stacks, and postfix does not have precedence rules.  The translation of infix to postfix notation handles the parentheses and precedence rules once, so that multiple evaluations of the expression with different values for the variables can be more efficient.  Note that by convention, Expression 3 above, X+Y*Z is evaluated as X+(Y*Z) and not (X+Y)*Z.  That is, multiplication has a higher precedence than addition.

The valid operators are   +   −   *   /   %   **   ^   (and function calls).   The precedence rules are

Operator    Precedence Description
(1 Open Parenthesis
)1 Close Parenthesis
Func()2Functions
**3Exponentiation
^3Exponentiation
*4Multiplication
/4Division
%4Remainder