GraphIt is a graphing calculator that can be operated from the terminal, or on the web here. The core engine of it is written in Rust, and compiled to WASM for the online version.
To install the calculator, you need to have Rust installed on your computer. Follow the instructions provided on the official Rust website to install Rust on your computer.
Once Rust is installed, you can clone the repository using Git:
git clone git@github.com:awoolfson/GraphIt.git
Then navigate to the project directory and run the following command to build and run the program for use in the terminal:
cargo run
If you would like to host an instance of the web page locally, you can use cargo to install wasm-pack for Rust, then run
wasm-pack build --target web
The calculator addition, subtraction, multiplication, division, trig functions, and more. To use the calculator, enter a function of the variable "x" after the the program prompts you "f(x) = ..." For example, to plot a straight horizontal line type...
x
And press enter. The calculator will display the result:
| *
| **
| **
| **
| **
| **
| **
| **
| **
| **
| **
| **
| **
| **
| **
|**
-------------------------------**-------------------------------
** |
** |
** |
** |
** |
** |
** |
** |
** |
** |
** |
** |
** |
** |
** |
The calculator supports built in functions for log(), ln(), abs(), sqrt(), sin(), cos(), and tan(). Note that each of these must be used with parenthesis. Also note that all instances of x must be lowercase. You can use exponentials with the "^" operator, multiplication with the "*" operator, and division with the "/" operator. Arguments include -xsize and -ysize, which define the mathematical size of the window. The default is 32 for each. -c allows you to choose from numerous different colors using the form "-c color", and -i generates an image inside of the images directory (see example 4).
Here are some more complicated functions to try out!
Example 1
cargo run
-x + sin(-x)
outputs...
**** |
** |
* |
* |
* |
** |
***** |
** |
* |
* |
* |
** |
***** |
** |
* |
*|
--------------------------------**------------------------------
| *
| **
| *****
| **
| *
| *
| *
| **
| *****
| **
| *
| *
| *
| **
|
Example 2
cargo run
abs(x)+-x
outputs...
|
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
*|
--------------------------------********************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example 3
cargo run
x2^sin(x)*1.2
outputs...
|
| * *
| *
|
|
| *
| * *
| *
| *
| **
| *
| ** *
| * ** *
| * **
|
|*
-----------------------------****-------------------------------
** |
|
* |
** |
* * * |
* |
|
* * * * |
* * |
* * |
* * * |
* |
|
|
* |
Example 4
cargo run -- -c cyan -i
sin(x)tan(x)
outputs...
sin(x)tan(x)
|
* | *
|
|
|
|
|
|
* | *
|
|
|
* | *
* | *
* * * | * * *
*** **** *|* **** ***
***---------***---------****----*----****---------***---------**
* * * | * * *
* | *
|
* | *
|
* | *
|
|
|
|
|
|
|
|
|