A little math interpreter in python to graph functions and equations.
This program is console only, you just need to start the main file and everithing will works. There is no need for external modules.
The syntax is similar to what you can write in a lot of others languages, there is math operators, functions and constants. Allowed symbols are all lower case ascii letters, numbers and -/*<=>^()[;]
a + b
will add a and b
a - b
will substact b to a
a * b
will multiply a peer b
a / b
will divide a peer b
a ^ b
will do a power b
a == b
will return if a equal to b
a <= b
will return if a is less than or equal to b
a >= b
will return if a is greater than or equal to b
a < b
will return if a is less than b
a > b
will return if a is grater than b
a <> b
will return if a is not equal to b
Syntax to create a new function is:
name(arg[min;max][...],...) = expression
Where:
name
is the name of the functionarg
is an argument name[min;max]
is the allowed range of the argument, if you doesn't give any number, value will be infinite:[1;]
mean "every number greater or equal than 1". You can also use open range to open range:]1;]
mean every number greater than 1.expression
is the function body
Exemples:
f(x) = 2*x
f(x[0;]) = sqrt(2 * x) + 8
f(x[;1][1;]) = 1/x
name | description |
---|---|
pi | value of pi |
e | value of exponential |
tau | value of tau (around 2pi) |
There are are all basic math functions:
- sqrt
- sin
- cos
- tan
- acos
- asin
- atan
- atan2
- factorial
- ln
- log
- exp
And some spetial functions:
name | description |
---|---|
rad | convert degrees to radians |
deg | convert radiand to degrees |
abs | return absolute value of a number |
plot | plot a function into borned graph |
plot2d | plot a 2 paramaters function into a 2d graph |
help | display function arguments and range |
sum | calculate the sum of function values in a range |
integral | calculate the integral of a function |