C:/Musimathics_local/Musimat/MusimatTutorial/B0127.cpp

Go to the documentation of this file.
00001 #include "MusimatTutorial.h"
00002 MusimatTutorialSection(B0127) {
00003 Print("*** B.1.27 Other Built-in Functions ***");
00004 /*****************************************************************************
00005 
00006 B.1.27 Other Built-in Functions
00007 
00008 Musimat includes standard mathematical functions such as Sqrt(x). There are trigono-
00009 metric functions such as Sin(x), Cos(x), and Tan(x). Arguments to trigonometric functions 
00010 are in real radian values. Speaking of radian measure, here’s an interesting way to compute Pi to 
00011 the machine precision of your computer:
00012 *****************************************************************************/
00013 
00014 Const Real Pi = Atan(1.0) * 4.0;                        // arctangent of 1 times 4 equals Pi
00015 
00016 /*****************************************************************************
00017 The function Abs(x) returns the absolute value of its argument. It works for either Real or 
00018 Integer expressions. For instance, both of the following statements will print True:
00019 *****************************************************************************/
00020 
00021 If (Abs(-5) == Abs(5))  // Integer Abs( )
00022         Print(True); 
00023 Else 
00024         Print(False);
00025 
00026 If (Abs(-5.0) == Abs(5.0)) // Real Abs( ) 
00027         Print(True); 
00028 Else 
00029         Print(False);
00030 
00031 /*****************************************************************************
00032 With no arguments, the built-in function Random() returns a real random value between 0.0 and 
00033 1.0, but if Random() is given arguments specifying Real lower and upper bounds, it returns a 
00034 Real random value between those boundaries. For example,
00035 *****************************************************************************/
00036 
00037 Real x = Random(0.0, 11.0);
00038 
00039 /*****************************************************************************
00040 returns a random Real value in the range 0.0 <= x < 11.0. Note the range is from 0.0 to almost 11.0.
00041 
00042 If Random() is given arguments specifying Integer lower and upper bounds, it returns an 
00043 Integer random value between those boundaries. For example,
00044 *****************************************************************************/
00045 
00046 Integer y = Random(0, 11);
00047 
00048 /*****************************************************************************
00049 returns a random Integer value in the range [0..11]. Note the range is inclusive from 0 to 11.
00050 
00051 *****************************************************************************/
00052 }}
00053 
00055 /* $Revision: 1.4 $ $Date: 2006/09/12 17:38:01 $ $Author: dgl $ $Name:  $ $Id: _b0127_8cpp-source.html,v 1.4 2006/09/12 17:38:01 dgl Exp $ */
00056 // The Musimat Tutorial © 2006 Gareth Loy
00057 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 
00058 // and published exclusively by The MIT Press.
00059 // This program is released WITHOUT ANY WARRANTY; without even the implied 
00060 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
00061 // For information on usage and redistribution, and for a DISCLAIMER OF ALL
00062 // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
00063 // "Musimathics" is available here:     http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
00064 // Gareth Loy's Musimathics website:    http://www.musimathics.com/
00065 // The Musimat website:                 http://www.musimat.com/
00066 // This program is released under the terms of the GNU General Public License
00067 // available here:                      http://www.gnu.org/licenses/gpl.txt
00068 

Generated on Tue Sep 12 10:14:24 2006 for Musimat Tutorial by  doxygen 1.4.7