> ## Documentation Index
> Fetch the complete documentation index at: https://docs.numberelectric.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Command reference

> Syntax, supported functions, and limits for NumElectScript.

Start new scripts with `numelectscript 2`. Existing `numelectscript 1` scripts still run; use the current header if you add geometry. Use one command per line. Begin comments with `#`. Put settings inside a phase block, for example `phase 3 {`, and close it with `}`.

## Phase and display settings

| Command | Behavior |
| - | - |
| `phase 3 {` | Select a phase model. Choices: `0`–`10`, `12`, `15`, `18`, `24`, `25+`, and `dual-three-phase`. |
| `frequency 60 Hz` | Optional reference frequency, for example `60 Hz` for AC or `0 Hz` for DC. The graph uses an angle axis, not a time axis. |
| `view waveform` | Select `waveform`, `rectification`, or `transformations`. Rectification uses a reference sine. |
| `show sin cos` | Select built-in traces: `sin`, `cos`, `tan`, `csc`, `sec`, and `cot`. |
| `range -180° to 540°` | Set the 2D waveform window at 100% zoom. Equivalent ranges include `range -pi to 3*pi` and `range -200 gon to 600 gon`. Units can be mixed. Bounds must be within ±10 turns and must be at least a quarter turn apart. Other views keep their own ranges. |
| `calculus derivative 1` | Select `derivative` or `integral`, with orders 1–10, in the AC waveform view. |
| `projection 2d` | Select `2d` or `3d` in waveform view. For calculus orders 4–10, `4d`, `5d`, and `nd` are also available. `nd` starts at six dimensions. |

## Formulas, constants, and colors

* `let gain = 1/2` defines a constant. Define at most 12 constants. Constants can refer to `pi` (`π`), `tau`, `e`, or earlier constants, but not to `θ`.
* `plot current = gain * sin(θ) color teal` defines a named trace. Define at most six traces. Use `+`, `-`, `*`, `/`, `^`, and parentheses. Available colors: `copper`, `blue`, `teal`, `gold`, `pink`, and `violet`.
* `θ`, `theta`, and `x` represent the plot angle in radians. Angle literals include `90°`, `1.5708 rad`, and `100 gon` (or `100 grad`). Use `pi/2` for an exact radian expression.
* Simple trig traces can use voltage or current units, for example `plot voltage = 120 V * sin(θ - 30°)`. The lab normalizes these traces by unit group. General formulas are unitless and plot their calculated values.

| Family | Functions |
| - | - |
| Trigonometric | `sin`, `cos`, `tan`, `csc`, `sec`, `cot` |
| Inverse trigonometric | `asin`, `acos`, `atan`, also `arcsin`, `arccos`, `arctan` |
| Hyperbolic | `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh` |
| Powers and logs | `sqrt`, `cbrt`, `exp`, `ln` (or `log`), `log2`, `log10` |
| Numeric helpers | `abs`, `floor`, `ceil`, `sign`, `numerator` |

`numerator(6/8)` returns `3`, and `numerator(-0.75)` returns `-3`. The result is undefined if no fraction with a denominator up to 1,000,000 matches within rounding tolerance and the normal numeric limits.

## Geometry commands

| Command | Behavior |
| - | - |
| `geometry 2d` / `geometry 3d` | Choose the coordinate dimension inside the phase block. |
| `vertex -2, 0` / `vertex 0, 0, 2` | Add a 2D or 3D point after `geometry`. Consecutive vertices connect. Repeat the first point to close the path. The script allows up to 256 vertices. |
| `break` | Begin a separate path without connecting it to the preceding vertex. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.