I have a formula and this formula uses a log function with a custom base for example log with a base of b and value of x. In objective-c, I know there are log functions that calculate without a base and base of either 2 or 10.
Is there a function that has the ability to calculate a log function with a custom/variable base? or maybe there is an alternative method of completing this formula.
The basic idea of my formula is this log(1+0.02)(1.26825) (1+0.02 is the base). This should equal 12.000.
Logs of the same base can be added together by multiplying their arguments: log(xy) = log(x) + log(y). They can be subtracted by dividing the arguments: log(x/y) = log(x) - log(y).
To understand why, we have to understand that logarithms are actually like exponents: the base of a logarithm is also the base of a power function.
Like this:
double logWithBase(double base, double x) {
return log(x) / log(base);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With