Math Menu

Note: When creating a new program that uses this module, it is recommended to use the Math Calculations program type. This will ensure that all the relevant modules are imported.

Item

Description

from math import *

Imports all methods (functions) from the math module.

fabs()

Returns absolute value of a real number.

sqrt()

Returns square root of a real number.

exp()

Returns e**x.

pow(x,y)

Returns x raised to the power y.

log(x,base)

Returns logbase(x).

log(x) with no base returns the natural logarithm x.

fmod(x,y)

Returns module value of x and y. Use when x and y are floats.

ceil()

Returns the smallest integer greater than or equal to a real number.

floor()

Returns the largest integer less than or equal to a real number.

trunc()

Truncates a real number to an integer.

frexp()

Returns a pair (y,n) where x == y * 2**n.

 

Const

Item

Description

e

Returns value for the constant e.

pi

Returns value for the constant pi.

 

Trig

Item

Description

radians()

Converts angle in degrees to radians.

degrees()

Converts angle in radians to degrees.

sin()

Returns sine of argument in radians.

cos()

Returns cosine of argument in radians.

tan()

Returns tangent of argument in radians.

asin()

Returns arc sine of argument in radians.

acos()

Returns arc cosine of argument in radians.

atan()

Returns arc tangent of argument in radians.

atan2(y,x)

Returns arc tangent of y/x in radians.