Made by Sven Nilsen for efficient calculation purposes.
Operator | Name | Example |
: | Integers from/to | 1:3 = [1,2,3] |
; | Repeat | 1;3 = [1,1,1] |
+ | Add | 2+3 |
- | Subtract | 2-3 |
* | Multiply | 2*3 |
/ | Divide | 2/3 |
^ | Power | 2^3 |
@ | Partion, number of ways to split a quantity into specificed pieces | 10@3 |
% | Modulus | 10%3 |
< | Less Than | 2<3 = 1 |
> | Greater Than | 2>3 = 0 |
= | Equals | 2=3 = 0 |
!= | Not Equal To | 2!=3 = 1 |
<= | Less Or Equals | 2<=3 = 1 |
>= | Greater Or Equals | 2>=3 = 0 |
~ | Round to nearest | 5.6~1 = 6 |
Operator | Name | Example |
\ | Sums numbers at range | 0:9\1:3 = 6 |
\\ | Pick numbers at index or range | 1:3\\1 = 2 |
\\\ | Number except index or range | 1:3\\\1 = [1,3] |
; | Repeat pattern N times | 1:3;3 = [1,2,3,1,2,3,1,2,3] |
;; | Repeat each number by pattern | 1:3;;3 = [1,1,1,2,2,2,3,3,3] |
++ | Add | 2+3 |
-- | Subtract | 2-3 |
** | Multiply | 2*3 |
// | Divide | 1:2//3 |
^^ | Power | 2:5^^3 |
@@ | Partion, number of ways to split a quantity into specificed pieces | 10:20@@3 |
%% | Modulus | 1:7%%5 |
<< | Less Than | 2:5<<3 = [1,0,0,0] |
>> | Greater Than | 2:5>>3 = [0,0,1,1] |
== | Equals | 2:5==3 = [0,1,0,0] |
!=!= | Not Equal To | 2:5!=!=3 = [1,0,1,1] |
<=<= | Less Or Equals | 2:5<=<=3 = [1,1,0,0] |
>=>= | Greater Or Equals | 2:5>=>=3 = [0,1,1,1] |
~~ | Round to nearest | 1:6~~2 = [2,2,4,4,6,6] |
You can define vectors using '[' and ']', for example x=2 and y=3:
[2,3]
You can also define a sequence using ':', for example the numbers 1 to 10:
1:10
When substituting a sequence into a vector, use '(' and ')' around it:
[(1:10),2]
When using algebraic operations on vectors, each element is summed together:
1:4 * 2:5 = 1*2+2*3+3*4+4*5 = 40
To do the operator per dimension, use '**' instead of '*'.
1:4 ** 2:5 = [1*2,2*3,3*4,4*5] = 2,6,12,20
If you combine a vector and a scalar, the scalar will act like a vector with all same values.
1:4 ** 2 = [1,2,3,4] ** [2,2,2,2]
Notice that '--' means '+', use '++' and negative sign if needed:
1:4--3 = 1:4+3
1:4++-3 = [-2,-1,0,1]
When using the comparison functions like '<' be aware that it produces 1 for 'yes' and 0 for 'no'.
Since this is summed up when using a single sign, you are actually counting the number of objects that meet the criteria.
1:4<<3 = [1,1,0,0]
When you pass empty list to a function, it does not take up place:
sqrt([],4) = 2
Operator | Name | Example |
& | Performs AND operation on two bitstream vectors | [0,10]&[5,20] = [5,10] |
| | Performs OR operation on two bitstream vectors | [0,10]|[5,20] = [0,20] |
! | Performs NOT operation at location specified in second argument | [0,10]!2 = [0,2,10] |
_ | Performs EXCEPT operation with invert location 0 | [3,5]_[4,7] = [3,4] |
A bitstream vector i s a list of number that tells you when a default value of "false" changes to "true" and back.
For example [2,4]
means it has the value "true" from the position 2 and changes back to "false" at position 4.
The NOT operation equals removing a number if it is in the list, or adding it to the list if it is not there.
Notice that you can perform multiple NOT operations as a construction of lists:
[]!1!2!3 = [1,2,3]
1!2!3![] = [1,2,3]
[]![1,2,3] = [1,2,3]
[1,2,3]![] = [1,2,3]
The EXCEPT operator got precedence -1, which results in the following evalutation:
[0,10]_[1,2]|[4,5] = [0,10]_[1,2,4,5] = [0,1,2,4,5,10]
Operator | Name | Example |
abs | Absolute value | abs([-1,2,-3]) = [1,2,3] |
count | Count list | count([1,2,3]) = 3 |
rev | Reverse list | rev([1,2,3]) = [3,2,1] |
floor | Round down | floor(4.24) = 4 |
date | Date in format YYYYMMDDHHmmSSTT where TT is UTC time zone, starting at 24 | date() |
sqrt | Square root | sqrt(2) |
sin | Sine | sin(3) |
cos | Cosine | cos(3) |
tan | Tangent | tan(3) |
atan | Inverse tangent | atan(3) |
atan2 | Inverse tangent, x first then y | atan2([3,4]) |
fib | Fibonacci sequence | fib(1) = 2 |
prod | Product of | prod([3,4]) = 3*4 |
min | Minimum | min([3,4]) = 3 |
max | Maximum | max([3,4]) = 4 |
sigm | Sigmoid | sigm([3,4]) |
tau | Tau, circumference of a circle with radius 1 | tau() |
pi | Pi | pi() |
e | Euler's number | e() |
ln | Natural logarithm | ln(5) |
log | 10-base logarithm | log(5) |
phi | Golden ratio | phi() |
fact | Factorize | fact(25) = [5,5] |
prim | Prime Number, starting at prim(0) = 2 | prim(3) = 7 |
Operator | Name | Example |
h | Planck constant | h() |
hb | Reduced Planck constant | hb() |
c | Speed of light | c() |
lp | Planck length | lb() |
tp | Planck time | tp() |
fsc | Fine structure constant | fsc() |
gr | Gravitational constant | gr() |
Operator | Name | Example |
*** | Multiplies two matrices, must be square | [1,0, 0,1]***[2,0, 0,2] |
id | Returns an identity matrix of specified size | id(4) |
det | Returns determinant of square matrix. Limit: 50x50 | det([1,0, 0,1]) = 1 |
Operator | Name | Example |
+++ | Integrate with order | [0,1,0,0]+++1 = [0,1,1,1] |
--- | Differentiate with order | [0,1,1,1]---1 = [0,1,0,0] |
Integration and differentiation are best illustrated by example:
If you have a vector describing an acceleration at different intervals of time,
it often will look like a collection of 0's and positive numbers when force is applied.
In the following example, we apply the force 1 at the third time interval.
The integration of acceleration by time equals velocity, so by order 1 we get a new vector.
This vector describe the velocity at each time interval.
When we integrate again, or by order 2, we get the position.
[0,0,1,0,0]+++1 = [0,0,1,1,1]
[0,0,1,0,0]+++2 = [0,0,1,2,3]
This process is reversible, differentiation.
This calculator let's you differentiate with the operator '---'.
[0,0,1,1,1]---1 = [0,0,1,0,0]
[0,0,1,2,3]---2 = [0,0,1,0,0]
Operator | Name | Example |
*i | Multiply complex numbers and sum them | [1,2]*i[3,4] |
**i | Multiply each complex number couple | 1:4*i1:4 |
/i | Divide complex numbers and sum them | [1,2]/i[3,4] |
//i | Divide each complex number couple | 1:4//i1:4 |
Complex numbers are treated like couples in array, but does not have a specific tag.
I consider complex numbers as relationship between dimensions, not a specific dimension in itself.
Operator | Name | Example |
=== | Counts each left with any of the right | 1:20===10:1+0 = 10 |
When you want to check if a vector contains a range, you can use the count function to see if all the numbers on the right exists.
This require each number on the right to be unique, but it does not have to be in the same order as the left side.
x=[1,2,3,4,5,6,40]
y=1:20
count(x())++-(x()===y()+0)
An analog can be made to the hangman game, where you try to guess one letter by one.
When you have filled up the right side, then you know what the left side is from the order you guessed.
Operator | Name | Example |
hide | Hides output up to this point | hide |
x | Remember value as x | x=[4,5] x()+4 |
y | Remember value as y | y=[4,5] y()+4 |
z | Remember value as z | z=[4,5] z()+4 |
t | Remember value as t | t=[4,5] t()+4 |
When you assign the t variable and one of the x, y, z graphs will appear.
The graph is scaled to fit the bounds of the minimum and the maximum of the range.
The thought behind this design is to let the user adjust which area to look at numerically, often using the ':' operator.
x has a red color, y as a green color, z as a blue color.
When doing physics, you often want to calculate the velocity at each coordinate along a path.
Set the x,y,z,t variables to use the 'v()' function that calculates the velocity for you.
Strictly speaking, this is not functions that works like the others that takes arguments.
These functions uses the defined variables and replaces it with another expression that else would have taken much place to write.
I recommend using these functions when possible as it saves you from doing many mistakes.
Operator | Name | Example | Expression |
v | Velocity along path, x,y,z,t must be set | v() |
sqrt(((x()---1)^^2++(y()---1)^^2++(z()---1)^^2)//(t()---1)^^2) |
lor | Lorentz factor along path, x,y,z,t must be set | lor() |
(1//sqrt(1++-(v()//c())^^2)) |
lap | Laplace operator, x,y,z must be set | lap() |
((x()---2)^^2++(y()---2)^^2++(z()---2)^^2) |