This example shows how to calculate logarithms with log bases other than base 10 and base e (the natural logarithm).

The .NET Framework’s `Math.Log` function calculates the natural logarithm of a number. The `Math.Log10` function calculates the logarithm in base 10. To calculate a log in a different base, you can use this formula:

Log_{B}(N) = Log_{A}(N)/Log_{A}(B)

When you enter a number and a base and click the Find Log button, this example calculates the log of the number using that base. It displays the result and then raises the base to the calculated power to verify the result. The example uses the following `LogBase` method to perform the calculation.

// Calculate log(number) in the indicated log base. private double LogBase(double number, double log_base) { return Math.Log(number) / Math.Log(log_base); }

It is really a nice and helpful piece of info. I’m happy that you simply shared this useful info with

us. Please stay us informed like this. Thank you for sharing.