Abyssal
Home
Tools
Docs
Support
Dashboard
# Calculator The Calculator module evaluates math expressions, solves equations, simplifies expressions and computes geometry. It is a pure command module: there is no server-side configuration beyond the module toggle, all preferences are per member, and results are delivered as Discord components rather than embeds. ## Enabling Enable the Calculator module on the dashboard Modules page. That is the only configuration the module exposes. ## Dashboard configuration - There are no module settings. The Formats page for the Calculator is intentionally empty because every reply is built live from the runner's personal settings. - Response behavior is per user, not per server: response visibility, response type, trig mode, complex mode, coefficient grouping, fraction display, precision, exact forms and scientific notation are all picked in the command's Settings type. ## Commands Everything runs through `/calculate` (or `!calc` / `!calculate` in servers with text commands). The command is user-installed, so it works in any server and in DMs. ### `/calculate` Open the calculator. One optional parameter picks what to open; leaving it empty opens Basic. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | Text | Optional | What to open - Choices: Basic, Algebraic, Simplify, Geometric, Settings. | #### Basic Basic opens a small form with one equation box and evaluates it. It supports: - **Arithmetic**: `1 + 1`, `2*3`, `1/2+3`, `8^2`, `2.42983^(1-2)`, `100 / (10 / 2)` and implicit multiplication like `5(8)`. - **Roots and powers**: `sqrt(25)`, `√25`, `√(25)`, `∛(8)`, `cbrt(8)`, `⁴√(16)` through `⁶√(64)`, superscripts like `5²`, and `sqrt(∛(64))`. Note that `√5*5` reads as the square root of 5, times 5. - **Logarithms**: `log(10)`, `ln(1)`, `ln(e)`, `exp(1)`, and base notation like `log_2(8)`, `log₂(8)` or `log₅(125)`. - **Constants**: `pi`, `π`, `e`, `tau` (2π, shows as `τ`), `phi` (the golden ratio, about 1.6180339887), and products like `epi`, `pitau` or `tauphi` typed together. - **Trigonometry**: `sin(30)`, `cos(60)`, `tan(45)`, `sin(π/2)`, `sin(30°) + cos(60°)`, `asin(1)`, `acos(1)`, `atan(1)`. Degrees or radians follow your Trig Mode setting, and adding a `°` symbol forces degrees for that value. - **Percentages and factorials**: `10%`, `10% * 200`, `7!`, `(3 + 2)!`. - **Combinatorics**: `perm(5, 2)` and `comb(5, 2)`. - **Helpers**: `abs(-5)`, `|-5|`, `round(3.14159)`, `round(3.14159, 2)`, `floor(-3.9)`, `ceil(3.1)`, `trunc(3.9)`, `min(3, 7, 2)`, `max(3, 7, 2)`. - **Comparisons**: `10>5`, `5=5`, `5*3 >= 100` and `3^2 ≤ 0` return `1` for true and `0` for false, so they can be used inside equations like `5 + 5/(3=3)` which returns `10`. `≠` and `!=` both work as not-equal. - **The ans variable**: `ans` is replaced with your previous result. - **Coefficient grouping**: quantities written next to each other count as one amount, so `5(8)`, `2π` and `eπ` are single coefficients that stay together across a division: `π * e / eπ` = `π × e / (eπ)` = 1 and `6/2(1+2)` = 1. Typed operators stay left to right, so `20 / 2 * 5` = 50 and `100 / 10 / 2` = 5. The Coefficient Grouping setting turns this off for strict left-to-right evaluation. Impossible inputs return clear errors instead of a weird number: `1 / 0`, `sqrt(-1)` (unless Complex Mode is on), `log(0)`, `tan(90°)`, `0^0` and friends all explain what went wrong, and typing something like `x=1` points you at the Algebraic type. #### Algebraic Algebraic solves equations. The form has an equation box plus an optional variable box that names the variable to solve for; leave it empty and the variable is detected automatically. - Linear and quadratic equations solve exactly, including rational roots: `x-1=0` gives `x = 1`, `2x + 2 = 0` gives `x = -1`, and `x^2 = 8` gives `x = ±2√2` with Prefer Exact on. - Cubics and quartics get rational-root factoring and numeric roots for the rest, marked with `≈`. - Complex Mode on returns complex solutions, for example `x^2 + 1 = 0` gives `x = ±i`. - Multi-variable equations solve for the variable you name: `2x + 3 = y` with `x` in the variable box gives `x = (y - 3)/2`, and `(x + y)^2 = 0` for `x` gives `x = -y`. Quadratics in the target variable return symbolic roots like `x = ±√(9 - 8y)` for `x² + 8y-8/2=5`. - Function-containing equations like `log₃(x)=y` solve for the outside variable, giving `y = log₃(x)`. - Division-based equations work and extraneous roots that would divide by zero are removed with a note. `x = x` reports endless solutions and `x = x + 1` reports none. #### Simplify Simplify reduces an expression to its cleanest exact form. Fractions reduce to lowest terms, like terms collect and constants fold: `10/4` gives `5/2` (or `2.5`, or both, per your Non-Integer Responses setting), `(x+1)(x-1)` gives `x² - 1`, `x/2 + x/3` gives `(5/6)x`, and `(x^2+2x+1)/(x+1)` gives `x + 1`. When more than one form exists, buttons let you switch between Expanded, Factored and Fraction views, and buttons only appear when that form actually differs from the answer. #### Geometric Geometric computes shapes. Pick one of Circle, Square, Rectangle, Triangle (Three Sides), Right Triangle, Sphere, Cylinder or Cone, fill in only the values you know, and the rest are solved for you. A square from its diagonal, a cylinder from radius and volume, a right triangle from two legs: all work, with exact forms like `7√2` and `2π` when Prefer Exact is on and impossible configurations (a triangle inequality violation, a slant height shorter than the radius) called out clearly. #### Settings Settings opens your personal calculator settings, three pages of them, each editable in place: | Setting | Options | Default | | --- | --- | --- | | Command Response | Public / Private | Public | | Response Type | Short / Full | Full | | Trig Mode | Degrees / Radians | Radians | | Complex Mode | On / Off | Off | | Coefficient Grouping | On / Off | On | | Non-Integer Responses | Decimal Only / Fraction Only / Both | Decimal Only | | Plus-Minus Answers | On / Off | On | | Decimal Precision | 1 to 15 | 10 | | Precision Style | Decimal Places / Significant Figures | Decimal Places | | Exact Answers | Always Decimals / Prefer Exact | Always Decimals | | Scientific Notation | On / Off | Off | - **Short** replies with just the answer; **Full** includes your input, so `1 + 1` comes back as `1 + 1 = **2**`. - **Coefficient Grouping** decides how quantities written next to each other divide: on, `5e`, `2π` and `eπ` are single coefficients, so `π * e / eπ` = 1; off, everything applies left to right, so `π * e / eπ` = `((π × e) / e) × π`. - **Decimal Places** counts digits after the point (2.57293 with 1 becomes 2.6); **Significant Figures** counts from the first digit (27.3498284 with 3 becomes 27.3). - **Prefer Exact** prints closed forms instead of long decimals: `√2`, `2π`, `eπ`, `(1 + √5)/2` and friends, verified against the true value before being used. - **Scientific Notation** shortens very large or very small numbers into forms like `1.5 × 10²⁰` following your precision settings. ### Text (prefix) commands These run with the server's text command prefix (default `!`). Change it from the dashboard Settings page. - **calc** / **calculate**: evaluate an expression the same way Basic does, for example `!calc 8^2 + 1`. ### Notes - The calculator has no server-wide configuration beyond enabling the module in the dashboard; every preference is per member. - Echoed input is normalized for display (`x^2` becomes `x²`, `pi` becomes `π`) and stripped of markdown so `8*5*5` cannot turn italics on. - Nothing echoed back can ping: mentions typed into the math box come back as plain text. ## How it works / Key flows - **Basic** evaluates with a hand written math engine: implicit multiplication, roots and superscripts, logarithms in any base, constants like `π`, `e` and their products, trigonometry in degrees or radians, percentages, factorials, permutations, combinations, rounding helpers and comparisons that return `1` or `0`. Division by zero, imaginary results with Complex Mode off and malformed input all return clear typed errors. - **Algebraic** combines both sides into one exact rational polynomial and solves. Linear and quadratic equations solve exactly, cubics and quartics factor down, complex solutions appear with Complex Mode on, and equations with more than one name solve for the variable you name, including symbolic roots like `x = ±√(9 - 8y)`. - **Simplify** reduces to a single exact rational in lowest terms, cancels common factors, expands multi-variable expressions and offers Expanded, Factored and Fraction buttons when a different form exists. - **Geometric** solves eight shapes from partial input: fill in what you know and the remaining sides, angles, areas, volumes and surface areas come back, with exact forms like `7√2` and `45π` when Prefer Exact is on. - Answers honor the member's precision settings everywhere, and approximate values print with `≈` instead of a fake exact sign. ## Notes - Preferences are stored per member on the bot's database, so they follow you across servers and survive restarts. - Input is echoed back normalized and markdown-escaped, so pasted math looks the same as what you typed and cannot ping anyone. - Approximate roots are clearly marked with `≈`; exact fractions, surds and constant forms use `=`.