File: help.en

package info (click to toggle)
geg 2.0.9-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,532 kB
  • sloc: ansic: 5,756; sh: 1,269; makefile: 123; xml: 70
file content (293 lines) | stat: -rw-r--r-- 8,856 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
GEG is a numerical and graphing calculator.

1] Main features

Geg's main purpose is to draw 2D curves defined by
mathematical functions. The actual drawing appears
instantly in the main graphic window, and can be
exported to EPS, PDF or SVG formats.

Several curves and functions can be drawn on the
same graphic window. There are 4 modes:
- cartesian : y = f(x)
- polar:      t→r(t)
- parametric: t→(x,y)
- sequence:   n→u(n)

The switch is made with the ad hoc toolbar buttons
or by using the cart, polar, param, sequ special
functions, see below for more details.

The symbols x, y denote the plane coordinates, and
t is used as the variable in the parametric and polar
modes. In polar mode, t is the angle in radian, and
r is the distance to origin, namely r=sqrt(x^2+y^2).

In sequence mode, n is an integer and represents
the index of the sequence. The sequence if computed
from n=nmin to n=nmax if nmax is specified, or
within the limits of the drawing otherwise. The
parameters tmin, tmax can alternatively be used for
the same purpose.

The bottom text entry is used to specify any function
to be evaluated or drawn. All variables a-z (except
e=exp(1)=2.718... and the coordinates x, y, t, r) can
be used as extra parameters. Except for e, they are
initially set to NAN ("not a number", undefined value)
at startup, and are kept unchanged until they are 
assigned another value by some further operation, or 
the user clicks the reinitialization button. Such an 
assignment is done e.g. by

g=0.5772156649015328

Several calculations or assignments can be done in
order by separating them with ; e.g. by putting
on a single line

m=pi/6;x=cos(m*t);y=sin(2*m*t)

Each drawing can be saved in a "calculation sheet"
in the form of a *.geg file that specifies the list
of parameters to evaluate and functions to represent.
These files can later be reopened by geg.


2] List of predefined functions and operators

The following functions are recognised:
    sin       (Sine)
    cos       (Cosine)
    tan       (Tangent)
    cot       (Cotangent, also cotan)
    sec       (Secant)
    csc       (Cosecant)
    asin      (Arc-Sine, also arcsin)
    acos      (Arc-Cosine, also arccos)
    atan      (Arc-Tan, also arctan)
    acot      (Arc-Cotan, also arccot)
    acsc      (Arc-Cosecant, also acsc)
    sinc      (Sine-Cardinal = sin(pi*x)/pi*x)
    sinh      (Hyperbolic Sine)
    cosh      (Hyperbolic Cosine)
    tanh      (Hyperbolic Tangent)
    exp       (Natural exponential)
    log       (log base 10)
    ln        (Natural Log, Log base e)
    floor     (Integer part of real number)
    gamma     (Gamma function)
    sqrt      (Square Root)
    cbrt      (Cube Root)
    abs       (Absolute Value)
    sign      (Sign function)
    char      (Characteristic function x>=0)

Special functions and operators
    clip      (Restriction to >=0 values of argument)
    cut       (Restriction to  >0 values of argument)    
    cart      (Set cartesian mode)
    polar     (Set polar mode)
    param     (Set parametric mode)
    sequ      (Set sequence mode)    
    '         (Derivation operator)
    int       (Integration operator)    
    tgt       (Affine tangent operator)


The following constants are recognised:
    pi        (3.141592653....)
    e         (2.718281828....)
(but e can viewed as a parameter and can be reset).

The following binary operators are recognised:
    +         (Add)
    -         (Subtract)
    *         (Multiply)
    /         (Divide)
    ^         (Raise to the Power)
    =         (Assignment,Equations)
    
The following miscellaneous symbols are recognised:
    (         (Left Bracket)
    )         (Right Bracket)
    [         (Left Square Bracket)
    ]         (Right Square Bracket)
    {         (Left Curly Bracket)
    }         (Right Curly Bracket)
   a-z        (Variable Parameters)


3] Escape characters, directives

These modes do not produce any graphical output,
but allow some calculations or definitions to
be made.

a] Evaluation mode (?)

Evaluation is turned on (and drawing disabled) by
starting the command line with ?. In this way, geg
can be used as a basic calculator. The accuracy
corresponds to the C-type "double" , that is
approximately 16 significant digits. For example

?a=3.7;b=-1.2;a^b
will output:  = 0.208045310600227

b] Solutions of equations (=)

Any input of the form "=f(x)" initiates
a calculation of the roots of f(x)=0 by a dichotomy
method, within the interval tmin < x < tmax, or
xmin < x < xmax if tmin, tmax are not specified.

Alternatively, mouse Buttons can be used on the graphic
window to select a rectangle and launch equation
resolutions in the corresponding area. Here are the
various actions of buttons:

- Left button:    zoom to selected area
- Middle button:  find intersections f(x)=g(x)
- Right button:   solve f(x)=0

c] Definitions of parameters or functions (&)

The initial character & is used to define parameters
or functions. For instance

&c=2.31*sin(pi/7)

assigns the specified value to variable c.

Other assignable parameters include tmin, tmax, amin, amax
(ranges for t, and polar angle, respectively), e.g. via

&amax=7*pi

The special 2 letter strings fa ... fz are meant to be used
as user defined functions. Such functions can then be called
later from the calculation sheet, exactly as the predefined
functions. The syntax to define a new function fc(p) of the
variable p uses & as the initial marker: one can set e.g.

&fc(p)=sin(p*p)

Any variable a-z can be used in a function definition,
and that definition may include other parameters
(preferably not x, y, r, t which will probably vary
according to the choice of coordinates), provided they
are previously initialized to a value (otherwise the
result will be undefined). A function definition should
be isolated on its line.

If the function ff has already been defined, then

&fg=ff'

will let fg be the derivative of ff. Two related
constructions are

&fs=int_c_ff
&ft=tgt_c_ff

This defines fs(x) to be the indefinite integral of ff
navishing at c (i.e. the integral of ff taken between
c and x), and ft to be the affine linear function that
represents the tangent to y=ff(x) at point x=c, namely

ft(x)=ff'(c)(x-c) + ff(c)

c is used here as a formal parameter that has to be set
prior to actually draw the primitive function,
respectively the tangent function, e.g. by putting

&c=0;
fs(x)
&c=2*pi
ft(x)

The special parmeters der_step, tgt_right, tgt_left
are respectively the relative step used to perform
numerical differentiation (0.001 by default), the
relative size of the tangential segment to be drawn
on the right side and on the left side (default value
is 100 which yields an infinite tangent half-line on
the corresponding side). Finally, int_step is the
absolute value of the integration step (0.005 by
default). One can e.g. set

&der_step=0.003
&int_step=0.002
&tgt_left=0;tgt_right=100

The last setting corresponds to an infinite right
half-tangent.

The gap parameter is used to detect singularities
and discontinuities. The default value is

&gap=1.0

Smaller values of the gap increase sensitivity
but may lead to losing parts of the graph around
the points of discontinuity.

d] Linewidth and color of curves

The directives

&lw=0.35
&color=127096008

which can be concatened with the character ; in between

&lw=0.35;color=127096008

specify a linewidth equal to 0.35 and a RGB color with
red=127/255, green=96/255, blue=8/255. They apply for the
curves that are subsequently drawn, until new values of
those parameters are set.

The lw and color parameters are considered unspecified
if they are given negative values, e.g. -1. In that case
geg uses the global default value lw=0.5 and the default
color scheme according to the index of the curve.

The color and linewidth of the axes, and the color of
the numerical values of x, y, t can be specified from
the "Preferences" dialog.

e] Sequences

The "sequence mode" can be started via the directive

&sequ

In this setting, the special parameter 'ptrad' indicates
the radius of points representing the values (n,u(n)) of
the sequence. The parameter is set by putting e.g.

&ptrad=2

The parameters nmin and nmax can be used to specify the
interval in which the sequence is to be computed:

&nmin=3

f] Comments

Any string starting by # is a comment. Such a
string is reproduced verbatim in the calculation
sheet without generating any action. Blank lines
can be entered by a 2 character string ##.


4] Formal symbolic expressions in geg

The Extended Backus Naur Notation (EBNF) used in geg is:
    <expression> ::= [ + | - ] <term>   { + | - <term> }
    <term>       ::= <factor> { * | / | ^ <factor> }
    <factor>     ::= <number> | <function> | (<expression>)
    <number>     ::= <float> | e pi | a-z
    <function>   ::= <function_name>(<expression>);