Calculating Non-Integer Exponent I just wanted to directly calculate the value of the number $2^{3.1}$ as I was wondering how a computer would do it. I've done some higher mathematics, but I'm very unsure of what I would do to solve this algorithmically, without a simple trial and error.
I noted that 
$$ 2^{3.1} = 2^{3} \times 2^{0.1} $$
So I've simplified the problem to an "integer part" (which is easy enough) :  $2^3 = 2\times 2\times 2$, but I'm still very confused about the "decimal part". I also know that :
$$ 2^{0.1} = e^{0.1\log{2}} $$
But that still presents a similar problem, because you'd need to calculate another non-integer exponent for the natural exponential. As far as I can see, the only way to do this is to let:
$$2^{0.1}=a $$ 
And then trial and error with some brute force approach (adjusting my guess for a as I go). Even Newton's method didn't seem to give me anything meaningful. Does anybody have any idea how we could calculate this with some working algorithm?
 A: Start with:
$$2^{3.1} = 2^3 2^{0.1} = 2^3 e^{0.1 \log{2}}$$
Now use a Taylor expansion, so that the above is approximately
$$2^3  \left [1+0.1 \log{2} + \frac{1}{2!} (0.1 \log{2})^2 + \frac{1}{3!} (0.1 \log{2})^3+\cdots + \frac{1}{n!} (0.1 \log{2})^n\right ] $$
wheer $n$ depends on the tolerance you require.  In this case, if this error tolerance is $\epsilon$, then we want
$$\frac{1}{(n+1)!} (0.1 \log{2})^{n+1} \lt \epsilon$$
For example, if $\epsilon=5 \cdot 10^{-7}$, then $n=4$.
A: To answer a question that me from the past had :P
The basic idea is that you could actually calculate both of these directly.
$$ 2^{3.1} = e^{2 \log\left( 3.1 \right)} $$
So really the procedure is simple:

*

*Take the natural log of 3.1

*Multiply by the base (2)

*Use the result as the argument to $\exp(x) $ or $e^x$
So this problem is really reduced to, how do calculators calculate logarithms and exponentials? The answer to that isn't so hard. I'm not giving the fastest methods by any means, there are some series that converge to these values much more quickly than the ones I've suggested, but this should get anybody who sees this in the future on track pretty quickly :).
Calculating the Log
To calculate the logarithm, a numerical method like the trapezoidal rule or Simpsons rule would be sufficient; because:
$$ \log (x) = \int_1^x { 1 \over t } dt $$
Calculating the Exponential
Here we could just use the direct limit definition:
$$ \exp (x) = \lim_{n\rightarrow\infty}\left(1+{x \over n }\right)^n $$
Where n is just some large integer (so you just multiply directly), or you could again, approximate $e^x $ with a taylor series, which should converge to the actual answer a little more quickly, since:
$$ \exp (x) = \lim_{n\rightarrow \infty}\left( 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + ... + {x^n \over n!} \right) $$
However, most calculators store some of these values in a LUT (look up table), since they will be (at least partially) pre-calculated with more accuracy than you are likely to need. This allows modern computers to find the exponential and logarithm of a function very quickly [although X86 - which is the instruction set used by most common computers today actually calculates $2^x$ and $log_2 (x)$, because its easy to calculate them in binary (base 2)].
A: Trial and error is how a finance calculator will solve for interest in a present value calculation. 
If a log function is solved quickly, it's possible to be a lookup table, or trial/error with a fast processor. 
Try creating a spreadsheet, where ten consecutive cells each represent a single digit, from the whole number to nine beyond the decimal. If a^10=2 it would stand to reason to start with 1.0xxxx and I'd say that on a bet you can guess the next digit in a couple seconds. 
You started by not wanting trial and error, but then gave into it toward the end of the question. 
A: 3.1 = 31/10
$2^{3.1}$ = 10th root of $2^{31}$ or $2^{31/10}$.
Adapted Newton's approximation to find the 10th root of a number $x$, it goes as follows. 
Start off with some initial guess $y$ for the answer.


*

*$y$ is your current guess (say, 8)

*A better estimate is $$y - \frac{y^{10} - x}{10 y^9}$$ (which, in this case, gives 8.8)

*Repeat until it is accurate enough.

