File: maxima_48.html

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (562 lines) | stat: -rw-r--r-- 26,266 bytes parent folder | download | duplicates (2)
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Maxima 5.47.0 Manual: Functions for Numbers</title>

<meta name="description" content="Maxima 5.47.0 Manual: Functions for Numbers">
<meta name="keywords" content="Maxima 5.47.0 Manual: Functions for Numbers">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="maxima_toc.html#Top" rel="start" title="Top">
<link href="maxima_423.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
<link href="maxima_toc.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="maxima_47.html#Elementary-Functions" rel="up" title="Elementary Functions">
<link href="maxima_49.html#Functions-for-Complex-Numbers" rel="next" title="Functions for Complex Numbers">
<link href="maxima_47.html#Elementary-Functions" rel="previous" title="Elementary Functions">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
body {color: black; background: white;  margin-left: 8%; margin-right: 13%;
      font-family: "FreeSans", sans-serif}
h1 {font-size: 150%; font-family: "FreeSans", sans-serif}
h2 {font-size: 125%; font-family: "FreeSans", sans-serif}
h3 {font-size: 100%; font-family: "FreeSans", sans-serif}
a[href] {color: rgb(0,0,255); text-decoration: none;}
a[href]:hover {background: rgb(220,220,220);}
div.textbox {border: solid; border-width: thin; padding-top: 1em;
    padding-bottom: 1em; padding-left: 2em; padding-right: 2em}
div.titlebox {border: none; padding-top: 1em; padding-bottom: 1em;
    padding-left: 2em; padding-right: 2em; background: rgb(200,255,255);
    font-family: sans-serif}
div.synopsisbox {
    border: none; padding-top: 1em; padding-bottom: 1em; padding-left: 2em;
    padding-right: 2em; background: rgb(255,220,255);}
pre.example {border: 1px solid rgb(180,180,180); padding-top: 1em;
    padding-bottom: 1em; padding-left: 1em; padding-right: 1em;
    background-color: rgb(238,238,255)}
div.spacerbox {border: none; padding-top: 2em; padding-bottom: 2em}
div.image {margin: 0; padding: 1em; text-align: center}
div.categorybox {border: 1px solid gray; padding-top: 1em; padding-bottom: 1em;
    padding-left: 1em; padding-right: 1em; background: rgb(247,242,220)}
img {max-width:80%; max-height: 80%; display: block; margin-left: auto; margin-right: auto}

-->
</style>

<link rel="icon" href="figures/favicon.ico">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6>"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Functions-for-Numbers"></a>
<div class="header">
<p>
Next: <a href="maxima_49.html#Functions-for-Complex-Numbers" accesskey="n" rel="next">Functions for Complex Numbers</a>, Up: <a href="maxima_47.html#Elementary-Functions" accesskey="u" rel="up">Elementary Functions</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-for-Numbers-1"></a>
<h3 class="section">10.1 Functions for Numbers</h3>

<a name="abs"></a><a name="Item_003a-MathFunctions_002fdeffn_002fabs"></a><dl>
<dt><a name="index-abs"></a>Function: <strong>abs</strong> <em>(<var>z</var>)</em></dt>
<dd>
<p>The <code>abs</code> function represents the mathematical absolute value function and
works for both numerical and symbolic values. If the argument, <var>z</var>, is a
real or complex number, <code>abs</code> returns the absolute value of <var>z</var>. If
possible, symbolic expressions using the absolute value function are
also simplified.
</p>
<p>Maxima can differentiate, integrate and calculate limits for expressions
containing <code>abs</code>. The <code>abs_integrate</code> package further extends
Maxima&rsquo;s ability to calculate integrals involving the abs function. See
(%i12) in the examples below.
</p>
<p>When applied to a list or matrix, <code>abs</code> automatically distributes over
the terms. Similarly, it distributes over both sides of an
equation. To alter this behaviour, see the variable <code><a href="maxima_46.html#distribute_005fover">distribute_over</a></code>.
</p>
<p>See also <code><a href="maxima_49.html#cabs">cabs</a></code>.
</p>
<p>Examples:
</p>
<p>Calculation of <code>abs</code> for real and complex numbers, including numerical
constants and various infinities. The first example shows how <code>abs</code>
distributes over the elements of a list.
</p>
<div class="example">
<pre class="example">(%i1) abs([-4, 0, 1, 1+%i]);
(%o1)                  [4, 0, 1, sqrt(2)]

(%i2) abs((1+%i)*(1-%i));
(%o2)                           2
(%i3) abs(%e+%i);
                                2
(%o3)                    sqrt(%e  + 1)
(%i4) abs([inf, infinity, minf]);
(%o4)                   [inf, inf, inf]
</pre></div>

<p>Simplification of expressions containing <code>abs</code>:
</p>
<div class="example">
<pre class="example">(%i5) abs(x^2);
                                2
(%o5)                          x
(%i6) abs(x^3);
                             2
(%o6)                       x  abs(x)

(%i7) abs(abs(x));
(%o7)                       abs(x)
(%i8) abs(conjugate(x));
(%o8)                       abs(x)
</pre></div>

<p>Integrating and differentiating with the <code>abs</code> function. Note that more
integrals involving the <code>abs</code> function can be performed, if the
<code>abs_integrate</code> package is loaded. The last example shows the Laplace
transform of <code>abs</code>: see <code><a href="maxima_104.html#laplace">laplace</a></code>.
</p>
<div class="example">
<pre class="example">(%i9) diff(x*abs(x),x),expand;
(%o9)                       2 abs(x)

(%i10) integrate(abs(x),x);
                             x abs(x)
(%o10)                       --------
                                2

(%i11) integrate(x*abs(x),x);
                           /
                           [
(%o11)                     I x abs(x) dx
                           ]
                           /

(%i12) load(&quot;abs_integrate&quot;)$
(%i13) integrate(x*abs(x),x);
                      2           3
                     x  abs(x)   x  signum(x)
(%o13)               --------- - ------------
                         2            6

(%i14) integrate(abs(x),x,-2,%pi);
                               2
                            %pi
(%o14)                      ---- + 2
                             2

(%i15) laplace(abs(x),x,s);
                               1
(%o15)                         --
                                2
                               s
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="ceiling"></a><a name="Item_003a-MathFunctions_002fdeffn_002fceiling"></a><dl>
<dt><a name="index-ceiling"></a>Function: <strong>ceiling</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>When <var>x</var> is a real number, return the least integer that 
is greater than or equal to <var>x</var>.
</p>
<p>If <var>x</var> is a constant expression (<code>10 * %pi</code>, for example), 
<code>ceiling</code> evaluates <var>x</var> using big floating point numbers, and 
applies <code>ceiling</code> to the resulting big float.  Because <code>ceiling</code> uses
floating point evaluation, it&rsquo;s possible, although unlikely, that <code>ceiling</code>
could return an erroneous value for constant inputs.  To guard against errors,
the floating point evaluation is done using three values for <code><a href="maxima_13.html#fpprec">fpprec</a></code>.
</p>
<p>For non-constant inputs, <code>ceiling</code> tries to return a simplified value.
Here are examples of the simplifications that <code>ceiling</code> knows about:
</p>
<div class="example">
<pre class="example">(%i1) ceiling (ceiling (x));
(%o1)                      ceiling(x)
</pre><pre class="example">(%i2) ceiling (floor (x));
(%o2)                       floor(x)
</pre><pre class="example">(%i3) declare (n, integer)$
</pre><pre class="example">(%i4) [ceiling (n), ceiling (abs (n)), ceiling (max (n, 6))];
(%o4)                [n, abs(n), max(6, n)]
</pre><pre class="example">(%i5) assume (x &gt; 0, x &lt; 1)$
</pre><pre class="example">(%i6) ceiling (x);
(%o6)                           1
</pre><pre class="example">(%i7) tex (ceiling (a));
$$\left \lceil a \right \rceil$$
(%o7)                         false
</pre></div>

<p>The <code>ceiling</code> function distributes over lists, matrices and equations.
See <code><a href="maxima_46.html#distribute_005fover">distribute_over</a></code>.
</p>
<p>Finally, for all inputs that are manifestly complex, <code>ceiling</code> returns 
a noun form.
</p>
<p>If the range of a function is a subset of the integers, it can be declared to
be <code>integervalued</code>.  Both the <code>ceiling</code> and <code><a href="#floor">floor</a></code> functions
can use this information; for example:
</p>
<div class="example">
<pre class="example">(%i1) declare (f, integervalued)$
</pre><pre class="example">(%i2) floor (f(x));
(%o2)                         f(x)
</pre><pre class="example">(%i3) ceiling (f(x) - 1);
(%o3)                       f(x) - 1
</pre></div>

<p>Example use:
</p>
<div class="example">
<pre class="example">(%i1) unitfrac(r) := block([uf : [], q],
    if not(ratnump(r)) then
       error(&quot;unitfrac: argument must be a rational number&quot;),
    while r # 0 do (
        uf : cons(q : 1/ceiling(1/r), uf),
        r : r - q),
    reverse(uf));
(%o1) unitfrac(r) := block([uf : [], q], 
if not ratnump(r) then
error(&quot;unitfrac: argument must be a rational number&quot;), 
                                  1
while r # 0 do (uf : cons(q : ----------, uf), r : r - q), 
                                      1
                              ceiling(-)
                                      r
reverse(uf))
</pre><pre class="example">(%i2) unitfrac (9/10);
                            1  1  1
(%o2)                      [-, -, --]
                            2  3  15
</pre><pre class="example">(%i3) apply (&quot;+&quot;, %);
                               9
(%o3)                          --
                               10
</pre><pre class="example">(%i4) unitfrac (-9/10);
                                  1
(%o4)                       [- 1, --]
                                  10
</pre><pre class="example">(%i5) apply (&quot;+&quot;, %);
                                9
(%o5)                         - --
                                10
</pre><pre class="example">(%i6) unitfrac (36/37);
                        1  1  1  1    1
(%o6)                  [-, -, -, --, ----]
                        2  3  8  69  6808
</pre><pre class="example">(%i7) apply (&quot;+&quot;, %);
                               36
(%o7)                          --
                               37
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="entier"></a><a name="Item_003a-MathFunctions_002fdeffn_002fentier"></a><dl>
<dt><a name="index-entier"></a>Function: <strong>entier</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>Returns the largest integer less than or equal to <var>x</var> where <var>x</var> is
numeric.  <code><a href="#fix">fix</a></code> (as in <code>fixnum</code>) is a synonym for this, so
<code>fix(<var>x</var>)</code> is precisely the same.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="floor"></a><a name="Item_003a-MathFunctions_002fdeffn_002ffloor"></a><dl>
<dt><a name="index-floor"></a>Function: <strong>floor</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>When <var>x</var> is a real number, return the largest integer that is less than or
equal to <var>x</var>.
</p>
<p>If <var>x</var> is a constant expression (<code>10 * %pi</code>, for example), <code>floor</code>
evaluates <var>x</var> using big floating point numbers, and applies <code>floor</code> to
the resulting big float. Because <code>floor</code> uses floating point evaluation,
it&rsquo;s possible, although unlikely, that <code>floor</code> could return an erroneous
value for constant inputs.  To guard against errors, the floating point
evaluation is done using three values for <code><a href="maxima_13.html#fpprec">fpprec</a></code>.
</p>
<p>For non-constant inputs, <code>floor</code> tries to return a simplified value.  Here
are examples of the simplifications that <code>floor</code> knows about:
</p>
<div class="example">
<pre class="example">(%i1) floor (ceiling (x));
(%o1)                      ceiling(x)
</pre><pre class="example">(%i2) floor (floor (x));
(%o2)                       floor(x)
</pre><pre class="example">(%i3) declare (n, integer)$
</pre><pre class="example">(%i4) [floor (n), floor (abs (n)), floor (min (n, 6))];
(%o4)                [n, abs(n), min(6, n)]
</pre><pre class="example">(%i5) assume (x &gt; 0, x &lt; 1)$
</pre><pre class="example">(%i6) floor (x);
(%o6)                           0
</pre><pre class="example">(%i7) tex (floor (a));
$$\left \lfloor a \right \rfloor$$
(%o7)                         false
</pre></div>

<p>The <code>floor</code> function distributes over lists, matrices and equations.
See <code><a href="maxima_46.html#distribute_005fover">distribute_over</a></code>.
</p>
<p>Finally, for all inputs that are manifestly complex, <code>floor</code> returns 
a noun form.
</p>
<p>If the range of a function is a subset of the integers, it can be declared to
be <code>integervalued</code>.  Both the <code><a href="#ceiling">ceiling</a></code> and <code>floor</code> functions
can use this information; for example:
</p>
<div class="example">
<pre class="example">(%i1) declare (f, integervalued)$
</pre><pre class="example">(%i2) floor (f(x));
(%o2)                         f(x)
</pre><pre class="example">(%i3) ceiling (f(x) - 1);
(%o3)                       f(x) - 1
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="fix"></a><a name="Item_003a-MathFunctions_002fdeffn_002ffix"></a><dl>
<dt><a name="index-fix"></a>Function: <strong>fix</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>A synonym for <code>entier (<var>x</var>)</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="hstep"></a><a name="Item_003a-MathFunctions_002fdeffn_002fhstep"></a><dl>
<dt><a name="index-hstep"></a>Function: <strong>hstep</strong> <em>(<var>x</var>)</em></dt>
<dd><p>The Heaviside unit step function, equal to 0 if <var>x</var> is negative,
equal to 1 if <var>x</var> is positive and equal to 1/2 if <var>x</var> is equal
to zero.
</p>
<p>If you want a unit step function that takes on the value of 0 at <var>x</var>
equal to zero, use <code><a href="maxima_338.html#unit_005fstep">unit_step</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Laplace-transform">Laplace transform</a>
&middot;<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div>
</dd></dl>

<a name="lmax"></a><a name="Item_003a-MathFunctions_002fdeffn_002flmax"></a><dl>
<dt><a name="index-lmax"></a>Function: <strong>lmax</strong> <em>(<var>L</var>)</em></dt>
<dd>
<p>When <var>L</var> is a list or a set, return <code>apply ('max, args (<var>L</var>))</code>.
When <var>L</var> is not a list or a set, signal an error.
See also <code><a href="#lmin">lmin</a></code> and <code><a href="#max">max</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;<a href="maxima_424.html#Category_003a-Lists">Lists</a>
&middot;<a href="maxima_424.html#Category_003a-Sets">Sets</a>
&middot;</div></dd></dl>

<a name="lmin"></a><a name="Item_003a-MathFunctions_002fdeffn_002flmin"></a><dl>
<dt><a name="index-lmin"></a>Function: <strong>lmin</strong> <em>(<var>L</var>)</em></dt>
<dd>
<p>When <var>L</var> is a list or a set, return <code>apply ('min, args (<var>L</var>))</code>.
When <var>L</var> is not a list or a set, signal an error.
See also <code><a href="#lmax">lmax</a></code> and <code><a href="#min">min</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;<a href="maxima_424.html#Category_003a-Lists">Lists</a>
&middot;<a href="maxima_424.html#Category_003a-Sets">Sets</a>
&middot;</div></dd></dl>

<a name="max"></a><a name="Item_003a-MathFunctions_002fdeffn_002fmax"></a><dl>
<dt><a name="index-max"></a>Function: <strong>max</strong> <em>(<var>x_1</var>, &hellip;, <var>x_n</var>)</em></dt>
<dd>
<p>Return a simplified value for the numerical maximum of the expressions <var>x_1</var> 
through <var>x_n</var>. For an empty argument list, <code>max</code> yields <code>minf</code>.
</p>
<p>The option variable <code>maxmin_effort</code> controls which simplification methods are 
applied. Using the default value of <em>twelve</em> for <code>maxmin_effort</code>, 
<code>max</code> uses <em>all</em> available simplification methods. To to inhibit all 
simplifications, set <code>maxmin_effort</code> to zero.
</p>
<p>When <code>maxmin_effort</code> is one or more, for an explicit list of real numbers, 
<code>max</code> returns a number. 
</p>
<p>Unless <code>max</code> needs to simplify a lengthy list of expressions, we suggest using 
the default value of <code>maxmin_effort</code>. Setting <code>maxmin_effort</code> to zero 
(no simplifications), will cause problems for some Maxima functions; accordingly, 
generally <code>maxmin_effort</code> should be nonzero.
</p>
<p>See also <code><a href="#min">min</a></code>, <code><a href="#lmax">lmax</a></code>., and <code><a href="#lmin">lmin</a></code>..
</p>
<p><b>Examples:</b>
</p>
<p>In the first example, setting <code>maxmin_effort</code> to zero suppresses simplifications.
</p><div class="example">
<pre class="example">(%i1) block([maxmin_effort : 0], max(1,2,x,x, max(a,b)));
(%o1) max(1,2,max(a,b),x,x)

(%i2) block([maxmin_effort : 1], max(1,2,x,x, max(a,b)));
(%o2) max(2,a,b,x)
</pre></div>

<p>When <code>maxmin_effort</code> is two or more, <code>max</code> compares pairs of members:
</p><div class="example">
<pre class="example">(%i1) block([maxmin_effort : 1], max(x,x+1,x+3));
(%o1) max(x,x+1,x+3)

(%i2) block([maxmin_effort : 2], max(x,x+1,x+3));
(%o2) x+3
</pre></div>

<p>Finally, when <code>maxmin_effort</code> is three or more, <code>max</code> compares triples 
members and excludes those that are in between; for example
</p><div class="example">
<pre class="example">(%i1) block([maxmin_effort : 4], max(x, 2*x, 3*x, 4*x));
(%o1) max(x,4*x)
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="min"></a><a name="Item_003a-MathFunctions_002fdeffn_002fmin"></a><dl>
<dt><a name="index-min"></a>Function: <strong>min</strong> <em>(<var>x_1</var>, &hellip;, <var>x_n</var>)</em></dt>
<dd>
<p>Return a simplified value for the numerical minimum of the expressions <var>x_1</var> 
through <var>x_n</var>. For an empty argument list, <code>minf</code> yields <code>inf</code>.
</p>
<p>The option variable <code>maxmin_effort</code> controls which simplification methods are 
applied. Using the default value of <em>twelve</em> for <code>maxmin_effort</code>, 
<code>max</code> uses <em>all</em> available simplification methods. To to inhibit all 
simplifications, set <code>maxmin_effort</code> to zero.
</p>
<p>When <code>maxmin_effort</code> is one or more, for an explicit list of real numbers, 
<code>min</code> returns a number. 
</p>
<p>Unless <code>min</code> needs to simplify a lengthy list of expressions, we suggest using 
the default value of <code>maxmin_effort</code>. Setting <code>maxmin_effort</code> to zero 
(no simplifications), will cause problems for some Maxima functions; accordingly, 
generally <code>maxmin_effort</code> should be nonzero.
</p>
<p>See also <code><a href="#max">max</a></code>, <code><a href="#lmax">lmax</a></code>., and <code><a href="#lmin">lmin</a></code>..
</p>
<p><b>Examples:</b>
</p>
<p>In the first example, setting <code>maxmin_effort</code> to zero suppresses simplifications.
</p><div class="example">
<pre class="example">(%i1) block([maxmin_effort : 0], min(1,2,x,x, min(a,b)));
(%o1) min(1,2,a,b,x,x)

(%i2) block([maxmin_effort : 1], min(1,2,x,x, min(a,b)));
(%o2) min(1,a,b,x)
</pre></div>

<p>When <code>maxmin_effort</code> is two or more, <code>min</code> compares pairs of members:
</p><div class="example">
<pre class="example">(%i1) block([maxmin_effort : 1], min(x,x+1,x+3));
(%o1) min(x,x+1,x+3)

(%i2) block([maxmin_effort : 2], min(x,x+1,x+3));
(%o2) x
</pre></div>

<p>Finally, when <code>maxmin_effort</code> is three or more, <code>min</code> compares triples 
members and excludes those that are in between; for example
</p><div class="example">
<pre class="example">(%i1) block([maxmin_effort : 4], min(x, 2*x, 3*x, 4*x));
(%o1) max(x,4*x)
</pre></div>

<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="round"></a><a name="Item_003a-MathFunctions_002fdeffn_002fround"></a><dl>
<dt><a name="index-round"></a>Function: <strong>round</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>When <var>x</var> is a real number, returns the closest integer to <var>x</var>.
Multiples of 1/2 are rounded to the nearest even integer.  Evaluation of
<var>x</var> is similar to <code><a href="#floor">floor</a></code> and <code><a href="#ceiling">ceiling</a></code>.
</p>
<p>The <code>round</code> function distributes over lists, matrices and equations.
See <code><a href="maxima_46.html#distribute_005fover">distribute_over</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="signum"></a><a name="Item_003a-MathFunctions_002fdeffn_002fsignum"></a><dl>
<dt><a name="index-signum"></a>Function: <strong>signum</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>For either real or complex numbers <var>x</var>, the signum function returns
0 if <var>x</var> is zero; for a nonzero numeric input <var>x</var>, the signum function
returns <code>x/abs(x)</code>.
</p>
<p>For non-numeric inputs, Maxima attempts to determine the sign of the input.
When the sign is negative, zero, or positive, <code>signum</code> returns -1,0, 1,
respectively.  For all other values for the sign, <code>signum</code> a simplified but
equivalent form.  The simplifications include reflection (<code>signum(-x)</code>
gives <code>-signum(x)</code>) and multiplicative identity (<code>signum(x*y)</code> gives
<code>signum(x) * signum(y)</code>).
</p>
<p>The <code>signum</code> function distributes over a list, a matrix, or an
equation.  See <code><a href="maxima_63.html#sign">sign</a></code> and <code><a href="maxima_46.html#distribute_005fover">distribute_over</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="truncate"></a><a name="Item_003a-MathFunctions_002fdeffn_002ftruncate"></a><dl>
<dt><a name="index-truncate"></a>Function: <strong>truncate</strong> <em>(<var>x</var>)</em></dt>
<dd>
<p>When <var>x</var> is a real number, return the closest integer to <var>x</var> not
greater in absolute value than <var>x</var>.  Evaluation of <var>x</var> is similar
to <code><a href="#floor">floor</a></code> and <code><a href="#ceiling">ceiling</a></code>.
</p>
<p>The <code>truncate</code> function distributes over lists, matrices and equations.
See <code><a href="maxima_46.html#distribute_005fover">distribute_over</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Mathematical-functions">Mathematical functions</a>
&middot;</div></dd></dl>

<a name="Item_003a-MathFunctions_002fnode_002fFunctions-for-Complex-Numbers"></a><hr>
<div class="header">
<p>
Next: <a href="maxima_49.html#Functions-for-Complex-Numbers" accesskey="n" rel="next">Functions for Complex Numbers</a>, Up: <a href="maxima_47.html#Elementary-Functions" accesskey="u" rel="up">Elementary Functions</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>