kalker/cli/help.txt

76 lines
2.6 KiB
Plaintext
Raw Normal View History

2020-12-14 10:43:03 +01:00
Overview of features
Operators: +, -, *, /, !, %
2021-06-03 01:01:20 +02:00
Groups: (), ⌈⌉, ⌊⌋, []
2020-12-14 10:43:03 +01:00
Pre-defined functions and constants
User-defined functions and variables
2021-05-24 00:25:36 +02:00
Understands fairly ambiguous syntax. Eg. 2sinx + 2xy
2020-12-14 10:43:03 +01:00
Syntax highlighting
Completion for special symbols on tab
2022-03-27 21:32:50 +02:00
Sum/prod functions
2020-12-14 10:43:03 +01:00
Operators
+, -, *, /
! Factorial, eg. 5! gives 120
% Percent, eg. 5% gives 0.05, 10 + 50% gives 15
% Modulus (remainder), eg. 23 % 3 gives 2
Completion for special symbols
You can type special symbols (such as √) by typing the normal function or constant name and pressing tab.
sqrt becomes √
deg becomes °
pi becomes π
sum becomes Σ()
tau becomes τ
phi becomes ϕ
floor becomes ⌊⌋
ceil becomes ⌈⌉
gamma becomes Γ
( becomes ()
Variables
Variables are defined with the following syntax: name = value
Example: x = 3/4
Functions
Functions are defined with the following syntax: name(param1, param2, etc.) = value
Examples: f(x) = 2x+3; A(x, y) = (xy)/2
They are used like this: name(arg1, arg2, etc.)
Example: f(3) + 3A(2, 3)
2020-12-14 10:43:03 +01:00
Predefined functions
sin, cos, tan, cot, csc, sec
sinh, cosh, tanh, coth, csch, sech
asin, acos, atan, acot, acsc, asec
asinh, acosh, atanh, acoth, acsch, asech
2020-12-14 10:43:03 +01:00
abs, ceil or ⌈⌉, floor or ⌊⌋, frac, round, trunc
sqrt or √, cbrt, exp, log, ln
gamma or Γ
asinh, acosh, atanh, acoth, acsch, asech
2020-12-14 10:43:03 +01:00
min, max, hyp
log Eg. log(1000, 10) is the same as log10(1000)
root Eg. root(16, 3) is the same as 3√16
sum Eg. sum(n=1, 4, 2n), example below
2020-12-14 10:43:03 +01:00
Sum function
The sum function lets you sum an expression with an incrementing variable.
It takes three arguments: start value, end value, and expression.
If you press tab after typing out "sum", it will be replaced with a sigma symbol.
The expression is what will be summed, and will be able to use the variable defined
in first argument (eg. n=1). The value of the variable increments by one.
Example: sum(n=1, 4, 2n) will be the same as 2*1 + 2*2 + 2*3 + 2*4 = 20
This can for example be used to calculate e: Σ(n=0, 10000, 1/n!) = 2.7182818284590455
2021-06-02 22:32:30 +02:00
More precision can be gotten by changing the "--precision" flag. Run `kalker --help` for more info.
2020-12-14 10:43:03 +01:00
The sum function can also be used to sum vectors, eg. sum(1, 2, 3) or sum(v) or sum[1, 2, 3].
Prod function
The prod function works the same way as the sum function but performs
multiplication instead of addition.
2020-12-14 10:43:03 +01:00
Constants
pi or π = 3.14159265
e = 2.71828182
tau or τ = 6.2831853
2021-06-02 22:32:30 +02:00
phi or ϕ = 1.61803398