Overview

The console is a text-based interface for interacting with Math Minion. It has two modes selected by the button at the bottom of the information view:

Using the Console

To open the console, tap the button at the bottom of the information view. Tapping it again will close the console. Note that unlike other views, the console is not pushed on top of the current information view, but rather just sits overtop of it.

Regardless of which mode is selected, you just enter your commands or instructions into the input field at the bottom of the console. When you press the Enter key, the input is submitted and the results are displayed in the text area above.

If you wish to enter multi-line input, you can use the Shift-Enter key to move to the next line.

Use the up and down arrow keys to navigate the history of commands.

Each input creates a new page of output. You can use the Shift-Up and Shift-`Down arrow keys to navigate between pages.

You can also use the Read Command File button to read a file of commands.

Note: The console button at the bottom of the information view is a toggle. Tap it to see the console view and tap it again to hide the view.

A Note on Program Structure

When Math Minion runs, all the calculations take place in a separate process called a web worker and all the user interaction and display occurs in the main program. The main program communicates with the calculation engine by passing it text commands. When the engine completes the command, it sends a message back to the main program containing text in the form of JSON. The interface uses these replies to construct what you see.

Console Mode

When in console mode, the commands you enter are sent directly to the calculation process and and the results it returns are displayed in the text area above. For example:

.Records get notes

would return the notes for the Records tool.

Commands

Commands take the form of a subject path, followed by an action, possibly followed by an object or other action parameter. If the subject path is omitted, the default subject is used.

The top of the subject tree is the session, which has the path "/". Children are separated by dots, so "/.root" is the root model and "/.root.x" is the tool named x in root.

At start up, the default subject is root and if a path does not start with "/", it will be relative to the default subject. Thus ".x" would also refer to the tool named x in the root model, unless the default subject has been changed. In Math Minion, the current subject is the model being viewed in the diagram unless changed with the cd command.

The command help will list the commands the subject understands. If the help command is followed by one of those commands, a very brief usage message will be displayed.

You can also look at the instructions for the AI assistant. They are a bit verbose, but contain detailed information. There are also specific instructions for less common tools:

AI Mode

NOTE: Using this feature will require having an AI provider account and an API key. The default Open Router provider allows access to a large number of different models with only a single account. API keys aren't free, but you only need to add a few dollars to your account and $10 will go a long way depending on your model choice.

You can obtain an Open Router API key from https://openrouter.ai. Once you have the key, you will have to enter it into the console using the aikey command. Note this is using the Console view, not the AI view

/ aikey <your api key> [optional completion url]

The completion url is only needed if you are not using Open Router. If omited, it will default to https://openrouter.ai/api/v1/chat/completions.

By default the latest Google Gemini Flash model is used. To change the model, use the aimodel command:

/ aimodel <model name>

After changing the api key or the model, you may have to reload Math Minion to clear the AI context if you have already been using the AI chat.

When in AI mode, the instructions you enter are sent to the selected API, which returns comments and usually commands. The commands are sent to the Math Minion engine for execution. Both the comments and commands are displayed in the text area above.

The AI will often ask Math Minion questions and you can also ask the AI questions about the model.

If executing a command returns an error, it will try a couple of times to fix it before giving up. If there are problems with the solution it created, you can ask it to fix them, although it is often easier to just fix them yourself.

It can be a bit slow, so be patient. If it encounters an error and tries to fix it, the "thinking" indicator in the input field may briefly disappear, but either a "Done" or Failed message will appear in the text area when it is finished. If you want to abort it, just refresh the browser. Refreshing will also clear the saved conversation and start fresh.

The assistant's instructions includes all functions and formula syntax and how to create and manipulate all Math Minion tools, with the exception of the imported model tools.

Here are some examples. When I first implemented this over a year before these updates, performance was a bit hit or miss, but the improvement in that time is remarkable. All of my examples just simply worked now.

I need an Expression that is 200 elements long that toggles between 0 and 1

Given equations:
3*x-cos(y*z)-0.5 = 0
x^2 -81*(y+0.1)^2 + sin(z) +1.06 = 0
Exp(-x*y) +20*z+ (10*pi -3)/3 = 0
Create a model that determines the values of x, y and z.

For angles 0 to 720 degrees in 10 degree increments, create a 3d plot with x being sin angles, y being cos angles and z starting at 0 m and increasing 1 m for angle index. Add a second curve with z 20 m above the first.

Create a model to simulate a predator/prey relationship. Inputs should be: initial populations of predator and prey - default 200 for both the prey growth per period of time in the absence of predators - default 1 per day Death rate of prey per encounter with predators - default 0.003 1/d Death rate of predator in absence of food - default 2 per day Efficiency of turning prey into predators - default 1 Show both a table and graph of the results

The instructions didn't say anything about duration, so it just took a reasonable guess. After it created the model, I told it:

change the run time to 10 days and the recording period to 1 hour.

I had switched into the model before giving this instruction, so its attempt to move into the model failed. It then queried the model and realized it was already in the correct model and proceeded to issue the correct commands.

I have found doing things like asking it to examine a model and then add appropriate notes to the tools often works pretty well as does things like asking it to arrange the diagram icons into two columns or some such.

It also does a surprisingly good job of process engineering using the Flash tool. I have even had good results having it add an html page to describe the process, complete with an svg flowsheet.