Information about the CS111 EasyPieces project by Sarah Gilkinson can be found here.
This will be kept up-to-date with implementation plan, work completed, and any additional resources.
The notebook recording progress on this project can be found here.
See the project requirements for instructions on setting up your project.
This project is designed to make piecewise graphing easy and intuitive. By using a syntax as close as possible to that shown in mathematics textbooks, PiecewiseGrapher quickly produces graphs with a variety of output options.
The syntax for this language is designed to closely reflect the syntax shown in mathematics textbooks. Each line consists of three main parts - the function name, the equation, and the boundary conditions. For example, the function shown here
is represented as
f(x) = { x^2, 0 < x < 2
f(x) = { x + 3, 2 <= x < 4
f(x) = { sin(x), 4 <= x < 10
Before the functions, you can set the label for the x and y axes, the title of the graph, and the name of the file. This can be done as follows:
Filename: "Graph 1"
Title: "Distance vs Time"
xLabel: "Time"
yLabel: "Distance"
Functions can be given any name, and any variable can be used. Currently supported operations are:
- Addition
- Subtraction
- Multiplication
- Division
- Powers
- Absolute value
- Sine
- Cosine
- Square roots
- e
- pi
Limits must be presented in ascending order, with either < or <=. See sampleProgram.txt and sampleProgram2.txt for examples.
To use this program, make sure you have downloaded GNUplot and sbt. You will also need to download the source code for PiecewiseGrapher.
Once you have downloaded the project, enter the PiecewiseGrapher directory. Type
sbt compile
If there are any errors, make sure you have downloaded all dependencies and that you are connected to the internet. After this has been completed, type
sbt run
You will then be prompted to type the name of the file containing the graph you want to make. Enter the name of your own file or use one of the included examples. These examples are
samplePrograms/sampleProgram.txt
samplePrograms/sampleProgram2.txt
The graph output will be placed in the docs/img directory and will be named Graph.png if the name is not specified or GivenName.png if the name is specified.
If you encounter any strange behavior, please submit an issue.
