#include "MusimatTutorial.h"
Go to the source code of this file.
Functions | |
MusimatTutorialSection (B0127) |
MusimatTutorialSection | ( | B0127 | ) |
Definition at line 2 of file B0127.cpp.
{ Print("*** B.1.27 Other Built-in Functions ***"); /***************************************************************************** B.1.27 Other Built-in Functions Musimat includes standard mathematical functions such as Sqrt(x). There are trigono- metric functions such as Sin(x), Cos(x), and Tan(x). Arguments to trigonometric functions are in real radian values. Speaking of radian measure, here's an interesting way to compute Pi to the machine precision of your computer: *****************************************************************************/ Const Real Pi = Atan(1.0) * 4.0; // arctangent of 1 times 4 equals Pi Print("Pi=", Pi); /***************************************************************************** The function Abs(x) returns the absolute value of its argument. It works for either Real or Integer expressions. For instance, both of the following statements will print True: *****************************************************************************/ If (Abs(-5) == Abs(5)) // Integer Abs( ) Print(True); Else Print(False); If (Abs(-5.0) == Abs(5.0)) // Real Abs( ) Print(True); Else Print(False); /***************************************************************************** With no arguments, the built-in function Random() returns a real random value between 0.0 and 1.0, but if Random() is given arguments specifying Real lower and upper bounds, it returns a Real random value between those boundaries. For example, *****************************************************************************/ Real x = Random(0.0, 11.0); Print(x); /***************************************************************************** returns a random Real value in the range 0.0 <= x < 11.0. Note the range is from 0.0 to almost 11.0. If Random() is given arguments specifying Integer lower and upper bounds, it returns an Integer random value between those boundaries. For example, *****************************************************************************/ Integer y = Random(0, 11); Print(y); /***************************************************************************** returns a random Integer value in the range [0..11]. Note the range is inclusive from 0 to 11. *****************************************************************************/ }