[back to main page]

glplotter (version 1.2.1)
and gen_function (version 1.0.2)

Image from "glplotter"
Image from "glplotter"
Image from "glplotter"

glplotter draws graphs. It can generate graphs of various functions (you can specify any mathematical expression as function expression, e.g. "sin(x) + x^2").

glplotter can also load a graph from a file. This is useful if your graph data doesn't come from any mathematical expression — e.g. maybe it's some collected statistical data. Maybe your data is not even a function at all — actually any shape consisting of line segments may be displayed by glplotter.

That's pretty much everything you need to know... you can download and run glplotter now, the interface should be self-explanatory.

  1. Download
  2. Command-line parameters
  3. Graph file format
  4. Requirements
  5. gen_function
  6. Syntax of mathematical expressions

Download

Here are the binaries of the program. No special installation is required, just unpack these archives and run the program.

Sources of this program are available from this page, in case you're interested.

Command-line parameters

You can pass at command-line file names from which to load graphs. Dash (-) as filename means "standard input".

E.g. you could pipe the output of gen_function program to glplotter, like

  gen_function "sin(x)" -10 10 0.1 | glplotter -
which will display the graph of sinus for X in [-10; 10]. Commands like
  gen_function "sin(x)" -10 10 0.1 > plot.1
  gen_function "x^2" -10 10 0.1 > plot.2
  glplotter plot.1 plot.2
will display graphs of sinus and x2 at once. Of course, in case of function expressions, it's usually more comfortable to set them up inside glplotter using "Functions" menu.

Other command-line options control the initial visibility of various UI elements:

  --crosshair           --no-crosshair
  --point-coords        --no-point-coords
  --main-xy-lines       --no-main-xy-lines
  --map                 --no-map
  --grid-1              --no-grid-1
  --num-scale-1         --no-num-scale-1
  --numbers-1           --no-numbers-1
  --grid-pi             --no-grid-pi
  --num-scale-pi        --no-num-scale-pi
  --numbers-pi          --no-numbers-pi
  --grid-custom         --no-grid-custom
  --num-scale-custom    --no-num-scale-custom
  --numbers-custom      --no-numbers-custom
  --only-points         --no-only-points

Options --light and --dark allow you to choose appropriate color scheme.

Option --custom-size SIZE (or -c SIZE) specifies size for

See also standard parameters of OpenGL programs and standard parameters of all programs.

Graph file format

Graph for glplotter is actually just a set of line segments. They don't have to correspond to any function — they can show any shape, they can cross each other etc.

File format:

Whitespace at the beginning and end of the line is always ignored.

Requirements

glplotter requires:

gen_function

gen_function generates graph file from given function expression. It's seldom needed — glplotter can make a graph from function expression on it's own, see menu "Functions".

Download gen_function:

Call like:

  gen_function <function> <x1> <x2> <xstep>

This will write on standard output the graph of function <function> for x in range [<x1> ; <x2>] (with x sampled at each <xstep> distance). The graph will be in format understood by glplotter.

For example

  gen_function "x^2" 0 5 1
will write
# File generated by gen_function on 14-3-2004 at 23:34:37
#   function = x^2
#   x1 = 0
#   x2 = 5
#   xstep = 1
name=x^2
 0.0000000000000000E+0000  0.0000000000000000E+0000
 1.0000000000000000E+0000  1.0000000000000000E+0000
 2.0000000000000000E+0000  4.0000000000000000E+0000
 3.0000000000000000E+0000  9.0000000000000000E+0000
 4.0000000000000000E+0000  1.6000000000000000E+0001
 5.0000000000000000E+0000  2.5000000000000000E+0001

Sources of this program are available from this page, in case you're interested.

Syntax of mathematical expressions

Short overview of mathematical expressions syntax: this is really just normal syntax of mathematical expressions, as used in all software and resembling normal mathematical notation. When we deal with function expressions, then x represents the argument, e.g. (x+4)*3+2, sin(x) etc.


TODO: I'm sorry, below is still in Polish. Please bash me through email if you want me to move my lazy ass and translate the remainder of this page.

Czynnik to

Dwuargumentowe operatory /, *, ^, % wykonują odpowiednio dzielenie, mnożenie, potęgowanie i zwracają resztę z dzielenia (modulo). Wszystkie mają ten sam priorytet i łączą w lewo. Modulo jest liczone jako x % y = x - Floor(x/y) * y. W wyrażeniu x^y jeżeli y nie jest liczbą całkowitą to x musi być >=0.

Dwuargumentowe operatory + i - wykonują dodawanie i odejmowanie. One też łączą w lewo. Mają słabszy priorytet od operatorów multiplikatywnych powyżej, więc np. 12 + 3 * 4 daje 24.

Duże / małe litery w nazwach funkcji, stałych i zmiennych nie są rozróżniane.

Przykłady:

  sin(x) ^ 10
  2 * (cos(ln(x)) - 1)
  [sin(x) > cos(x)]
  or( [sin(x) > cos(x)], [sin(x) > 0] )