A math interpreter that is able to parse, evaluate and draw mathematical expressions and functions.
- Python3
- matplotlib package
pip install matplotlib
To play with the interpreter, copy and paste the following:
git clone https://github.com/DjoCoding/mather.git
./run.shmather features multiple things:
It will evaluate any arithmetic expression for you:
> 1 + 1
2
> (1 / 2) + 1
1.5It follows a Python-Like syntax for defining functions using the def keyword.
Here's the syntax for defining functions:
> def <name>([var,+]|var) = <expression>> def f(x) = 1 + x
f([x])
> def g(x) = cos(x) + sin(x)
g([x])> f(2)
3
> g(0)
1This is possible using the draw keyword that will draw the specified function for you
drawuses thematplotlibpackage underneath the hood, make sure to install it first.drawis only able to draw one-dimensional functions (functions with a single variable).
Here's the syntax for draw functions:
> draw(<name>, <lower_bound>, <upper_bound>, <step>)> draw(g, 0, 10, 0.001)