This file is indexed.

/usr/share/doc/yacas-doc/html/refprogchapter5.html is in yacas-doc 1.3.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<html>
<head>
  <title>Built-in (core) functions</title>
  <link rel="stylesheet" href="yacas.css" TYPE="text/css" MEDIA="screen">
</head>
<body>
<a name="c5">

</a>
(directly go to documentation on : <a href="refprogchapter5.html#MathNot" target='Chapters' title="built-in logical "not"">MathNot</a>, <a href="refprogchapter5.html#MathAnd" target='Chapters' title="built-in logical "and"">MathAnd</a>, <a href="refprogchapter5.html#MathOr" target='Chapters' title="built-in logical "or"">MathOr</a>, <a href="refprogchapter5.html#BitAnd" target='Chapters' title="bitwise and operation">BitAnd</a>, <a href="refprogchapter5.html#BitOr" target='Chapters' title="bitwise or operation">BitOr</a>, <a href="refprogchapter5.html#BitXor" target='Chapters' title="bitwise xor operation">BitXor</a>, <a href="refprogchapter5.html#Equals" target='Chapters' title="check equality">Equals</a>, <a href="refprogchapter5.html#GreaterThan" target='Chapters' title="comparison predicate">GreaterThan</a>, <a href="refprogchapter5.html#LessThan" target='Chapters' title="comparison predicate">LessThan</a>, <a href="refprogchapter5.html#Math..." target='Chapters' title="arbitrary-precision math functions">Math...</a>, <a href="refprogchapter5.html#Fast..." target='Chapters' title="double-precision math functions">Fast...</a>, <a href="refprogchapter5.html#ShiftLeft" target='Chapters' title="built-in bitwise shift left operation">ShiftLeft</a>, <a href="refprogchapter5.html#ShiftRight" target='Chapters' title="built-in bitwise shift right operation">ShiftRight</a>, <a href="refprogchapter5.html#IsPromptShown" target='Chapters' title="test for the Yacas prompt option">IsPromptShown</a>, <a href="refprogchapter5.html#GetTime" target='Chapters' title="measure the time taken by an evaluation">GetTime</a>.
)<h1>
5. Built-in (core) functions
</h1>

Yacas comes with a small core of built-in functions and a large library of
user-defined functions. Some of these core functions are documented in this
chapter.

<p> </p>
<center><table>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#MathNot" target='Chapters' title="built-in logical "not"">MathNot</a></td>
<td>built-in logical "not"</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#MathAnd" target='Chapters' title="built-in logical "and"">MathAnd</a></td>
<td>built-in logical "and"</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#MathOr" target='Chapters' title="built-in logical "or"">MathOr</a></td>
<td>built-in logical "or"</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#BitAnd" target='Chapters' title="bitwise and operation">BitAnd</a></td>
<td>bitwise and operation</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#BitOr" target='Chapters' title="bitwise or operation">BitOr</a></td>
<td>bitwise or operation</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#BitXor" target='Chapters' title="bitwise xor operation">BitXor</a></td>
<td>bitwise xor operation</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#Equals" target='Chapters' title="check equality">Equals</a></td>
<td>check equality</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#GreaterThan" target='Chapters' title="comparison predicate">GreaterThan</a></td>
<td>comparison predicate</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#LessThan" target='Chapters' title="comparison predicate">LessThan</a></td>
<td>comparison predicate</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#Math..." target='Chapters' title="arbitrary-precision math functions">Math...</a></td>
<td>arbitrary-precision math functions</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#Fast..." target='Chapters' title="double-precision math functions">Fast...</a></td>
<td>double-precision math functions</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#ShiftLeft" target='Chapters' title="built-in bitwise shift left operation">ShiftLeft</a></td>
<td>built-in bitwise shift left operation</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#ShiftRight" target='Chapters' title="built-in bitwise shift right operation">ShiftRight</a></td>
<td>built-in bitwise shift right operation</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#IsPromptShown" target='Chapters' title="test for the Yacas prompt option">IsPromptShown</a></td>
<td>test for the Yacas prompt option</td>
</tr>
<tr BGCOLOR=#E0E0E0>
<td><a href="refprogchapter5.html#GetTime" target='Chapters' title="measure the time taken by an evaluation">GetTime</a></td>
<td>measure the time taken by an evaluation</td>
</tr>
</table></center>

<p>
It is important for a developer to know which functions are built-in and cannot
be redefined or <b><tt>Retract</tt></b>-ed. Also, core functions may be somewhat faster to
execute than functions defined in the script library. All core functions are
listed in the file <b><tt>corefunctions.h</tt></b> in the <b><tt>src/</tt></b> subdirectory of the Yacas
source tree. The declarations typically look like this:


<p>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
SetCommand(LispSubtract, "MathSubtract");
</pre></tr>
</table>
Here <b><tt>LispSubtract</tt></b> is the Yacas internal name for the function and <b><tt>MathSubtract</tt></b> is the name visible to the Yacas language.
Built-in bodied functions and infix operators are declared in the same file.


<p>

<a name="MathNot">

</a>
<a name="mathnot">

</a>
<h3>
<hr>MathNot -- built-in logical "not"
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
MathNot(expression)
</pre></tr>
</table>


<p>

<h5>
Description:
</h5>
Returns "False" if "expression" evaluates
to "True", and vice versa.


<p>

<a name="MathAnd">

</a>
<a name="mathand">

</a>
<h3>
<hr>MathAnd -- built-in logical "and"
</h3>
<h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
MathAnd(...)
</pre></tr>
</table>


<p>

<h5>
Description:
</h5>
Lazy logical <b><tt>And</tt></b>: returns <b><tt>True</tt></b> if all args evaluate to
<b><tt>True</tt></b>, and does this by looking at first, and then at the
second argument, until one is <b><tt>False</tt></b>.
If one of the arguments is <b><tt>False</tt></b>, <b><tt>And</tt></b> immediately returns <b><tt>False</tt></b> without
evaluating the rest. This is faster, but also means that none of the
arguments should cause side effects when they are evaluated.


<p>

<a name="MathOr">

</a>
<a name="mathor">

</a>
<h3>
<hr>MathOr -- built-in logical "or"
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
MathOr(...)
</pre></tr>
</table>


<p>
<b><tt>MathOr</tt></b> is the basic logical "or" function. Similarly to <b><tt>And</tt></b>, it is
lazy-evaluated. <b><tt>And(...)</tt></b> and <b><tt>Or(...)</tt></b> do also exist, defined in the script
library. You can redefine them as infix operators yourself, so you have the
choice of precedence. In the standard scripts they are in fact declared as
infix operators, so you can write <b><tt>expr1 And expr</tt></b>.


<p>

<a name="BitAnd">

</a>
<a name="bitand">

</a>
<h3>
<hr>BitAnd -- bitwise and operation
</h3>
<a name="BitOr">

</a>
<a name="bitor">

</a>
<h3>
<hr>BitOr -- bitwise or operation
</h3>
<a name="BitXor">

</a>
<a name="bitxor">

</a>
<h3>
<hr>BitXor -- bitwise xor operation
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
BitAnd(n,m)
BitOr(n,m)
BitXor(n,m)
</pre></tr>
</table>


<p>

<h5>
Description:
</h5>
These functions return bitwise "and", "or" and "xor"
of two numbers.


<p>

<a name="Equals">

</a>
<a name="equals">

</a>
<h3>
<hr>Equals -- check equality
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
Equals(a,b)
</pre></tr>
</table>


<p>

<h5>
Description:
</h5>
Compares evaluated <b><tt>a</tt></b> and <b><tt>b</tt></b> recursively
(stepping into expressions). So "Equals(a,b)" returns
"True" if the expressions would be printed exactly
the same, and "False" otherwise.


<p>

<a name="GreaterThan">

</a>
<a name="greaterthan">

</a>
<h3>
<hr>GreaterThan -- comparison predicate
</h3>
<a name="LessThan">

</a>
<a name="lessthan">

</a>
<h3>
<hr>LessThan -- comparison predicate
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
GreaterThan(a,b)
LessThan(a,b)
</pre></tr>
</table>


<p>

<h5>
Parameters:
</h5>
<b><tt>a</tt></b>, <b><tt>b</tt></b> -- numbers or strings

<h5>
Description:
</h5>
Comparing numbers or strings (lexicographically).


<p>

<h5>
Example:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; LessThan(1,1)
Out&gt; False;
In&gt; LessThan("a","b")
Out&gt; True;
</pre></tr>
</table>


<p>

<a name="MathExp@\relax <b><tt>MathExp</tt></b>">

</a>
<a name="MathLog@\relax <b><tt>MathLog</tt></b>">

</a>
<a name="MathPower@\relax <b><tt>MathPower</tt></b>">

</a>
<a name="MathSin@\relax <b><tt>MathSin</tt></b>">

</a>
<a name="MathCos@\relax <b><tt>MathCos</tt></b>">

</a>
<a name="MathTan@\relax <b><tt>MathTan</tt></b>">

</a>
<a name="MathArcSin@\relax <b><tt>MathArcSin</tt></b>">

</a>
<a name="MathArcCos@\relax <b><tt>MathArcCos</tt></b>">

</a>
<a name="MathArcTan@\relax <b><tt>MathArcTan</tt></b>">

</a>
<a name="MathSinh@\relax <b><tt>MathSinh</tt></b>">

</a>
<a name="MathCosh@\relax <b><tt>MathCosh</tt></b>">

</a>
<a name="MathTanh@\relax <b><tt>MathTanh</tt></b>">

</a>
<a name="MathArcSinh@\relax <b><tt>MathArcSinh</tt></b>">

</a>
<a name="MathArcCosh@\relax <b><tt>MathArcCosh</tt></b>">

</a>
<a name="MathArcTanh@\relax <b><tt>MathArcTanh</tt></b>">

</a>
<a name="MathGcd@\relax <b><tt>MathGcd</tt></b>">

</a>
<a name="MathAdd@\relax <b><tt>MathAdd</tt></b>">

</a>
<a name="MathSubtract@\relax <b><tt>MathSubtract</tt></b>">

</a>
<a name="MathMultiply@\relax <b><tt>MathMultiply</tt></b>">

</a>
<a name="MathDivide@\relax <b><tt>MathDivide</tt></b>">

</a>
<a name="MathSqrt@\relax <b><tt>MathSqrt</tt></b>">

</a>
<a name="MathFloor@\relax <b><tt>MathFloor</tt></b>">

</a>
<a name="MathCeil@\relax <b><tt>MathCeil</tt></b>">

</a>
<a name="MathAbs@\relax <b><tt>MathAbs</tt></b>">

</a>
<a name="MathMod@\relax <b><tt>MathMod</tt></b>">

</a>
<a name="MathDiv@\relax <b><tt>MathDiv</tt></b>">

</a>
<a name="Math...">

</a>
<a name="math...">

</a>
<h3>
<hr>Math... -- arbitrary-precision math functions
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
MathGcd(n,m)      (Greatest Common Divisor)
MathAdd(x,y)      (add two numbers)
MathSubtract(x,y) (subtract two numbers)
MathMultiply(x,y) (multiply two numbers)
MathDivide(x,y)   (divide two numbers)
MathSqrt(x)    (square root, must be x&gt;=0)
MathFloor(x)   (largest integer not larger than x)
MathCeil(x)    (smallest integer not smaller than x)
MathAbs(x)     (absolute value of x, or |x| )
MathExp(x)     (exponential, base 2.718...)
MathLog(x)     (natural logarithm, for x&gt;0)
MathPower(x,y) (power, x ^ y)
MathSin(x)     (sine)
MathCos(x)     (cosine)
MathTan(x)     (tangent)
MathSinh(x)     (hyperbolic sine)
MathCosh(x)     (hyperbolic cosine)
MathTanh(x)     (hyperbolic tangent)
MathArcSin(x)   (inverse sine)
MathArcCos(x)   (inverse cosine)
MathArcTan(x)   (inverse tangent)
MathArcSinh(x)  (inverse hyperbolic sine)
MathArcCosh(x)  (inverse hyperbolic cosine)
MathArcTanh(x)  (inverse hyperbolic tangent)
MathDiv(x,y)    (integer division, result is an integer)
MathMod(x,y)    (remainder of division, or x mod y)
</pre></tr>
</table>


<p>

<h5>
Description:
</h5>
These commands perform the calculation of elementary mathematical functions.
The arguments <i>must</i> be numbers.
The reason for the prefix <b><tt>Math</tt></b> is that
the library needs to define equivalent
non-numerical functions for symbolic computations, such as <b><tt>Exp</tt></b>, <b><tt>Sin</tt></b> and so on.


<p>
Note that all functions, such as the <b><tt>MathPower</tt></b>, <b><tt>MathSqrt</tt></b>, <b><tt>MathAdd</tt></b> etc., accept integers as well as floating-point numbers.
The resulting values may be integers or floats.
If the mathematical result is an exact integer, then the integer is returned.
For example, <b><tt>MathSqrt(25)</tt></b> returns the integer <b><tt>5</tt></b>, and <b><tt>MathPower(2,3)</tt></b> returns the integer <b><tt>8</tt></b>.
In such cases, the integer result is returned even if the calculation requires more digits than set by <b><tt>Builtin'Precision'Set</tt></b>.
However, when the result is mathematically not an integer, the functions return a floating-point result which is correct only to the current precision.


<p>

<h5>
Example:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; Builtin'Precision'Set(10)
Out&gt; True
In&gt; Sqrt(10)
Out&gt; Sqrt(10)
In&gt; MathSqrt(10)
Out&gt; 3.16227766
In&gt; MathSqrt(490000*2^150)
Out&gt; 26445252304070013196697600
In&gt; MathSqrt(490000*2^150+1)
Out&gt; 0.264452523e26
In&gt; MathPower(2,3)
Out&gt; 8
In&gt; MathPower(2,-3)
Out&gt; 0.125
</pre></tr>
</table>


<p>

<a name="FastLog@\relax <b><tt>FastLog</tt></b>">

</a>
<a name="FastPower@\relax <b><tt>FastPower</tt></b>">

</a>
<a name="FastArcSin@\relax <b><tt>FastArcSin</tt></b>">

</a>
<a name="Fast...">

</a>
<a name="fast...">

</a>
<h3>
<hr>Fast... -- double-precision math functions
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>

<p>
FastLog(x) (natural logarithm),
FastPower(x,y),
FastArcSin(x)


<p>

<h5>
Description:
</h5>
Versions of these functions using the C++ library. These
should then at least be faster than the arbitrary precision versions.


<p>

<a name="ShiftLeft">

</a>
<a name="shiftleft">

</a>
<h3>
<hr>ShiftLeft -- built-in bitwise shift left operation
</h3>
<a name="ShiftRight">

</a>
<a name="shiftright">

</a>
<h3>
<hr>ShiftRight -- built-in bitwise shift right operation
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
ShiftLeft(expr,bits)
ShiftRight(expr,bits)
</pre></tr>
</table>


<p>

<h5>
Description:
</h5>
Shift bits to the left or to the right.


<p>

<a name="IsPromptShown">

</a>
<a name="ispromptshown">

</a>
<h3>
<hr>IsPromptShown -- test for the Yacas prompt option
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
IsPromptShown()
</pre></tr>
</table>

<h5>
Description:
</h5>
Returns <b><tt>False</tt></b> if Yacas has been started with the option to suppress the prompt, and <b><tt>True</tt></b> otherwise.


<p>

<a name="GetTime">

</a>
<a name="gettime">

</a>
<h3>
<hr>GetTime -- measure the time taken by an evaluation
</h3>
<h5 align=right>Internal function</h5><h5>
Calling format:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
GetTime(expr)
</pre></tr>
</table>

<h5>
Parameters:
</h5>
<b><tt>expr</tt></b> -- any expression

<h5>
Description:
</h5>
The function <b><tt>GetTime(expr)</tt></b> evaluates the expression <b><tt>expr</tt></b> and returns the time needed for the evaluation.
The result is returned as a floating-point number of seconds.
The value of the expression <b><tt>expr</tt></b> is lost.


<p>
The result is the "user time" as reported by the OS, not the real ("wall clock") time.
Therefore, any CPU-intensive processes running alongside Yacas will not significantly affect the result of <b><tt>GetTime</tt></b>.


<p>

<h5>
Example:
</h5>
<table cellpadding="0" width="100%">
<tr><td width=100% bgcolor="#DDDDEE"><pre>
In&gt; GetTime(Simplify((a*b)/(b*a)))
Out&gt; 0.09;
</pre></tr>
</table>


<p>

<h5>
See also:
</h5>
<a href="ref.html?Time" target="Chapters">
Time
</a>
.
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2425144-1";
urchinTracker();
</script>
</body>

</html>