Skip to content
Session 1: Frida as pocket calculator

Session 1: Frida as pocket calculator

Before loading any data, Frida can be used as a powerful pocket calculator. This session introduces the expression syntax that is used throughout Frida — in data transformations, point selection, and curve fitting.

Starting Frida

Launch Frida from any directory:

$ frida
? >

The prompt ? > means no files are loaded yet.

Arithmetic

Use . followed by an expression to evaluate it:

Command Result
. 2+3 5
. 10/4 2.5
. 2^10 1024
. (1+sqrt(5))/2 1.618… (golden ratio)

The four arithmetic operators are +, -, *, /. Exponentiation is ^. Standard operator precedence applies; use parentheses to override.

Built-in functions and constants

Expression Value
. pi 3.14159…
. exp(1) 2.71828…
. sin(pi/6) 0.5
. ln(exp(3)) 3
. sqrt(2) 1.41421…
. abs(-7) 7

Arguments to functions are given in parentheses. Trigonometric functions use radians.

Functions that are undefined for certain arguments (e.g. ln(0), sqrt(-1)) return nan (not a number) rather than an error. The safe variants ln0, lg0, and sqrt0 return 0 instead of nan at the singular point.

Chaining calculations

Results are not stored automatically, but you can build up complex expressions in one line:

. 2*pi*3e8 / 500e-9     # frequency of 500 nm light (Hz)
. 1.38e-23 * 300         # k_B * T at room temperature (J)
. sqrt(9.81 * 10)        # speed after 10 m free fall (m/s)

Quitting

? > quit

You are now ready for the next session, where you will load data files and explore them.