Skip to content

Usage

The browser-based version of Numbat is available at https://numbat.dev/.

Interactive terminal

The terminal allows you to perform a sequence of calculations. You can use the arrow keys to browse through the command history. The special identifiers ans and _ refer to the result of the last calculation. For example:

>>> 60 kW h / 150 kW

    = 0.4 h

>>> ans -> minutes

    = 24 min

Commands

There is a set of special commands available in the web version:

Command Action
help, ? Show a basic introduction to Numbat
help commands Brief description of all available commands
info <identifier> Get more information about functions, variables, units, or dimensions
list Show all currently defined items
list <what> Show all currently defined functions, dimensions, variables, or units
clear Clear the console output
reset Completely reset the interpreter state

Key bindings

In interactive command-line mode, you can use the following key bindings. Most importantly, Tab for auto-completion, arrow keys and Ctrl-R for browsing the command history, and Ctrl-D for exiting the interactive session.

Key sequence Action
Tab Auto-completion
Ctrl+L Clear screen
Up / Down Browse command history
Ctrl+R Search command history
Ctrl+C Clear the current line
Shift+Enter Insert newline
Home / Ctrl+A Move cursor to the beginning of the line
End / Ctrl+E Move cursor to the end of the line
Ctrl+Left / Ctrl+Right Move cursor one word left/right
Ctrl+K Remove text to the right of the cursor
Ctrl+U Remove text to the left of the cursor

Sharing calculations

To share the result of a calculation with someone else, you can just copy the URL from your browser's address bar. As you enter new lines in the terminal, your input will be appended to the URL to build up something like https://numbat.dev/?q=let+P0+%3D+50_000+people%0A… that you can just copy and share. To reset the state and clear the URL, use the reset command (see above).