Skip to content

Program in C for creating graphs of functions in terminal defined by arbitrary expressions

Notifications You must be signed in to change notification settings

chugunova24/terminal-draw-graph

Repository files navigation


Logo

Program in C for creating graphs of functions in terminal defined by arbitrary expressions

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contact

About The Project

Logo

Рис.1 Graph of function sin(x)


The program create a graph of function in the terminal based on a mathematical expression entered by the user. The expression parser is based on Dijkstra's algorithm for translating an expression (infix notation) into Polish notation (postfix notation). The graph is displayed, reflected horizontally, in the terminal.

The following conditions are used:

  • The size of the field for displaying graphs is a rectangle of 25 by 80 points.
  • Definition area - [0; 4 Pi]
  • Range of values - [-1; 1]
  • Orientation of the coordinate plane - the ordinate axis is directed downward, the abscissa axis is directed to the right.
  • The center of coordinates is middle of the left border (point {0, 12}).
  • Values are rounded according to the rules of mathematics
  • (back to top)

    Getting Started

    Installation

    1. Clone the repository:

      git clone https://github.com/chugunova24/terminal-draw-graph.git
    2. Go to the project folder. Create a build/ folder:

      cd terminal-draw-graph
      mkdir build
    3. Go to the build folder. Build the project using cmake:

      cd build
      cmake ../
      make

    (back to top)

    Usage

    Example 1.

    Enter the following command in the terminal:

    ./build/graph "cos(x)"

    As a result, the sin(x) graph will be displayed in the terminal:

    Logo

    Рис.2 Graph of function cos(x)

    (back to top)

    Contact

    Tatiana C. - @chugunova24 - [email protected]

    Project Link: https://github.com/chugunova24/terminal-draw-graph.git

    (back to top)

    About

    Program in C for creating graphs of functions in terminal defined by arbitrary expressions

    Topics

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published