Debian Codegraph @

help/de/html/ch05.html

raw symbols SCIP
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 5. GEL-Grundlagen</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius-Handbuch"><link rel="up" href="index.html" title="Genius-Handbuch"><link rel="prev" href="ch04s05.html" title="2D-Darstellungen"><link rel="next" href="ch05s02.html" title="Verwendung von Variablen"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. GEL-Grundlagen</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="genius-gel"></a>Chapter 5. GEL-Grundlagen</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch05.html#genius-gel-values">Werte</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05.html#genius-gel-values-numbers">Zahlen</a></span></dt><dt><span class="sect2"><a href="ch05.html#genius-gel-values-booleans">Wahrheitswerte</a></span></dt><dt><span class="sect2"><a href="ch05.html#genius-gel-values-strings">Strings</a></span></dt><dt><span class="sect2"><a href="ch05.html#genius-gel-values-null">Null</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05s02.html">Verwendung von Variablen</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05s02.html#genius-gel-variables-setting">Setzen von Variablen</a></span></dt><dt><span class="sect2"><a href="ch05s02.html#genius-gel-variables-built-in">Eingebaute Variablen</a></span></dt><dt><span class="sect2"><a href="ch05s02.html#genius-gel-previous-result">Vorherige Ergebnisvariable</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05s03.html">Verwendung von Funktionen</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05s03.html#genius-gel-functions-defining">Definieren von Funktionen</a></span></dt><dt><span class="sect2"><a href="ch05s03.html#genius-gel-functions-variable-argument-lists">Variable Argument Lists</a></span></dt><dt><span class="sect2"><a href="ch05s03.html#genius-gel-functions-passing-functions">Übergabe von Funktionen an Funktionen</a></span></dt><dt><span class="sect2"><a href="ch05s03.html#genius-gel-functions-operations">Operationen mit Funktionen</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05s04.html">Trenner</a></span></dt><dt><span class="sect1"><a href="ch05s05.html">Kommentare</a></span></dt><dt><span class="sect1"><a href="ch05s06.html">Modulare Auswertung</a></span></dt><dt><span class="sect1"><a href="ch05s07.html">Liste der GEL-Operatoren</a></span></dt></dl></div><p lang="en">
2 GEL stands for Genius Extension Language. It is the language you use
3 to write programs in Genius. A program in GEL is simply an
4 expression that evaluates to a number, a matrix, or another object
5 in GEL.
6 <span class="application">Genius Mathematics Tool</span> can be used as a simple calculator, or as a
7 powerful theoretical research tool. The syntax is meant to
8 have as shallow of a learning curve as possible, especially for use
9 as a calculator.
10 </p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-values"></a>Werte</h2></div></div></div><p lang="en">
11 Values in GEL can be <a class="link" href="ch05.html#genius-gel-values-numbers" title="Zahlen">numbers</a>, <a class="link" href="ch05.html#genius-gel-values-booleans" title="Wahrheitswerte">Booleans</a>, or <a class="link" href="ch05.html#genius-gel-values-strings" title="Strings">strings</a>. GEL also treats
12 <a class="link" href="ch08.html" title="Chapter 8. Matrizen in GEL">matrices</a> as values.
13 Values can be used in calculations, assigned to variables and returned from functions, among other uses.
14 </p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="genius-gel-values-numbers"></a>Zahlen</h3></div></div></div><p lang="en">
15 Integers are the first type of number in GEL. Integers are written in the normal way.
16 </p><pre lang="en" class="programlisting">1234
17 </pre><p lang="en">
18 Hexadecimal and octal numbers can be written using C notation. For example:
19 </p><pre lang="en" class="programlisting">0x123ABC
20 01234
21 </pre><p lang="en">
22 Or you can type numbers in an arbitrary base using <code class="literal">&lt;base&gt;\&lt;number&gt;</code>. Digits higher than 10 use letters in a similar way to hexadecimal. For example, a number in base 23 could be written:
23 </p><pre lang="en" class="programlisting">23\1234ABCD
24 </pre><p lang="en">
25 </p><p lang="en">
26 The second type of GEL number is rationals. Rationals are simply achieved by dividing two integers. So one could write:
27 </p><pre lang="en" class="programlisting">3/4
28 </pre><p lang="en">
29 to get three quarters. Rationals also accept mixed fraction notation. So in order to get one and three tenths you could write:
30 </p><pre lang="en" class="programlisting">1 3/10
31 </pre><p lang="en">
32 </p><p lang="en">
33 The next type of number is floating point. These are entered in a similar fashion to C notation. You can use <code class="literal">E</code>, <code class="literal">e</code> or <code class="literal">@</code> as the exponent delimiter. Note that using the exponent delimiter gives a float even if there is no decimal point in the number. Examples:
34 </p><pre lang="en" class="programlisting">1.315
35 7.887e77
36 7.887e-77
37 .3
38 0.3
39 77e5
40 </pre><p lang="en">
41 When Genius prints a floating point number it will always append a
42 <code class="computeroutput">.0</code> even if the number is whole. This is to indicate that
43 floating point numbers are taken as imprecise quantities. When a number is written in the
44 scientific notation, it is always a floating point number and thus Genius does not
45 print the <code class="computeroutput">.0</code>.
46 </p><p lang="en">
47 The final type of number in GEL is the complex numbers. You can enter a complex number as a sum of real and imaginary parts. To add an imaginary part, append an <code class="literal">i</code>. Here are examples of entering complex numbers:
48 </p><pre lang="en" class="programlisting">1+2i
49 8.01i
50 77*e^(1.3i)
51 </pre><p lang="en">
52 </p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p lang="en">
53 When entering imaginary numbers, a number must be in front of the <code class="literal">i</code>. If you use <code class="literal">i</code> by itself, Genius will interpret this as referring to the variable <code class="varname">i</code>. If you need to refer to <code class="literal">i</code> by itself, use <code class="literal">1i</code> instead.
54 </p><p lang="en">
55 In order to use mixed fraction notation with imaginary numbers you must have the mixed fraction in parentheses. (i.e., <strong class="userinput"><code>(1 2/5)i</code></strong>)
56 </p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="genius-gel-values-booleans"></a>Wahrheitswerte</h3></div></div></div><p lang="en">
57 Genius also supports native Boolean values. The two Boolean constants are
58 defined as <code class="constant">true</code> and <code class="constant">false</code>; these
59 identifiers can be used like any other variable. You can also use the
60 identifiers <code class="constant">True</code>, <code class="constant">TRUE</code>,
61 <code class="constant">False</code> and <code class="constant">FALSE</code> as aliases for the
62 above.
63 </p><p lang="en">
64 At any place where a Boolean expression is expected, you can use a Boolean
65 value or any expression that produces either a number or a Boolean. If
66 Genius needs to evaluate a number as a Boolean it will interpret
67 0 as <code class="constant">false</code> and any other number as
68 <code class="constant">true</code>.
69 </p><p lang="en">
70 In addition, you can do arithmetic with Boolean values. For example:
71 </p><pre lang="en" class="programlisting">( (1 + true) - false ) * true
72 </pre><p lang="en">
73 is the same as:
74 </p><pre lang="en" class="programlisting">( (true or true) or not false ) and true
75 </pre><p lang="en">
76 Only addition, subtraction and multiplication are supported. If you mix numbers with Booleans in an expression then the numbers are converted to Booleans as described above. This means that, for example:
77 </p><pre lang="en" class="programlisting">1 == true
78 </pre><p lang="en">
79 always evaluates to <code class="constant">true</code> since 1 will be converted to <code class="constant">true</code> before being compared to <code class="constant">true</code>.
80 </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="genius-gel-values-strings"></a>Strings</h3></div></div></div><p lang="en">
81 Like numbers and Booleans, strings in GEL can be stored as values inside variables and passed to functions. You can also concatenate a string with another value using the plus operator. For example:
82 </p><pre lang="en" class="programlisting">a=2+3;"The result is: "+a
83 </pre><p lang="en">
84 will create the string:
85 </p><pre lang="en" class="programlisting">The result is: 5
86 </pre><p lang="en">
87 You can also use C-like escape sequences such as <code class="literal">\n</code>,<code class="literal">\t</code>,<code class="literal">\b</code>,<code class="literal">\a</code> and <code class="literal">\r</code>. To get a <code class="literal">\</code> or <code class="literal">"</code> into the string you can quote it with a <code class="literal">\</code>. For example:
88 </p><pre lang="en" class="programlisting">"Slash: \\ Quotes: \" Tabs: \t1\t2\t3"
89 </pre><p lang="en">
90 will make a string:
91 </p><pre lang="en" class="programlisting">Slash: \ Quotes: " Tabs: 1 2 3
92 </pre><p lang="en">
93 Do note however that when a string is returned from a function, escapes are
94 quoted, so that the output can be used as input. If you wish to print the
95 string as it is (without escapes), use the
96 <a class="link" href="ch11s02.html#gel-function-print"><code class="function">print</code></a>
97 or
98 <a class="link" href="ch11s02.html#gel-function-printn"><code class="function">printn</code></a> functions.
99 </p><p lang="en">
100 In addition, you can use the library function <a class="link" href="ch11s02.html#gel-function-string"><code class="function">string</code></a> to convert anything to a string. For example:
101 </p><pre lang="en" class="programlisting">string(22)
102 </pre><p lang="en">
103 will return
104 </p><pre lang="en" class="programlisting">"22"
105 </pre><p lang="en">
106 Strings can also be compared with <code class="literal">==</code> (equal), <code class="literal">!=</code> (not equal) and <code class="literal">&lt;=&gt;</code> (comparison) operators
107 </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="genius-gel-values-null"></a>Null</h3></div></div></div><p lang="en">
108 There is a special value called
109 <code class="constant">null</code>. No operations can be performed on
110 it, and nothing is printed when it is returned. Therefore,
111 <code class="constant">null</code> is useful when you do not want output from an
112 expression. The value <code class="constant">null</code> can be obtained as an expression when you
113 type <code class="literal">.</code>, the constant <code class="constant">null</code> or nothing.
114 By nothing we mean that if you end an expression with
115 a separator <code class="literal">;</code>, it is equivalent to ending it with a
116 separator followed by a <code class="constant">null</code>.
117 </p><p lang="en">
118 Example:
119 </p><pre lang="en" class="programlisting">x=5;.
120 x=5;
121 </pre><p lang="en">
122 </p><p lang="en">
123 Some functions return <code class="constant">null</code> when no value can be returned
124 or an error happened. Also <code class="constant">null</code> is used as an empty vector
125 or matrix, or an empty reference.
126 </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2D-Darstellungen </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Verwendung von Variablen</td></tr></table></div></body></html>