Debian Codegraph @

help/pt_BR/html/ch11s05.html

raw
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Numérico</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Manual do Genius"><link rel="up" href="ch11.html" title="Chapter 11. List of GEL functions"><link rel="prev" href="ch11s04.html" title="Constantes"><link rel="next" href="ch11s06.html" title="Trigonometria"></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">Numérico</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11s04.html">Prev</a> </td><th width="60%" align="center">Chapter 11. List of GEL functions</th><td width="20%" align="right"> <a accesskey="n" href="ch11s06.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-function-list-numeric"></a>Numérico</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span lang="en" class="term"><a name="gel-function-AbsoluteValue"></a>AbsoluteValue</span></dt><dd><pre lang="en" class="synopsis">AbsoluteValue (x)</pre><p lang="en">Aliases: <code class="function">abs</code></p><p lang="en">
2 Absolute value of a number and if <code class="varname">x</code> is
3 a complex value the modulus of <code class="varname">x</code>. I.e. this
4 the distance of <code class="varname">x</code> to the origin. This is equivalent
5 to <strong class="userinput"><code>|x|</code></strong>.
6 </p><p lang="en">
7 See
8 <a class="ulink" href="https://en.wikipedia.org/wiki/Absolute_value" target="_top">Wikipedia</a>,
9 <a class="ulink" href="http://planetmath.org/AbsoluteValue" target="_top">Planetmath (absolute value)</a>,
10 <a class="ulink" href="http://planetmath.org/ModulusOfComplexNumber" target="_top">Planetmath (modulus)</a>,
11 <a class="ulink" href="http://mathworld.wolfram.com/AbsoluteValue.html" target="_top">Mathworld (absolute value)</a> or
12 <a class="ulink" href="http://mathworld.wolfram.com/ComplexModulus.html" target="_top">Mathworld (complex modulus)</a>
13 for more information.
14 </p></dd><dt><span lang="en" class="term"><a name="gel-function-Chop"></a>Chop</span></dt><dd><pre lang="en" class="synopsis">Chop (x)</pre><p lang="en">Replace very small number with zero.</p></dd><dt><span lang="en" class="term"><a name="gel-function-ComplexConjugate"></a>ComplexConjugate</span></dt><dd><pre lang="en" class="synopsis">ComplexConjugate (z)</pre><p lang="en">Aliases: <code class="function">conj</code> <code class="function">Conj</code></p><p lang="en">Calculates the complex conjugate of the complex number <code class="varname">z</code>. If <code class="varname">z</code> is a vector or matrix,
15 all its elements are conjugated.</p><p lang="en">
16 See
17 <a class="ulink" href="https://en.wikipedia.org/wiki/Complex_conjugate" target="_top">Wikipedia</a> for more information.
18 </p></dd><dt><span lang="en" class="term"><a name="gel-function-Denominator"></a>Denominator</span></dt><dd><pre lang="en" class="synopsis">Denominator (x)</pre><p lang="en">Get the denominator of a rational number.</p><p lang="en">
19 See
20 <a class="ulink" href="https://en.wikipedia.org/wiki/Denominator" target="_top">Wikipedia</a> for more information.
21 </p></dd><dt><span lang="en" class="term"><a name="gel-function-FractionalPart"></a>FractionalPart</span></dt><dd><pre lang="en" class="synopsis">FractionalPart (x)</pre><p lang="en">Return the fractional part of a number.</p><p lang="en">
22 See
23 <a class="ulink" href="https://en.wikipedia.org/wiki/Fractional_part" target="_top">Wikipedia</a> for more information.
24 </p></dd><dt><span lang="en" class="term"><a name="gel-function-Im"></a>Im</span></dt><dd><pre lang="en" class="synopsis">Im (z)</pre><p lang="en">Aliases: <code class="function">ImaginaryPart</code></p><p lang="en">Get the imaginary part of a complex number. For example <strong class="userinput"><code>Re(3+4i)</code></strong> yields 4.</p><p lang="en">
25 See
26 <a class="ulink" href="https://en.wikipedia.org/wiki/Imaginary_part" target="_top">Wikipedia</a> for more information.
27 </p></dd><dt><span lang="en" class="term"><a name="gel-function-IntegerQuotient"></a>IntegerQuotient</span></dt><dd><pre lang="en" class="synopsis">IntegerQuotient (m,n)</pre><p lang="en">Division without remainder.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsComplex"></a>IsComplex</span></dt><dd><pre lang="en" class="synopsis">IsComplex (num)</pre><p lang="en">Check if argument is a complex (non-real) number. Do note that we really mean nonreal number. That is,
28 <strong class="userinput"><code>IsComplex(3)</code></strong> yields false, while
29 <strong class="userinput"><code>IsComplex(3-1i)</code></strong> yields true.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsComplexRational"></a>IsComplexRational</span></dt><dd><pre lang="en" class="synopsis">IsComplexRational (num)</pre><p lang="en">Check if argument is a possibly complex rational number. That is, if both real and imaginary parts are
30 given as rational numbers. Of course rational simply means "not stored as a floating point number."</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsFloat"></a>IsFloat</span></dt><dd><pre lang="en" class="synopsis">IsFloat (num)</pre><p lang="en">Check if argument is a real floating point number (non-complex).</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsGaussInteger"></a>IsGaussInteger</span></dt><dd><pre lang="en" class="synopsis">IsGaussInteger (num)</pre><p lang="en">Aliases: <code class="function">IsComplexInteger</code></p><p lang="en">Check if argument is a possibly complex integer. That is a complex integer is a number of
31 the form <strong class="userinput"><code>n+1i*m</code></strong> where <code class="varname">n</code> and <code class="varname">m</code>
32 are integers.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsInteger"></a>IsInteger</span></dt><dd><pre lang="en" class="synopsis">IsInteger (num)</pre><p lang="en">Check if argument is an integer (non-complex).</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsNonNegativeInteger"></a>IsNonNegativeInteger</span></dt><dd><pre lang="en" class="synopsis">IsNonNegativeInteger (num)</pre><p lang="en">Check if argument is a non-negative real integer. That is, either a positive integer or zero.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsPositiveInteger"></a>IsPositiveInteger</span></dt><dd><pre lang="en" class="synopsis">IsPositiveInteger (num)</pre><p lang="en">Aliases: <code class="function">IsNaturalNumber</code></p><p lang="en">Check if argument is a positive real integer. Note that
33 we accept the convention that 0 is not a natural number.</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsRational"></a>IsRational</span></dt><dd><pre lang="en" class="synopsis">IsRational (num)</pre><p lang="en">Check if argument is a rational number (non-complex). Of course rational simply means "not stored as a floating point number."</p></dd><dt><span lang="en" class="term"><a name="gel-function-IsReal"></a>IsReal</span></dt><dd><pre lang="en" class="synopsis">IsReal (num)</pre><p lang="en">Check if argument is a real number.</p></dd><dt><span lang="en" class="term"><a name="gel-function-Numerator"></a>Numerator</span></dt><dd><pre lang="en" class="synopsis">Numerator (x)</pre><p lang="en">Get the numerator of a rational number.</p><p lang="en">
34 See
35 <a class="ulink" href="https://en.wikipedia.org/wiki/Numerator" target="_top">Wikipedia</a> for more information.
36 </p></dd><dt><span lang="en" class="term"><a name="gel-function-Re"></a>Re</span></dt><dd><pre lang="en" class="synopsis">Re (z)</pre><p lang="en">Aliases: <code class="function">RealPart</code></p><p lang="en">Get the real part of a complex number. For example <strong class="userinput"><code>Re(3+4i)</code></strong> yields 3.</p><p lang="en">
37 See
38 <a class="ulink" href="https://en.wikipedia.org/wiki/Real_part" target="_top">Wikipedia</a> for more information.
39 </p></dd><dt><span lang="en" class="term"><a name="gel-function-Sign"></a>Sign</span></dt><dd><pre lang="en" class="synopsis">Sign (x)</pre><p lang="en">Aliases: <code class="function">sign</code></p><p lang="en">Return the sign of a number. That is returns
40 <code class="literal">-1</code> if value is negative,
41 <code class="literal">0</code> if value is zero and
42 <code class="literal">1</code> if value is positive. If <code class="varname">x</code> is a complex
43 value then <code class="function">Sign</code> returns the direction or 0.
44 </p></dd><dt><span lang="en" class="term"><a name="gel-function-ceil"></a>ceil</span></dt><dd><pre lang="en" class="synopsis">ceil (x)</pre><p lang="en">Aliases: <code class="function">Ceiling</code></p><p lang="en">Get the lowest integer more than or equal to <code class="varname">n</code>. Examples:
45 </p><pre lang="en" class="screen"><code class="prompt">genius&gt;</code> <strong class="userinput"><code>ceil(1.1)</code></strong>
46 = 2
47 <code class="prompt">genius&gt;</code> <strong class="userinput"><code>ceil(-1.1)</code></strong>
48 = -1
49 </pre><p lang="en">
50 </p><p lang="en">Note that you should be careful and notice that floating point
51 numbers are stored in binary and so may not be what you
52 expect. For example <strong class="userinput"><code>ceil(420/4.2)</code></strong>
53 returns 101 instead of the expected 100. This is because
54 4.2 is actually very slightly less than 4.2. Use rational
55 representation <strong class="userinput"><code>42/10</code></strong> if you want
56 exact arithmetic.
57 </p></dd><dt><span lang="en" class="term"><a name="gel-function-exp"></a>exp</span></dt><dd><pre lang="en" class="synopsis">exp (x)</pre><p lang="en">
58 The exponential function. This is the function
59 <strong class="userinput"><code>e^x</code></strong> where <code class="varname">e</code>
60 is the <a class="link" href="ch11s04.html#gel-function-e">base of the natural
61 logarithm</a>.
62 </p><p lang="en">
63 See
64 <a class="ulink" href="https://en.wikipedia.org/wiki/Exponential_function" target="_top">Wikipedia</a> or
65 <a class="ulink" href="http://planetmath.org/LogarithmFunction" target="_top">Planetmath</a> or
66 <a class="ulink" href="http://mathworld.wolfram.com/ExponentialFunction.html" target="_top">Mathworld</a> for more information.
67 </p></dd><dt><span lang="en" class="term"><a name="gel-function-float"></a>float</span></dt><dd><pre lang="en" class="synopsis">float (x)</pre><p lang="en">Make number a floating point value. That is returns the floating point representation of the number <code class="varname">x</code>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-floor"></a>floor</span></dt><dd><pre lang="en" class="synopsis">floor (x)</pre><p lang="en">Aliases: <code class="function">Floor</code></p><p lang="en">Get the highest integer less than or equal to <code class="varname">n</code>.</p></dd><dt><span lang="en" class="term"><a name="gel-function-ln"></a>ln</span></dt><dd><pre lang="en" class="synopsis">ln (x)</pre><p lang="en">The natural logarithm, the logarithm to base <code class="varname">e</code>.</p><p lang="en">
68 See
69 <a class="ulink" href="https://en.wikipedia.org/wiki/Natural_logarithm" target="_top">Wikipedia</a> or
70 <a class="ulink" href="http://planetmath.org/LogarithmFunction" target="_top">Planetmath</a> or
71 <a class="ulink" href="http://mathworld.wolfram.com/NaturalLogarithm.html" target="_top">Mathworld</a> for more information.
72 </p></dd><dt><span lang="en" class="term"><a name="gel-function-log"></a>log</span></dt><dd><pre lang="en" class="synopsis">log (x)</pre><pre lang="en" class="synopsis">log (x,b)</pre><p lang="en">Logarithm of <code class="varname">x</code> base <code class="varname">b</code> (calls <a class="link" href="ch11s07.html#gel-function-DiscreteLog"><code class="function">DiscreteLog</code></a> if in modulo mode), if base is not given, <a class="link" href="ch11s04.html#gel-function-e"><code class="varname">e</code></a> is used.</p></dd><dt><span lang="en" class="term"><a name="gel-function-log10"></a>log10</span></dt><dd><pre lang="en" class="synopsis">log10 (x)</pre><p lang="en">Logarithm of <code class="varname">x</code> base 10.</p></dd><dt><span lang="en" class="term"><a name="gel-function-log2"></a>log2</span></dt><dd><pre lang="en" class="synopsis">log2 (x)</pre><p lang="en">Aliases: <code class="function">lg</code></p><p lang="en">Logarithm of <code class="varname">x</code> base 2.</p></dd><dt><span lang="en" class="term"><a name="gel-function-max"></a>max</span></dt><dd><pre lang="en" class="synopsis">max (a,args...)</pre><p lang="en">Aliases: <code class="function">Max</code> <code class="function">Maximum</code></p><p lang="en">Returns the maximum of arguments or matrix.</p></dd><dt><span lang="en" class="term"><a name="gel-function-min"></a>min</span></dt><dd><pre lang="en" class="synopsis">min (a,args...)</pre><p lang="en">Aliases: <code class="function">Min</code> <code class="function">Minimum</code></p><p lang="en">Returns the minimum of arguments or matrix.</p></dd><dt><span lang="en" class="term"><a name="gel-function-rand"></a>rand</span></dt><dd><pre lang="en" class="synopsis">rand (size...)</pre><p lang="en">Generate random float in the range <code class="literal">[0,1)</code>.
73 If size is given then a matrix (if two numbers are specified) or vector (if one
74 number is specified) of the given size returned.</p></dd><dt><span lang="en" class="term"><a name="gel-function-randint"></a>randint</span></dt><dd><pre lang="en" class="synopsis">randint (max,size...)</pre><p lang="en">Generate random integer in the range
75 <code class="literal">[0,max)</code>.
76 If size is given then a matrix (if two numbers are specified) or vector (if one
77 number is specified) of the given size returned. For example,
78 </p><pre lang="en" class="screen"><code class="prompt">genius&gt;</code> <strong class="userinput"><code>randint(4)</code></strong>
79 = 3
80 <code class="prompt">genius&gt;</code> <strong class="userinput"><code>randint(4,2)</code></strong>
81 =
82 [0 1]
83 <code class="prompt">genius&gt;</code> <strong class="userinput"><code>randint(4,2,3)</code></strong>
84 =
85 [2 2 1
86 0 0 3]
87 </pre><p lang="en">
88 </p></dd><dt><span lang="en" class="term"><a name="gel-function-round"></a>round</span></dt><dd><pre lang="en" class="synopsis">round (x)</pre><p lang="en">Aliases: <code class="function">Round</code></p><p lang="en">Round a number.</p></dd><dt><span lang="en" class="term"><a name="gel-function-sqrt"></a>sqrt</span></dt><dd><pre lang="en" class="synopsis">sqrt (x)</pre><p lang="en">Aliases: <code class="function">SquareRoot</code></p><p lang="en">The square root. When operating modulo some integer will return either a <code class="constant">null</code> or a vector of the square roots. Examples:
89 </p><pre lang="en" class="screen"><code class="prompt">genius&gt;</code> <strong class="userinput"><code>sqrt(2)</code></strong>
90 = 1.41421356237
91 <code class="prompt">genius&gt;</code> <strong class="userinput"><code>sqrt(-1)</code></strong>
92 = 1i
93 <code class="prompt">genius&gt;</code> <strong class="userinput"><code>sqrt(4) mod 7</code></strong>
94 =
95 [2 5]
96 <code class="prompt">genius&gt;</code> <strong class="userinput"><code>2*2 mod 7</code></strong>
97 = 4
98 </pre><p lang="en">
99 </p><p lang="en">
100 See
101 <a class="ulink" href="https://en.wikipedia.org/wiki/Square_root" target="_top">Wikipedia</a> or
102 <a class="ulink" href="http://planetmath.org/SquareRoot" target="_top">Planetmath</a> for more information.
103 </p></dd><dt><span lang="en" class="term"><a name="gel-function-trunc"></a>trunc</span></dt><dd><pre lang="en" class="synopsis">trunc (x)</pre><p lang="en">Aliases: <code class="function">Truncate</code> <code class="function">IntegerPart</code></p><p lang="en">Truncate number to an integer (return the integer part).</p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch11s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Constantes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Trigonometria</td></tr></table></div></body></html>