Math Minion
Math Minion Models

This tutorial will briefly introduce the use of the Model object in Math Minion. If you are new to Math Minion, you should probably start with the concepts mentioned in the introductory tutorial first.

Only a few basic concepts are introduced here, so reviewing the Getting Started session and the help pages will be helpful in getting a more complete understanding of Math Minion's capabilities.

If possible, please follow along on your own computer. If you are using Math Minion on an iPhone, iPad or iPod Touch, there is a separate iOS tutorial page.

Note Math Minion is an evolving program and replacing screenshots is tediious, so there maybe some minor differences between the page views in the application and the screenshots of this tutorial.

We are going to create a very basic model that will calculate a body mass index, or BMI. This is simply a weight to height squared ratio that is used to roughly determine if a person is a healthy weight. The calculation is trivial, but it introduces the use of units and the use of a model to contain the calculation and present a form like interface for entering input and viewing results.

Start by creating a new session, using the + button on the iCloud view, or the File/New menu command if not using iCloud.

If necessary review the introductory tutorial for step by step instructions before proceeding.

Next click on the background and select Add from the resulting menu and add a Model object. You should see a view like the one below, minus the indicated changes.


Note that the green arrows and numbers will not appear on your screen, but rather have been added for this tutorial to show what actions to take next.

Change the model name to "BMI" and then click on the diagram background and add a new expression.


Rename the expression to Weight, give it a formula of 85 kg and check the Input box. Finally add a second expression to the diagram.

Having the expression designated as an input has two effects.

First it has the variable appear in the input section of the model form as we will see shortly.

It also means that any object names used in the expression formula will refer to objects in the parent model, not this model. The importance of this will also be demonstrated a little later.


As before, rename this expression, this time to Height, and turn on the input switch.

This time we will be a bit more creative with units.

In the = field enter the formula:

6 ft + 1 in

In this case we are adding 1 inch to 6 feet. Note that if a unit contains an operator symbol, such as m/s, then the unit has to be enclosed in quotes, unless the entire formula consists of just a number and the unit.

Internally Math Minion does all of its calculations in pure SI, but you can input your numbers with whatever units you wish and mix and match them however you want.

Now add yet another expression, this time a bit to the right of the first two.


This time, we will name it BMI and will switch the output switch on rather than the input switch. This will make it appear in the output section of the model input and results form and also make it available for use in formulas in the parent model.

Let's give ourselves a little more room for entering this formula.

Click in the = field and then click the toolbar icon with the outward pointing arrows.


Enter the formula:

Weight /

complete with the return after the slash in the first line. This formula would obviously be perfectly happy in just one line, but this illustrates that longer formulas can be split over multiple lines. Anytime you click in a formula field that extends beyond one line, this larger formula editor view will open automatically.

Return to the BMI expression view by tapping the back triangle.


Only the top of the formula appears in the = field, but the formula text is blue, which is an indication that the formula contains newline characters.

A BMI value always has the units kg/m^2. Since Math Minion does not have a type for this unit defined by default, the result is displayed in these pure SI units regardless of the display unit set being used, unless a custom type for this kind of property was defined.

Click the back triangle at the upper left of the diagram to return to the parent model.


The expressions of a model that have their input or output switches turned on, will appear in the corresponding sections of a model's information panel. This permits it to be used as a sort of form where you can enter input values and easily see the calculated results.

Also any model that has at least one input expression, will display its information panel without switching to its diagram, when its icon is clicked. If the model does not have any input expressions, clicking the icon will take you directly to its diagram.

To switch to the diagram of a model that has input expressions, click on the diagram icon:

Diagram Icon

Tap on the row labeled weight and then replace the 85 kg with 190 lb.


The new BMI value has now been automatically calculated. The result for the weight formula is displayed in kg, which is the default display unit for the SI unit set that is being currently being used. (The default set is selected by clicking the SI button on the toolbar.)

Click on the triangle button to the right of the Weight row.


Clicking that button switches you into the model and opens a view of the expression.

Now click the triangle button to the right of the unit name.


Since the type of the result is known to be mass, that type will be selected, with the default unit, kg, selected in the second column. If the type had not been known, you would scroll through the types and click on the desired kind to reveal the sunits for that type.

Click on the lb line so it is highlighted rather than the kg line and then tap the back triangle.

Note that if you want to remove a defined output unit, you would click on the Clear button, which would leave nothing highlighted.


The output is now displayed as pounds and the unit name is displayed in blue to indicate that a defined display unit has been set for this expression. If the formula were to calculate a value which had a different unit type than the display unit, an error alert would appear. (For instance if a temperature were calculated, but a density unit was specified for output.)

If a bare number is entered in the formula field of an expression that has a defined display unit, that unit is automatically appended after the number.

Click the back triangle at the upper left of the diagram to return to the model form.


The weight value is now displayed in pounds and if you were to enter just 185 in the formula field with Weight selected, the formula would automatically be modified to be 185 lb.

With a little less hand holding, add an expression named W, give it a value of 80 kg and then return to this view by tapping on the BMI icon. Select Weight and enter the formula:

w + 3 "lb"


There are a few points worth noting here.

First that objects referenced in an input expression refer to objects in its model's parent. Here the W expression lives in the BMI model, but W lives in the root model. The BMI expression in the BMI model is not an input expression and thus only knows about objects in its own model and as a result it could not have referenced W.

Although we named the expression W with a capital W, we referenced it in lower case. Names are not case sensitive in Math Minion formulas.

Return to the diagram and add yet another expression. Name it Result and enter the formula:


If you use the object browser (the toolbar button labeled <o>) to enter this, you will see that the BMI expression is the only expression that the parent model can access in the BMI model. This is because it is the only expression with its Output switch on.

Further you can see, the output expressions of a model are available for use in formulas in the parent model. An expression can have both switches set, so it is both input and output if desired.


That's it for this tutorial. You might want to further investigate units by reading the notes for the objects in the Units model of the Getting Started session.

In fact these tutorials only scratch the surface of Math Minion and you are strongly encouraged to also explore the other parts Getting Started session and the help pages. The Examples page is also a valuable resource and new examples will be added from time to time.

Finally if you have any comments or suggestions, please use the link on the help contents page on your device or the contact web page to share them with me.

Click the iCloud toolbar button and then Getting Started to explore other features of Math Minion.