Calc | Science @ Science @ MentDB Weak
The CALC tab (scientific calculator)
A scientific calculator in the editor, connected to all the scientific functions of MentDB.
Open the calculatorWhat you can typeDisplay formatComplex numbersUnitsComputer algebraThe pages of the keypadDraw a functionVariables and resultsExamples of lines
Open the calculator
The CALC button of the toolbar of the editor opens the CALC tab: on the left a text area (one calculation per line), on the right the keypad with its pages (Calc, Const, Special, Units, Math, Stat, Matrix, Vector, Complex, Num, DSP, Plot, Arith, BigDec, Const/Unit, CAS).
Shift+Enter or the EXE key computes the current line (or the selected lines); the ALL key computes all the lines. The results are shown in the output of the editor, as for any MQL command.
Shift+Enter or the EXE key computes the current line (or the selected lines); the ALL key computes all the lines. The results are shown in the output of the editor, as for any MQL command.
What you can type
Each line is translated into an MQL command before it is sent: an expression becomes math calc, a line with units becomes unit calc, d/dx becomes math diff, integrate / solve / factor / expand / limit / series become the cas commands. A line that is already an MQL command is sent as it is.
Display format
The button AUTO / FIX / SCI / ENG of the toolbar, with the number of digits next to it, sets the display of math calc and unit calc (session variable [_format]):
AUTO: all the digits (3.972891714297857E-19)
FIX 2: 2 decimals (1234567.89)
SCI 4: 4 significant digits (3.973E-19)
ENG 3: exponent multiple of 3 (397E-21, 123E-6)
[ans] keeps all the digits, whatever the display.
AUTO: all the digits (3.972891714297857E-19)
FIX 2: 2 decimals (1234567.89)
SCI 4: 4 significant digits (3.973E-19)
ENG 3: exponent multiple of 3 (397E-21, 123E-6)
[ans] keeps all the digits, whatever the display.
Complex numbers
i is the imaginary unit: 3+4i, (1+2i)*(3-i), exp(i*pi). The keys re, im, arg, conj and abs give the parts of a complex number. An expression without a real value gives its complex value: sqrt(-4) = 2i, ln(-1) = 3.141592653589793i (principal values, as Python cmath). A complex result in [ans] or in a session variable can be used in the next lines.
Units
The Units page has the units by quantity (length, mass, time, temperature, area, volume, speed, force, energy, power, pressure, frequency, angle, data, electricity, chemistry and radiation, light); the tooltip gives the name. A key after a number inserts a space (3 m). The key -> asks for the result in a unit: 100 km/h -> m/s.
Computer algebra
The keys integrate, solve, factor, expand, limit and series of the Special page write the line for the CAS (Symja must be installed, see the page Computer algebra):
integrate x^2*sin(x) dx
integrate sin(x) dx from 0 to pi
solve x^2 = 4 for x
solve x+y = 3, x-y = 1 for x, y
factor x^2-1, expand (x+1)^3
limit sin(x)/x x -> 0
series exp(x) at x = 0 order 4
integrate x^2*sin(x) dx
integrate sin(x) dx from 0 to pi
solve x^2 = 4 for x
solve x+y = 3, x-y = 1 for x, y
factor x^2-1, expand (x+1)^3
limit sin(x)/x x -> 0
series exp(x) at x = 0 order 4
The pages of the keypad
Calc: the scientific functions, the digits, [ans], [x], -> (store in a session variable), RAD/DEG/GRAD.
Const: the CODATA constants (_c, _h, _me...), with their value and unit in the tooltip.
Special: d/dx, simplify, the imaginary unit i and re, im, arg, conj, the CAS keys, the special functions (Bessel, Legendre, gamma, zeta...).
Units: the units by quantity.
Math, Stat, Matrix, Vector, Complex, Num, DSP, Plot, Arith, BigDec, Const/Unit, CAS: each key inserts an example of the MQL command on its own line, with the first argument selected; the tooltip gives the description.
Const: the CODATA constants (_c, _h, _me...), with their value and unit in the tooltip.
Special: d/dx, simplify, the imaginary unit i and re, im, arg, conj, the CAS keys, the special functions (Bessel, Legendre, gamma, zeta...).
Units: the units by quantity.
Math, Stat, Matrix, Vector, Complex, Num, DSP, Plot, Arith, BigDec, Const/Unit, CAS: each key inserts an example of the MQL command on its own line, with the first argument selected; the tooltip gives the description.
Draw a function
The PLOT key draws the functions of the lines (one function of x per line) between the two bounds of the toolbar. With HOLD: ON in the Plot tab, the next charts are added to the current one.
Variables and results
The session variables [x], [var1]... are shared with the MQL scripts of the session: -> "[r]" 2 in a line, then [r] in the expressions. [ans] is the last result of math calc. [_angle] is the angle unit (rad, deg, grad), changed by the RAD/DEG/GRAD button; [_format] is the display format, changed by the AUTO/FIX/SCI/ENG button.
Examples of lines
An expression: + - * / ^ and the parentheses
CALC
2+3*4
sent to the server
math calc "2+3*4"
mentdb
14
Functions and constants (radians by default, RAD/DEG/GRAD button)
CALC
sqrt(2)*sin(pi/4)
sent to the server
math calc "sqrt(2)*sin(pi/4)"
mentdb
1
Store a value in a session variable
CALC
-> "[r]" 2
sent to the server
-> "[r]" 2
mentdb
2
Use the session variable
CALC
pi*[r]^2
sent to the server
math calc "pi*[r]^2"
mentdb
12.566370614359172
An operator first: the last result [ans]
CALC
*2
sent to the server
math calc "[ans]*2"
mentdb
25.132741228718345
CODATA constants: _h, _c (Const page)
CALC
_h*_c/500e-9
sent to the server
math calc "_h*_c/500e-9"
mentdb
3.972891714297857E-19
Special functions (Special page)
CALC
gamma(5)
sent to the server
math calc "gamma(5)"
mentdb
24
Bessel function
CALC
bessel_j(0, 2.5)
sent to the server
math calc "bessel_j(0, 2.5)"
mentdb
-0.04838377646819796
Complex numbers: i is the imaginary unit
CALC
(3+4i)*(1-2i)
sent to the server
math calc "(3+4i)*(1-2i)"
mentdb
11-2i
No real value: the complex value
CALC
sqrt(-4)
sent to the server
math calc "sqrt(-4)"
mentdb
2i
Modulus of a complex number (re, im, arg, conj on the Special page)
CALC
abs(3+4i)
sent to the server
math calc "abs(3+4i)"
mentdb
5
A unit after a number: the computation with units (Units page)
CALC
230 V * 10 A
sent to the server
unit calc "230 V * 10 A"
mentdb
2300 W
A target unit with -> (or to)
CALC
100 km/h -> m/s
sent to the server
unit calc "100 km/h" "m/s"
mentdb
27.7777777777778
Constants have their units
CALC
_me*_c^2 to MeV
sent to the server
unit calc "_me*_c^2" "MeV"
mentdb
0.510998950691753
Battery: mAh times V in Wh
CALC
2000 mAh * 3.7 V -> Wh
sent to the server
unit calc "2000 mAh * 3.7 V" "Wh"
mentdb
7.4
Symbolic derivative (d/dx key of the Special page)
CALC
d/dx x^2*sin(x)
sent to the server
math diff "x^2*sin(x)" "x"
mentdb
2*x*sin(x) + x^2*cos(x)
Second derivative
CALC
d2/dx2 exp(-x^2)
sent to the server
math diff "exp(-x^2)" "x" 2
mentdb
-2*exp(-x^2) + 4*x^2*exp(-x^2)
Derivative with respect to t
CALC
d/dt a*exp(-k*t)
sent to the server
math diff "a*exp(-k*t)" "t"
mentdb
-a*k*exp(-k*t)
Simplification
CALC
simplify x+x+2*x
sent to the server
math simplify "x+x+2*x"
mentdb
4*x
Primitive (integrate key, computed by Symja)
CALC
integrate x^2*sin(x) dx
sent to the server
cas integrate "x^2*sin(x)" "x"
mentdb
(computed by Symja: see the page Computer algebra)
Definite integral
CALC
integrate sin(x) dx from 0 to pi
sent to the server
cas integrate "sin(x)" "x" "0" "pi"
mentdb
(computed by Symja: see the page Computer algebra)
Solve an equation
CALC
solve x^2 = 4 for x
sent to the server
cas solve "x^2 = 4" "x"
mentdb
(computed by Symja: see the page Computer algebra)
Solve a system
CALC
solve x+y = 3, x-y = 1 for x, y
sent to the server
cas solve "[\"x+y = 3\", \"x-y = 1\"]" "[\"x\", \"y\"]"
mentdb
(computed by Symja: see the page Computer algebra)
Factor a polynomial
CALC
factor x^2-1
sent to the server
cas factor "x^2-1"
mentdb
(computed by Symja: see the page Computer algebra)
Expand
CALC
expand (x+1)^3
sent to the server
cas expand "(x+1)^3"
mentdb
(computed by Symja: see the page Computer algebra)
Limit
CALC
limit sin(x)/x x -> 0
sent to the server
cas limit "sin(x)/x" "x" "0"
mentdb
(computed by Symja: see the page Computer algebra)
Taylor series
CALC
series exp(x) at x = 0 order 4
sent to the server
cas series "exp(x)" "x" "0" 4
mentdb
(computed by Symja: see the page Computer algebra)
Any MQL command is sent as it is
CALC
stat mean "[1, 2, 3, 4]"
sent to the server
stat mean "[1, 2, 3, 4]"
mentdb
2.5
