AJ PHP Software Source Code Math Library
Logarithm Base
float log_base ( number y, number x)
Description:
log_base returns the base(b) of the logarithm given y and x in the following equation.
Source Code:
function log_base ($x, $y)
{
//variable and initializations
$the_result = 0.0;
$temp01 = 0.0;
//take the base 10 logarithm of y and divide by x
$temp01 = log10($y) / $x;
//calculate the result
$the_result = pow(10.0, $temp01);
//return the value
return $the_result;
}
|
Example:
<?
include ("ajmath.php"); $x = 2.0;
$y = 5.4;
$the_base = log_base ($x, $y);
echo "x = $x<br>";
echo "y = $y<br>";
echo "the_base = $the_base<br>";
?>
|
Run Example
References - Books:
Max A. Sobel, Nobert Lerner. 1991. Precalculus Mathematics. Prentice Hall.