< Octave Programming Tutorial 
      General Mathematical Functions
Constants
- eis the base of the natural logarithm.
- ewithout arguments returns the scalar e.
- e(N)returns a square matrix of e of size- N.
- e(N, M, ...)where the arguments are dimensions of some matrix of e.
- e(..., CLASS)where- CLASSis an optional argument that specifies the return type,- doubleor- single.
 
- epsis the machine precision and returns the relative spacing between any floating point number and the next representable number. This value is system dependent.
- epsreturns the value of- eps(1.0).
- eps(X)returns the spacing between X and the next value.
- epswith more than one argument is treated like- ewith the matrix value being- eps(1.0).
 
- All of the constant functions listed are defined exactly like e
- piis the ratio of the circumference to the diameter of any circle.
- Iis the imaginary unit defined so- I^2 = -1.
- Infis used for values that overflow the standard IEEE floating point range or the result of division by zero.
- NaNis used for various results that are not well defined or undefined. Note that- NaNnever equals other- NaNvalues. Use the function- isnanto check for- NaN.
- realmaxis the largest floating point value representable.
- realminis the smallest floating point value representable.
 
Arithmetic Functions
- floor(X)and- ceil(X)return the highest integer not greater than- Xor lowest integer not less than- X, respectively.
- round(X)and- fix(X)return the integer closest to- Xor truncate- Xtowards zero, respectively.
- rem(X,Y)and- mod(X,Y)returns x - y * fix( x ./ y ) or x - y * floor( x ./ y ), they are the same except when dealing with negative arguments.
- hypot(X, Y)returns the length of the hypotenuse of a right-angle triangle with the adjacent and opposite of size- Xand- Y.
- abs(X)return absolute of x.
- sign(X)return sign of the x (-1, 0 or +1).
Ordinary Trigonometry
- cos(X),- sin(x)and- tan(X)— the elemental functions that we all know and love. They take their arguments in radians.
- acos(X),- asin(X)are the inverses of- cosand- sinand are able to compute arguments not contained in the range [-1,1].
- atan(X)and- atan2(Y, X)are the 2 available inverses of tan.- atanis a simple inverse whereas- atan2takes 2 arguments and returns an angle in the appropriate quadrant. More information on- atan2can be found here.
- Note that one can add the character d to any of the functions except atan2and they will work in degrees rather than radians. For example:asind(0.3) = asin(0.3*180/pi)
- exp(x), exponential funtion of x
- log(x), natural logarithmic of x, loge NOT log 10
Hyperbolic Trigonometry
- cosh(X),- sinh(X)and- tanh(X)are analog to their more prosaic counterparts but deal with the unit hyperbola instead of the unit circle. They also take their arguments in radians.
- acosh(X),- asinh(X)and- atanh(X)are the inverses of- cosh,- sinhand- tanh.
- Unlike their circular uncles they cannot be made to take their arguments in degrees.
    This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.