Natural logarithm is defined as:
$\ln(Y) = x$
Which can be also written as:
$e^x = y$
Now the problem is, to solve the above equation for x you would need to use logarithm, unless the base can be set to be the same. The solution is circular. In other words the logarithm solution to the exponential equation problem is not the final solution at all, as we just take the logs as given.
The question is, how do the calculators solve the equation for x and thus provide the log functions which can be used? Where does the final solution to the problem come from? Is it just trial and error or is there a formula which can be used behind it?
Yes! The creation of the exponential and logarithmic functions are artificial in the sense that they are inverses of each other. So when Wikipedia defines the exponential function as the inverse of the natural log, you should feel a bit slighted.
$$(1) \quad e^x=\lim_{n \to \infty} \left(1+{1 \over n} \right)^{n \cdot x}$$
What does this say? Well, it says that if a number increases $(1+{1 \over n})$ percent per ${1 \over n}$ second as n approaches infinity, then growing by this amount for x seconds yields $e^x$. There are better sources available. Look here and at this.
For the $\ln(x)$ the most common definition is $$\ln(x)=\int_1^x {1 \over x} \ dx$$
This means the derivative of $\ln(x)$ is ${ 1 \over x}$. If we say the natural log has an inverse function $G(x)$ we arrive at. $$G^{'}(x)={1 \over {f^{'}(G(x))}}={1 \over {(G(x))^{-1}}}=G(x)$$
It's not difficult to show (1) has a derivative equal to itself and thus $e^x$ is indeed the inverse of $\ln(x)$.
How do you approximate these functions values? You can derive a series for $e^x$ fairly easily. If you say 1 equals $e^x$ you'll see that the derivative of 1 is 0, that's wrong, so we need to correct that bad approximation. We'll add $x$. Now we see the derivative is 1 however now we see that we have to add ${{x^2} \over 2}$ so the derivative is correct. We keep doing this and end up with.
$$e^x=1+x+{{x^2} \over {2!}}+{{x^3} \over {3!}}...$$
I won't prove it, but here's an expansion for $\ln(x)$
$$\ln(x)=x-{{x^2} \over 2}+{{x^3} \over 3}-{{x^4} \over 4}...$$
Note the similarities between the two series. Hope that helps!