Trigonometry Functions
These functions are used in geometric calculations to determine the size of angles. They all return radian values:
- sin( $num )
Returns the sine of $num in radians. - cos( $num )
Returns the cosine of $num in radians. - tan( $num )
Returns the tangent of $num in radians - asin( $num )
Returns the arc sine of $num in radians. - acos( $num )
Returns the arc cosine of $num in radians. - atan( $num )
Returns the arc tangent of $num in radians. - atan2( $y, $x)
Returns arc tangent of $x/$y where the sign of both parameters determines the quadrant of the result.
These functions convert values between radians and degrees.
- deg2rad( $num )
Converts the $num from degrees to radians and returns the result. - rad2deg( $num )
Converts the $num from radians to degrees and returns the result.
Square Root, PI, and Power
- pi()
Returns pie value 3.14159265359. - pow( $num, $exponent )
$num raised to the power of $exponent. If both parameters are non-negative integers and the result can be represented as an integer, the result will be returned with int type, otherwise it will be returned as a float. - sqrt( $num )
Returns the square root of $num.
Logarithm Functions
- exp( $num )
Returnse
raised to the number power. e is the base of the natural system of logarithms, or approximately 2.718282. For example, theecho exp(5.7);
returns 298.87. - log( $num, $base = M_E)
Returns the natural logarithm of $num. If the optional base parameter is specified, it returns log$base $num. - log10( $num )
Base-10 logarithm of $num.
Doing Math: