## New Data Commands for The Inline Calculator

Our introduction of data parameters means that parameters are no longer just 1 number. You often need to work with full list of values.

If we have the following parameter

\$p=randnormal(50,10,30)

\$p might contain the following data.

52.82, 51.09, 49.33, 47.02, 38.04, 67.23, 55.54, 51.4, … , 37.88, 45.5, 55.23, 49.21, 38.63

The inline calculator can now calculate most summary statistics

{mean(\$p)} will be replaced with 49.77

{iqr(\$p)} will be replaced with 10.55

There are a number of commands which produce summary statistics. These are discussed in our online manual.

{sort(\$p)} which will sort the list in ascending order

{contains(\$p,50)} which will return true if \$p contains the value 50

{count(\$p,6)} which will return the number of 6’s in \$p

## Reference Ranges

Efofex parameters have always supported references. These allow you to reference individual values in a parameter.

For example, if you have created a parameter like

\$p=shuffle(1,6)

\$p might end up being 5, 4, 6, 1, 3, 2

You can reference individual elements of \$p using square brackets.

\$p = 1
\$p = 2

\$p[2,5] = “4, 6, 1, 3”

Reference ranges will automatically be produced with your local separator (in this example, that is a comma).

\$p[2,5,+]

will be replaced with “4+6+1+3”

## Special Reference Ranges

There are two special reference ranges you can use. The first is the empty reference range.

\$p[]

This will list out ALL elements of the set. For the example above, this will produce

“5, 4, 6, 1, 3, 2”

The second special reference range is an elided reference. For this example we will use

\$q=range(1,100)

If you listed out this full set, the result would be too long for one line. Instead you can use this notation.

\$q[…]

which will automatically produce an elided list.

1, 2, 3, 4, 5, 6, 7, 8 … 96, 97, 98, 99, 100

\$q[…,+]

1+2+3+4+5+6+7+8+ … +96+97+98+99+100

Ideal for sequences and series questions!

## New Efofex Parameter Types

We have been working frenetically on Efofex parameters and the inline calculator over the last few months and have created a number of new, powerful parameters and commands. This article discusses the new parameter types.

## Shuffle Parameters

A shuttle parameter allows you to quickly create a shuffled list. For example,

\$p=shuffle(1,6)

will automatically create a shuffled list of the numbers from 1 to 6. This means that \$p might be

3, 4, 1, 6, 5, 2 or 4, 5, 1, 2, 6, 3 or any other arrangement.

You will normally access shuffled lists using references.

\$p or \$p for example.

## Coprimes Parameters

A coprimes parameter produces a randomly selected set of (up to 10) coprime numbers from the indicated range.

\$p = coprimes(1,50)

This parameter might produce

34, 35, 11, 31… or 4, 21, 19, 43…

This allows you to quickly create new sets of coprime numbers (numbers which share no common factors)

## Data Parameters

A data parameter is really just a list of values (a bit like a list parameter). The difference is that data parameters are designed to be worked on as a data set. For example, you can find the mean of a data parameter using a simple calculator command.

A simple data parameter looks just like a list parameter.

\$p=data(1,4,6,8,2,4,7,2)

but you will not often write out your own set of data. A more useful way to get a data set is to use one of our random number parameters.

## Random Number Parameters

Our random number parameters allow you to quickly create data parameters using random numbers. The two you will use most often are:

\$p=randnormal(50,10,30,2)

Which will produce 30 normally distributed random numbers from a population with a mean of 50 and a standard deviation of 10 (rounded to 2 decimal places).

or

\$p=randbetween(1,6,30)

Which will produce 30 uniformly distributed random numbers from 1 to 6 (equivalent to rolling a die 30 times)

There are a number of other distributions you can use. These are mentioned in our online help.

# €, £, ¥ and even ₮

Even better, if you send your document to a user in a different country, your equation will be rendered using their currency symbol automatically.

## Basic Usage

The new If command in the inline calculator allows you to create extremely complicated expressions.

The If command has the following format

if(condition to be satisfied, value if true, value if false)

For example, an if statement might look like this

{if(\$n>0,100,-20)}

When this command is run, the inline calculator will look at the value of the \$n parameter. If the value is greater than 0, this statement will be replaced by 100. If the value is less than or equal to 0, the statement will be replaced by -20.

If commands will often include multiple parameters.

{if(\$n>0,\$p,\$q)}

With this command the inline calculator will return the value of either \$p or \$q, depending on the value of \$n.

## Conditions

A condition is a Boolean statement that returns true or false. Conditions often include inequalities:

• \$s<4
• \$n>=6
• \$q=9
• \$t<>7 (\$t is not equal to 7)

These are fairly simple conditions. You can combine these using the And, Or and Not commands as well as some of the more specialized Boolean commands to produce extremely complicated conditions.

## Numbers Or Text?

You can use the inline calculator to insert numbers or text into your equation. If you want to insert text into your equation, you must wrap the text in quotes.

For example:

{if(\$d=0,”Cannot divide by zero”,\$n/\$d)}

This command will look at the value of \$d. If the value is 0, the inline calculator will return the text Cannot divide by zero. If \$d is not zero, the calculator will divide \$n by \$d and return the result.

## Nested If Commands

If commands can be nested.

{if(\$n=0,”n is zero”,if(\$n<0,”n is negative”,”n is positive”))}

This command might take a little decoding…

If \$n is zero, the command will return n is zero. If \$n is not zero, the calculator will return the second result – which in this case is another if command. The calculator will execute the nested if command and return the appropriate response. There are no technical limits to the amount of nesting but the expressions can quickly become unwieldy. Often a better way to nest if commands is to assign commands to parameters. For example, if you assigned

\$p=if(\$n<0,”n is negative”,”n is positive”)

You could then write the nested if command as

{if(\$n=0,”n is zero”,\$p)}

## Boolean Conditions

We have added a number of commands to help you write Boolean conditions. Details can be found in the online documentation.

• And
• Or
• Xor
• Nor
• Not
• IsEven
• IsOdd
• IsInteger
• IsComposite
• IsPrime
• IsFactor
• IsNatural
• IsCube
• IsSquare

## Expanded Calculator Capabilities for Efofex Parameters

The built-in calculator provides a large proportion of the capabilities of Efofex Parameters. The ability to type:

{3 sin 20}

and have the expression automatically calculated is crucial to most parametized questions.

Recently we improved the capabilities of the built-in calculator in two major ways.

## Improved Exact Value Calculations

The calculator can now produce exact values for expressions like {\$x^5} if \$x is already an exact value like 2/3.

## Combinations and Permutations

The calculator can now calculate expressions involving combinations and permutations like {5C2} and {7P3}

## New Sequence Command for Efofex Parameters

If you are using Efofex Parameters, you are almost certainly using the range command.

\$y=range(1, 20, 0.5)

This command will produce a random value, between 1 and 20, going up in 0.5, every time you regenerate parameters. The values that are produced might, for example, go 5.5, 7, 12, 18.5, 20, 4, 1.5… The range command is one of the main ways of adding variation to your questions.

The new sequence command works in almost exactly the same way.

\$y=sequence(1, 20, 0.5)

This command will produce a value from exactly the same set of values as the previous range command. The only difference is that the numbers will be generated sequentially every time you regenerate. They values might be 17.5, 18, 18.5, 19, 19.5, 20, 0.5, 1, 1.5…

We have found this to be useful for some questions and wanted to make the facility available for everyone.

## New Greek (letter) Command

We have added a new Greek letter command to Efofex parameters. You can now define a parameter like:

\$x=greek()

This will randomly select a Greek letter from a list of acceptable letters (excluding letters like pi which have specific meanings). In this case \$x might be turned into al, ga or rh. This allows you to create algebraic and geometric questions with varying Greek letters.

If you define multiple Greek letters in one set of parameters, the letters will always be sequential.

\$x=greek()
\$y=greek()
\$z=greek()

You might end up with the three Greek letters being be, ga and de.

## New ToEnglish and ToEnglishCap commands for the Inline Calculator

Often, when writing a question, you will want to include a small number in a sentence

“A bag contains five red and three blue marbles”

Creating these sorts of questions using parameters has been difficult as the parameter system only works in numerals.

The ToEnglish command allows you to turn numeric parameters into words which can be used in your Word document. In the example above, you might have created two parameters, \$r and \$b, which contain the number of red and blue marbles. If you just use \$r and \$b in your text…

A bag contains \$r red and \$b blue marbles

You will see…

A bag contains 5 red and 3 blue marbles”

You can turn these numbers into words by typing

A bag contains {toenglish(\$r)} red and {toenglish(\$b)} blue marbles

The ToEnglishCap command operates in exactly the same way but capitalises the first letter of the output for use at the beginning of sentences.

## New RangeEx and PrimeEx Commands

We have added two commands to Efofex Parameters that allow you to create algebraic questions with less hassle.

Often, you will want to create a question that operates with both positive and negative numbers, but you need to exclude 0 and maybe 1 and -1. For example you might want to create a question where the parameter is the used as the denominator of a fraction and need to exclude zero.

The RangeEx and PrimeEx commands allow you to create sets of possibilities that satisfy this need.

For example:

\$p=rangeex(2,5) will select a value for \$p from the set of values {-5, -4, -3, -2, 2, 3, 4, 5}

Notice that the numbers from 2 to 5 are included as well as the associated negative values. The values -1, 0 and 1 are excluded from the list.

The PrimeEx command operates in exactly the same way but is limited to prime numbers and their negatives.

\$p=primeex(2,10) will select a value for \$p from the set of values {-7, -5, -3, -2, 2, 3, 5, 7}