Lecture
When solving various problems using a computer, it is necessary to calculate the logarithm or modulus of a number, the sine of an angle, etc.
Function pointer | ||
Absolute value (modulus) | | x | | abs (x) |
Square root | sqrt (x) | |
Natural logarithm | ln x | ln (x) |
Decimal logarithm | lg x | lg (x) |
Exponent (degree of number e ~ 2.72) | e x | exp (x) |
The sign of the number x (- 1 if x <0; 0, if x = 0; 1, if x> 0) | sign x | sign (x) |
Integer part of x (i.e. maximum integer not exceeding x) | int (x) | |
Minimum of numbers x and y | min (x, y) | |
Maximum of numbers x and y | max (x, y) | |
The quotient of dividing x by integer y | div (x, y) | |
The remainder of dividing integer x by integer y | mod (x, y) | |
Random number from 0 to x - 1 | rnd (x) | |
Sine (angle in radians) | sin x | sin (x) |
Cosine (angle in radians) | cos x | cos (x) |
Tangent (angle in radians) | tg x | tg (x) |
Cotangent (angle in radians) | ctg x | ctg (x) |
Arcsine (main value in radians) | arcsin x | arcsin (x) |
Arccosine (principal in radians) | arccos x | arccos (x) |
Arctangent (most important in radians) | arctg x | arctg (x) |
Arccoat tangents (most important in radians) | arcctg x | arcctg (x) |
As arguments of functions, you can use constants, variables and expressions. For example:
sin (3.05) min (a, 5) | sin (x) min (a, b) | sin (2 * y + t / 2) min (a + b, a * b) | sin ((exp (x) + 1) ** 2) min (min (a, b), min (c, d)) |
Each programming language has its own set of standard functions.
Comments
To leave a comment
Programming Languages and Methods / Translation Theory
Terms: Programming Languages and Methods / Translation Theory