Math functions

Revision as of 20:06, 16 May 2016 by Bbecane (talk | contribs)


These functions can be accessed from the Math library from the Definition menu.

Abs(x): Returns the absolute value of «x». When «x» is complex, returns the magnitude, see Complex number functions. See also Abs().

Abs(180) → 180
Abs(-210) → 210

Ceil(x): Returns the smallest integer that is greater than or equal to «x». See also Ceil().

Ceil(3.1) → 4
Ceil(5) → 5
Ceil(-2.9999) → -2
Ceil(-7) → -7

Ceil(x, digits): Returns the smallest number with the indicated of digits to the right of the decimal that is greater than or equal to «x». See also Ceil().

Ceil(Pi, 4) → 3.1416
Ceil(-12345, -2) → -12300

Floor(x): Returns the largest integer that is smaller than or equal to «x». See also Floor().

Floor(2.999) → 2
Floor(3) → 3
Floor(-2.01) → -3
Floor(-5) → -5

Floor(x, digits): Returns the largest number with the indicated number of digits past the decimal that is less than or equal to «x». See also Floor().

Floor(Pi, 4) → 3.1415
Floor(-12345, -2) → -12400

Round(x): Returns the value of «x» rounded to the nearest integer. See also Round().

Round(1.8) → 2
Round(-2.8) → -3
Round(1.499) → 1
Round(-2.499) → -2

Round(x, digits): Rounds the value of «x» to the number of decimal digits, indicated by «digits», to the right of the decimal point. See also Round().

Round(Pi, 1) → 3.100
Round(Pi, 3) → 3.142
Round(14243.4, -2) → 14200

Note: The Number Format setting determines how many digits are included when a number is displayed, while Round(x,digits) returns a new rounded number so that the rounded value can be used in subsequent computations.

Exp(x): Returns the exponential of «x», e raised to the power of «x». See also Exp().

Exp(5) → 148.4
Exp(-4) → 0.01832

Ln(x): Returns the natural logarithm of «x», which must be positive unless the system variable EnableComplexNumbers is set. See also Ln().

Ln(150) → 5.011
Ln(Exp(5)) → 5

Logten(x): Returns the logarithm to the base 10 of «x», which must be positive unless the system variable EnableComplexNumbers is set. See also Logten().

Logten(180) → 2.255
Logten(10^30) → 30

Sign(x): Returns -1 when «x» is negative, 1 when «x» is positive, 0 when «x» is zero, and NaN when «x» is NaN. See also Sign().

Sign(-15.2) → -1
Sign(7.3) → 1
Sign(0) → 0
Sign(0/0) → NaN

Sqr(x): Returns the square of «x». See also Sqr().

Sqr(5) → 25
Sqr(-4) → 16

Sqrt(x): Returns the square root of «x». «x» must be positive unless the system variable EnableComplexNumbers is set. See also Sqrt().

Sqrt(25) → 5
Sqrt(-1) → NAN
Sqrt(-1) → 1j { when EnableComplexNumbers is set }

Mod(x, y): Returns the remainder (modulus) of «x»/«y». See also Mod().

Mod(7, 3) → 1
Mod(12, 4) → 0
Mod(-14, 5) → -4

Factorial(x): Returns the factorial of «x», which must be between 0 and 170. See also Factorial().

Factorial(5) → 120
Factorial(0) → 1

If «x» is not an integer, it rounds «x» to the nearest integer before taking the factorial.

Cos(x), Sin(x), Tan(x): Return the cosine, sine, and tangent of «x», «x» assumed in degrees. See also Cos(x), Sin(x), Tan(x).

Cos(180) → -1
Cos(-210) → -0.866
Sin(30) → 0.5
Sin(-45) → -0.7071
Tan(45) → 1

Arctan(x): Returns the arctangent of «x» in degrees (the inverse of Tan). See also Arctan(x), Arccos(x), Arcsin(x), Arctan2(y, x) and Advanced math functions.

Arctan(0) → 0
Arctan(1) → 45
Arctan(Tan(45)) → 45

Degrees(r), Radians(d): Degrees(r) gives degrees from radians, and Radians(d) gives radians from degrees. See also Degrees(r) and Radians(d).

Degrees(Pi/2) → 90
Degrees(-Pi) → -180
Degrees(90) → -1.57079633
Degrees(180) → 3.141592654

See Also


Comments


You are not allowed to post comments.