Built-in functions and Function Studio
Use built-in math functions like sqrt, round, log and sin, define your own such as f(x) = x^2, and keep a reusable library in Zlv Function Studio.
Zlv has a library of math functions, and you can add your own, either inside a sheet or in Function Studio, a library that every sheet can use.
Using a function
Write the function name followed by its arguments in parentheses.
Evaluating…
Built-in functions
| Group | Functions |
|---|---|
| Rounding and sign | abs, round, ceil, floor, trunc |
| Powers and logs | sqrt, exp, ln, log (base 10), log2 |
| Trigonometry | sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh |
| Counting | factorial (or fact), nCr, nPr, gcd, lcm |
| Lists | min, max, plus sum, avg, median, count in the desktop app |
| Random | random, randint; see Random, dice and coins |
Evaluating…
Trigonometric functions use degrees by default. Change this in Settings > Calculation > Trigonometric angle unit.
In the desktop engine round also accepts a number of decimal places, and log2 and atan2 are available:
Results appear next to each line in Zlv Desktop. Download it free.
Defining your own functions in a sheet
Write the function name, its parameter in parentheses, =, and the formula. Then call it on any later line.
Evaluating…
The desktop engine supports several parameters and functions that call other functions:
Results appear next to each line in Zlv Desktop. Download it free.
Functions you define in a sheet belong to that sheet. To use a function everywhere, save it in Function Studio.
Function Studio (desktop)
Open Function Studio with Ctrl+F or the fx button. It lists the built-in starter functions and your saved functions, with a search box that matches names, parameters, tags and formulas.
- Click New Function.
- Fill in Function name, Parameters (comma-separated) and Expression body. A Description and Category tag are optional.
- Use Test Live to try the function with sample values before saving.
- Click Save to Library. The function is now available in every sheet.
From each entry you can Insert Call (adds a call such as bmi() at the cursor), Insert Def (adds the full definition to the sheet), edit, duplicate, copy the definition, or delete it. Restore Defaults brings back the starter set.
The starter library includes:
| Function | What it does |
|---|---|
bmi(kg, cm) | Body mass index from weight and height |
discount(price, pct) | Price after a percentage discount |
tip(bill, pct) | Tip amount for a bill |
roi(gain, cost) | Return on investment, in percent |
compound(p, r, y) | Compound growth: p * (1 + r) ^ y |
vat(x) | 20% value added tax on an amount |
g_force | Standard gravity constant, 9.80665 |
Results appear next to each line in Zlv Desktop. Download it free.
Quick insert palette
Press Ctrl+Shift+F to open the function palette, type part of a name such as roi or compound, and insert it at the cursor.
Sharing functions
In Function Studio, Import / Export shows your library as JSON. Use Copy JSON to Clipboard to share it, or paste a JSON array of functions and click Import Functions to add someone else's. Saved functions are stored in your Zlv data folder.
Related pages
- Scientific math for complex numbers, fractions, algebra and calculus.
- 2D plots to graph your functions.