Advanced Features

CrunchJr is an expression evaluator.   It evaluates the user's input expression and tabulates the result and variable values for up to three variables (each with one or more values).  200+ Constants (e.g., PI, SQRT2) and 300+ Functions (e.g., Sqrt, Refinance, Cubic, Payoff, ComplexDiv, Ira, Integrate) are available for use.   Tapping [Inputs] → {Functions} or → {Constants} leads to detailed information about the hundreds of available Functions and Constants.  Further, there are several advanced features, including storing results for later use, personalizing your environment, integration, building user-defined functions, and input shortcuts.
There are several features which can make using the basic functionality of expression (and equation) evaluation easier.  This list allows you to navigate quickly to get to the description for these features.

1)  Equations 10)  Statistics
2)  Pre-setting variables 11)  User-defined functions
3)  Options & Toggles 12)  Nested arguments
4)  History 13)  Integration
5)  The Store 14)  Error messages
6)  Using previous values       15)  FYI messages
7)  Input shortcuts 16)  Special functions
8)  The Calc (789) Keyboard 17)  Auto expansion
9)  Cut-and-Paste   (Home)




      Equations

An equation is a simple variable followed by "=" followed by an expression.  The expression may contain variables, constants, and functions.  The result of each expression evaluation (one for each set of variable values) is saved in the Store under the left hand side variable name.  When that variable is next referenced in an expression, those saved values are automatically loaded (although they are subject to user override).  Here is a simple sample of an equation:

omega = (rho-a)*sin((pi-rho)*(1-a));

For this sample, the user would be prompted for one or more values for the variables rho and a.  If the user entered two values for one variable and three for the other, six values for omega would be calculated and saved in the Store.  When omega is later used in this or a future session, these six values would be automatically loaded.

→  Feature list       →  (Home)      



      Pre-setting variables

It is straightforward to load variable values directly into the Store. for use later in this or a future session.  Tap [Inputs] → {Variables} → (Edit) → Add Variable, then enter the variable name and values (separate multiple values with commas).  Later you can use the variable in an expression without needing to enter values.  Here are some examples:
e  =  enat
i  =  1,  2,  3,  4
index  =  loop  1  17  2
beta  =  5.103,  4.1219,  pi,  2.171,  sqrt3
xyz  =  interp  3  7  4
In these examples, values for e, i, index, beta and xyz are placed in the StoreEnat, pi and sqrt3 are constants, and loop and interp are special input shortcuts.  The values for index are 1, 3, 5, ..., 17.  The values for xyz are 3, 3.125, 3.25, ..., 3.875, 4.  That is, seven equally-spaced values are placed between 3 and 4, making nine values total.  Details about loop and interp can be found below in the Input shortcuts section.

→  Feature list       →  (Home)      



      Options & Toggles

There are a variety of user-settable options and toggles which control various operations, including displaying results and saving information in the Store.  These options and toggles are most often employed by heavy-duty users – the majority of users are comfortable with the default settings.

Tap [Info] → {Show Settings} to see the current status of these tunable parameters (the tables below show the default settings).  Or, tap [Info] → {Settings} to make changes.  A sample:  By default, values generated by a computation – the LHS (left-hand side) of an equation evaluation – are automatically saved in the Store for later review or reuse, but users may choose to disable this option (via the Save LHS toggle).

7 Options
7 at (d)efault

SettingOption
20 Light Pastels (d)    Background Colors
$ Dollar (d)    Currency Symbol
Yellow (d)    Error Screen Color
Arial (d)    Font
Reader friendly notation (d)    Format (single)
Welcome back (d)    Restart Location
Insert at top (d)    Variable List Order

30 Toggles
30 at (d)efault

SettingToggle
  On (d)    Alternate Bases
  On (d)    ApiTips
  Off (d)    Append
  Off (d)    App Expert
  On (d)    Candidates List
  Off (d)    Collect Analytics
  On (d)    Constant Values
  Off (d)    Cut-and-Paste
  Off (d)    Domain Expert
  Off (d)    Favorites Sort
  On (d)    Function Prototypes
  Off (d)    Ignore AutoRotate
  Off (d)    Ignore Store
  On (d)    Input Info Panel
  Off (d)    Precision
  On (d)    Save History
  On (d)    Save LHS
  Off (d)    Save RHS
  On (d)    Show FYIs
  On (d)    Show Last Use
  Off (d)    Show OpCount/Time
  Off (d)    Show Stats
  Off (d)    Show Store Trailer Msg
  On (d)    Show Store Usage/Dates
  On (d)    Show User Functions
  On (d)    Show Warnings
  On (d)    Use Bands
  On (d)    Use Subtitles
  Off (d)    Value Layout
  Off (d)    ZOctal


→  Feature list       →  (Home)      



      History

Equations and expressions entered in the [Expression] box are saved in a history file which is available for reference in this and future sessions.  Any of them can be recalled for review, editing, deletion or resubmission.  Here is an abbreviated sample history view (note the Key at the bottom which describes the various fields).

(14:31 Thu Aug16  →  11:23 Sat Sep22)
86 entries


86 3 11:23  
  yesterday  
 Payoff2(1178.84, 4.575, 140000, extra); 
85 1 19:17  
Wed Sep19  
 Calories(running, 165, 3.5, 29, 21) 

Key:  17  3  time  
 date    
 Your input expression 
17 = submission number;  3 = usage count
time, date are for the most recent use


→  Feature list       →  (Home)      



      The Store

the Store holds variables and user-defined functions.  This data is available in the current and future sessions.  Various usage statistics are maintained for the data stored in the Store.  The values of variables are kept for future review and use.  Variables and their values are sent to the store as the result of Equation Evaluations (when the SaveLHS option is On), when variables are used in an expression while the SaveRHS option is On, and when direct Store requests are made (e.g., [Inputs] → {Variables} → (Edit) → Add Variable).  By default, SaveLHS = On  and  SaveRHS = Off.  These options can be changed via [Info] → {Settings}. There are multiple access paths for reviewing the contents of the Store.
  1. [Info] → {The Store} leads to usage reports
  2. Pick one of the reports from (1) above, and tap {+Fav}.  You can then quickly access that report via [Info] → {(Favorite Screens)}.
  3. [Inputs] → {Variables} generates a list of the variables – tap any variable to see its values, stats etc.
When entering an expression with a variable which has saved data, that data is automatically entered into the variable entry box.  This data can be modified or ignored (see next section).

→  Feature list       →  (Home)      



      Using previous values

Data in the Store is automatically used (although the user may override some or all of the previous values).  Here is a sample: Assume that index is in the Store with nine values (1,3,5,...,17).  Then entering dist = index*(pi-theta) in the [Expression] box and tapping [Submit] would lead to:

dist = index*(PI-theta);


              Enter value(s) for each variable

index
theta
 

 
 
 


The input values for index from the Store may be accepted, deleted, or overridden for this evaluation.

→  Feature list       →  (Home)      



      Input shortcuts

Input values may be integers, floating point values, or CrunchJr-recognized constants (like pi or sqrt2).  Input values are separated by one or more commas and blanks.  Further, there are three special strings that can be used with input values:  Loop,  Interp, and Last




→  Feature list       →  (Home)      



      The Calc (789) Keyboard

When you are entering data, tapping the [calc] key switches to a special-purpose keyboard (which includes a standard 789 numeric keypad).  Although it appears similar to a calculator keyboard, it is more of a hybrid – with some of the strengths of both a calculator and CrunchJr.  Unlike a calculator, when you tap a function key (e.g., sin), those characters appear in the [Expression] box; it does not force an immediate computation.  When you've built the expression you want, tap the [Submit] button as usual.

Back-to-back keystrokes can be used to build other functions.  For example, a and cos for acos()sin and h for sinh(); tan and d for tand().  (Note that the arcsine function is asin(), not invsin().)  Altogether, 24 functions are quickly available.
acos() atanh() inv() sinr()
acosh() cos() ln() sqrt()
asin() cosd() log() tan()
asinh() cosh() sin() tand()
atan() cosr() sind() tanh()
atan2() exp() sinh() tanr()
Similarly, these 18 constants can be easily constructed.
EINV LOG10E SQRT5
LN10 PIINV SQRT6
LN2 PIINVSQRT SQRT7
LN3 SQRT10 SQRT8
LOG102 SQRT2 SQRTE
LOG103 SQRT3 SQRTPI

This keyboard may be most convenient when working with hexadecimal numbers (all the entries are on the same keyboard).  Further, the 15 letters represent about 85% of typical English text (by frequency).  Thus some users find it convenient to use this keyboard for most of their input.
tand() takes its argument as degrees


→  Feature list       →  (Home)      



      Cut-and-Paste

Users can copy the result from selected computations (by tapping the button), which places it in the pasteboard.   This value can then be pasted into any CrunchJr input request, or used outside the app.  Further, an outside value can be carried into CrunchJr and used just like any other value.  To enable this capability, set the Cut-and-Paste toggle ( [Info] → {Settings} → (Cut-and-Paste) to ON (it is OFF by default).  Although the pasteboard holds only one value, you can tap [Info] → {Pasteboard Contents} to review the most recent entries, and you may place any one of these into the pasteboard.

→  Feature list       →  (Home)      



      Statistics

CrunchJr provides three mechanisms to review some simple statistics about computed (and input) values.
  • When an equation is used, statistics about the computed variable are saved in the Store.   These simple stats (count, max, min, avg, stdev, median) are available by tapping [Inputs] → (Variables) → {the variable name}.
  • Maximum, minimum and median values are highlighted in the standard output when more than two values are computed.  (When there are an even number of results, the median value is computed.)
  • If the Show Stats option is enabled, a small table of statistics is displayed below the computed results.  Here is a sample:  Note that the (Min,Max,Mdn) values are displayed independent of the status of the Show Stats option.
alpha = b*((x2+sqrt(x2))/(sin(pi*angle/exp(b))-.137))
For this equation with three values for b, three values for x2, and one value for angle, typical results could look like:
alpha = b*((x2+Sqrt(x2))/(Sin(PI*angle/Exp(b))−.137));
    alpha    b    x2    angle  
    -------    ---    ----    -------  
  1)      8.117661   1.401   1    0.6501 
  2)      9.139128    1.401   1.17   0.6501 
Max  3)      9.552672   1.401   1.24   0.6501 
Min  4)      3.892497    1.03   1    0.6501 
  5)      4.382300   1.03   1.17   0.6501 
  6)      4.580599   1.03   1.24   0.6501 
  7)      5.595417   1.213   1    0.6501 
Mdn  8)      6.299503   1.213   1.17   0.6501 
  9)      6.584555   1.213   1.24   0.6501 

 Avg   StdDev   Min   Max  Median 
 6.460481   2.083267   3.892497   9.552672  6.299503 


To see the stats for any variable in the Store, tap [Inputs] → {Variables} → (VariableName).

→  Feature list       →  (Home)      



      User-defined functions

CrunchJr provides a mechanism to create user-defined functions, and use them in subsequent computations during the same and future sessions.  Each must have 1-3 arguments and return a single value.  Each argument must be used at least once.  User-defined function names follow the same rules as variable names, and may not take on the name of an existing CrunchJr function or constant.  A user-defined function can be used just like any other function (e.g., it may have constants, variables, and other single-valued functions as arguments; it may be used in expressions and equations and as the arguments to other functions), except that user-defined functions may not nest.  That is, a user-defined function may not be used as an argument to a user-defined function.

To create a user-defined function:  [Inputs] → {User-Defined Functions}→(Edit) → {Add Function}, then enter the New Function Prototype – e.g., cos2(a,b) – followed by the New Function Definition – pi*(a*cos(2*a+b) - b*cos(a-2*b))
The function definition must use each of the dummy arguments at least once (no other variables are allowed), and may also use numbers, CrunchJr constants, functions, and any of the available mathematical operations (e.g., +, –, *, etc).  As with any other entry in the [Expression] box, whitespace is ignored and entries are case-insensitive.

Note that user functions are stored as complete parse-trees (not symbolically).  This means that it is not necessary to encase the definition in parentheses.  That is, given a user function abc(x,y) → x - y ,  the expression  r * abc(x,y)  will always be evaluated as  r*(x-y),  not as  (r*x) - y.

A review of the current user functions and some information about each is available in the Store, or by simply tapping its prototype in the User-Defined Functions screen.  User functions can not be overwritten nor deleted. 

Here is some sample output from an equation which uses both user functions mentioned above.  Note that in this sample, three of the four user function dummy arguments are populated by constants and one is a variable (p).  In fact, any dummy argument in a user function may be replaced with a constant, a simple variable, or an expression.

zippo = abc(6.733, pi)*cos2(p, 1.53)

One variable p with values of "Loop 1.103, 1.83, 0.084" was used.  Note that when user-defined functions are employed in an expression, they are always listed in green.

Abc(x,y)  →  x-y;

Cos2(a,b)  →  pi*(a*cos(2*a+b)-b*cos(a-2*b));

zippo = Abc(6.733, PI)*Cos2(p, 1.53);

zippo p
    -------    ---  
Mdn   1)   -3.8079488   1.103 
2)   -4.5474335   1.187 
Min   3)   -4.8315311   1.271 
4)   -4.6465638   1.355 
5)   -3.9997734   1.439 
6)   -2.919697   1.523 
7)   -1.4557149   1.607 
8)     0.3232277   1.691 
Max   9)     2.330699   1.775 


→  Feature list       →  (Home)      



      Nested arguments

Arguments to functions may include functions – that is, functions can nest.  Here is a sample.

a2 = sqrt(abs(1+sin(x)*cos(y)/sqrt(x^2+y^2)))

Setting x to 3, 4, 5 and y to 7.5, 4.3, 2.2 yields:

a2 = Sqrt(Abs(1+Sin(x)*Cos(y)/Sqrt(x^2+y^2)));

a2 x y
    ----    ---    ---  
Mdn   1)     1.0030233   3    7.5 
2)     0.9945915   3    4.3 
3)     0.9887751   3    2.2 
4)     0.9844476   4    7.5 
5)     1.0254994   4    4.3 
6)     1.047646   4    2.2 
Min   7)     0.9813887   5    7.5 
8)     1.0287272   5    4.3 
Max   9)     1.0503845   5    2.2 


→  Feature list       →  (Home)      



      Integration

CrunchJr provides two functions to perform approximate integrations {Integrate() and Quadrature()}.  They use the same numerical approximations to integrations, and produce the same results.  The only difference is that Quadrature() always shows the convergence to the approximate solution, while Integrate only displays convergence data when convergence has not been achieved.  Quadrature() is recommended.

Here is the definition:  Integrate( a, b, expr ):  ab{expr(x)} dx.  Approximate result of integrating the expression (expr) from a to ba and b are the lower and upper bounds of the (dummy) variable in expr, and must be constants with (ab).  The expression expr must have exactly one variable, must be single-valued, and may be a single user-defined function or an expression with no user-defined functions.  The expression expr must be continuous over the specified range, and may include any single-valued function except Rand() and IRand().  Unpredictable results may occur when expr is not continuous or is otherwise ill-behaved.
Here are a sample of each:

Integrate(1.33, 1.57, x*Sin(x)^2);

~  .3416035



Quadrature(1.33, 1.57, x*Sin(x)^2);

~  .3416035

Convergence Information

Criterion:   | Δ/Value |  <  10-6

TrapezoidsValueΔ/Value
16      0.341593     
32      0.341601    2.29166*10-5 
64      0.341603    5.72906*10-6 
128      0.341603    1.43226*10-6 
256      0.341603    3.58064*10-7 


→  Feature list       →  (Home)      



      Error messages



CrunchJr checks input expressions for validity, and puts out a message when it detects an anomaly (e.g., a non-standard character, a parsing problem, mismatched parentheses, unrecognized function names, et cetera).  Here are some samples:

val=(0.5/a)*(-b+-sqrt(b^2-4*a*c))


input error -- can't understand "+-" (character 18)
                                 ^


1 Diagnostic: see input equation below

     val = (0.5/a)*(-b+-Sqrt(b^2-4*a*c));
     .................^


abc = sin(gg,omega)*cos(gg*omega))


input error -- expression has an unmatched ")" at character 35

input error -- equation has mismatched "()"s, 2 "("s but 3 ")"s

input error -- Sin() should have 1 argument (2 arguments at character 7)

3 Diagnostics (2 pointers): see input equation below

      abc = Sin(gg, omega)*Cos(gg*omega));
      ......^...........................^


bb = sqrtt(time+0.2*penalty)


input error -- "sqrtt" at character 6 is not a recognized Function

1 Diagnostic: see input equation below

     bb = sqrtt(time+0.2*penalty);
     .....^



Note that if the toggle Input Info Panel is ON (which it is by default), this error will be shown while you are entering the line into the [Expression] box.

When a run-time computational error is encountered, CrunchJr highlights the error and attempts to complete the other data sets.  No statistics are compiled when an error is encountered, and data is not transferred into the Store.  Here is a sample.

seabiscuit = sqrt(x-y)/(y-x)

Setting x = 3, 5, 9 and y = 1, 2, 5, 8 generates these results:

seabiscuit x y
   ------------   ---    ---  
1)   -0.7071068   3    1  
2)   -1   3    2  
NSqr 3)     ???   3    5  
NSqr 4)     ???   3    8  
5)   -0.5   5    1  
6)   -0.5773503   5    2  
ZDiv 7)     ???   5    5  
NSqr 8)     ???   5    8  
9)   -0.3535534   9    1  
10)   -0.3779645   9    2  
11)   -0.5   9    5  
12)   -1   9    8  

4 run-time errors:

   1: ZDiv - Division by zero
   3: NSqr - Square Root of a negative number

→  Feature list       →  (Home)      



      FYI messages

Under certain circumstances, CrunchJr generates informational messages (usually preceded by FYI – ).  Here are some samples:

FYI – 9 Store values for a2 will be replaced by new value(s).

FYI – 4 new values for omega replaced 9 previous values

FYI – 6 new values appended to alpha.

FYI – Sort: 2 duplicate values dropped for qzero



→  Feature list       →  (Home)      



      Special functions

CrunchJr provides a variety of special purpose functions which perform very specific computations (e.g., exploring Mortgage payoff strategies, computing calories burned during a workout, computing Body Mass Index (BMI), finding the day of the week of any date, finding your target workout heartrate, integrating, exercising Ohm's Law, counting the number of 1-bits in a word, solving quadratic, cubic, and quartic equations, ...).  There are 130 Special Functions.  Tap [Info] → (Details) → {Special Functions} for details.

→  Feature list       →  (Home)      



      Auto Expansion

When entering an equation or expression, CrunchJr allows the user to try various expansion candidates, and thus save some typing.  At any time, the user can tap the key, which will expand the rightmost token in the expression box, and show other candidates (if any) in the panel right below the expression box.  The token must start with a letter and be at least two characters.  The expansion candidates are selected from a list of all the CrunchJr Functions and Constants.  If there are no valid candidates, tapping the key will do nothing.  To accept a particular expansion candidate, just continue typing.  If the current expansion candidate is not what you want, consecutive key taps will cyle through all the candidates.  The last tap before restarting through the cycle again will be the original text (i.e., as if you hadn't hit the key).

For example, there are 12 functions which start with "pay" – by entering pay and tapping the key three times, you will have "payoffbiweekly(" in the expression box.  If you now tap a key (building the first argument to PayoffBiweekly()), the panel below the expression box will display the prototype (argument list) for the function.

→  Feature list       →  (Home)      

~~~//~~~