I'm a computer scientist, so my math skills are a bit rudimentary. The application I'm writing is more or less about solving equations. I'm only interested in real number solutions, so imaginary numbers are forbidden. In this particular example, the equation has the form $$a = b^{x}$$ where $a$ and $b$ are given. What I'm looking for is a real solution for $x$ if it exists and if it doesn't I want to know that it doesn't.
What I can't do is calculating $$x = \frac{log(a)}{log(b)}$$ and check if it's real, because I'm restricted to real arithmetic functions. However I discovered, that calculating the "absolute log" $$x' = \frac{log(|a|)}{log(|b|)}$$ seems to produce the correct solution if a real solution exists and if it doesn't then $$-a= b^{x'}$$ will hold true. However, I have no proof of this.
So my question is: Does the "absolute log" function have the property that I described earlier? And if it does, how can I prove it?
Your $x'$ solves the equation $|a| = |b|^x$. Note that you can face a multitude of problems if you assume that the numbers a and b can be nonpositive.